Fix broken unit tests
This commit is contained in:
parent
8b9c2465f3
commit
eafc4408eb
3 changed files with 6 additions and 28 deletions
|
@ -4,11 +4,10 @@ namespace Tests\Unit\Http\Middleware\Server;
|
|||
|
||||
use Mockery as m;
|
||||
use Pterodactyl\Models\Server;
|
||||
use Illuminate\Contracts\Session\Session;
|
||||
use Illuminate\Contracts\Config\Repository;
|
||||
use Illuminate\Contracts\Routing\ResponseFactory;
|
||||
use Tests\Unit\Http\Middleware\MiddlewareTestCase;
|
||||
use Pterodactyl\Http\Middleware\AccessingValidServer;
|
||||
use Pterodactyl\Http\Middleware\Server\AccessingValidServer;
|
||||
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
|
||||
|
||||
class AccessingValidServerTest extends MiddlewareTestCase
|
||||
|
@ -28,11 +27,6 @@ class AccessingValidServerTest extends MiddlewareTestCase
|
|||
*/
|
||||
private $response;
|
||||
|
||||
/**
|
||||
* @var \Illuminate\Contracts\Session\Session|\Mockery\Mock
|
||||
*/
|
||||
private $session;
|
||||
|
||||
/**
|
||||
* Setup tests.
|
||||
*/
|
||||
|
@ -43,7 +37,6 @@ class AccessingValidServerTest extends MiddlewareTestCase
|
|||
$this->config = m::mock(Repository::class);
|
||||
$this->repository = m::mock(ServerRepositoryInterface::class);
|
||||
$this->response = m::mock(ResponseFactory::class);
|
||||
$this->session = m::mock(Session::class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -114,7 +107,6 @@ class AccessingValidServerTest extends MiddlewareTestCase
|
|||
$this->request->shouldReceive('is')->with(...[])->once()->andReturn(false);
|
||||
|
||||
$this->repository->shouldReceive('getByUuid')->with('123456')->once()->andReturn($model);
|
||||
$this->session->shouldReceive('now')->with('server_data.model', $model)->once()->andReturnNull();
|
||||
|
||||
$this->getMiddleware()->handle($this->request, $this->getClosureAssertions());
|
||||
$this->assertRequestHasAttribute('server');
|
||||
|
@ -141,10 +133,10 @@ class AccessingValidServerTest extends MiddlewareTestCase
|
|||
/**
|
||||
* Return an instance of the middleware using mocked dependencies.
|
||||
*
|
||||
* @return \Pterodactyl\Http\Middleware\AccessingValidServer
|
||||
* @return \Pterodactyl\Http\Middleware\Server\AccessingValidServer
|
||||
*/
|
||||
private function getMiddleware(): AccessingValidServer
|
||||
{
|
||||
return new AccessingValidServer($this->config, $this->response, $this->repository, $this->session);
|
||||
return new AccessingValidServer($this->config, $this->response, $this->repository);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue