Fix broken tests due to grapping around...

This commit is contained in:
Dane Everitt 2017-08-20 19:51:15 -05:00
parent cdfbc60030
commit 47eec0398d
No known key found for this signature in database
GPG Key ID: EEA66103B3D71F53
8 changed files with 11 additions and 11 deletions

View File

@ -71,7 +71,7 @@ class AssignmentServiceTest extends TestCase
// //
// This can also be avoided if tests were run in isolated processes, or if that test // This can also be avoided if tests were run in isolated processes, or if that test
// came first, but neither of those are good solutions, so this is the next best option. // came first, but neither of those are good solutions, so this is the next best option.
PHPMock::defineFunctionMock('\\Pterodactyl\\Service\\Allocations', 'gethostbyname'); PHPMock::defineFunctionMock('\\Pterodactyl\\Services\\Allocations', 'gethostbyname');
$this->node = factory(Node::class)->make(); $this->node = factory(Node::class)->make();
$this->connection = m::mock(ConnectionInterface::class); $this->connection = m::mock(ConnectionInterface::class);
@ -180,7 +180,7 @@ class AssignmentServiceTest extends TestCase
'allocation_ports' => ['1024'], 'allocation_ports' => ['1024'],
]; ];
$this->getFunctionMock('\\Pterodactyl\\Service\\Allocations', 'gethostbyname') $this->getFunctionMock('\\Pterodactyl\\Services\\Allocations', 'gethostbyname')
->expects($this->once())->willReturn('192.168.1.1'); ->expects($this->once())->willReturn('192.168.1.1');
$this->connection->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull(); $this->connection->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull();

View File

@ -81,7 +81,7 @@ class KeyServiceTest extends TestCase
*/ */
public function test_create_function() public function test_create_function()
{ {
$this->getFunctionMock('\\Pterodactyl\\Service\\Api', 'random_bytes') $this->getFunctionMock('\\Pterodactyl\\Services\\Api', 'random_bytes')
->expects($this->exactly(2)) ->expects($this->exactly(2))
->willReturnCallback(function ($bytes) { ->willReturnCallback(function ($bytes) {
return hex2bin(str_pad('', $bytes * 2, '0')); return hex2bin(str_pad('', $bytes * 2, '0'));

View File

@ -84,7 +84,7 @@ class DatabaseManagementServiceTest extends TestCase
$this->encrypter = m::mock(Encrypter::class); $this->encrypter = m::mock(Encrypter::class);
$this->repository = m::mock(DatabaseRepositoryInterface::class); $this->repository = m::mock(DatabaseRepositoryInterface::class);
$this->getFunctionMock('\\Pterodactyl\\Service\\Database', 'str_random') $this->getFunctionMock('\\Pterodactyl\\Services\\Database', 'str_random')
->expects($this->any())->willReturn('str_random'); ->expects($this->any())->willReturn('str_random');
$this->service = new DatabaseManagementService( $this->service = new DatabaseManagementService(

View File

@ -61,7 +61,7 @@ class CreationServiceTest extends TestCase
*/ */
public function testNodeIsCreatedAndDaemonSecretIsGenerated() public function testNodeIsCreatedAndDaemonSecretIsGenerated()
{ {
$this->getFunctionMock('\\Pterodactyl\\Service\\Nodes', 'bin2hex') $this->getFunctionMock('\\Pterodactyl\\Services\\Nodes', 'bin2hex')
->expects($this->once())->willReturn('hexResult'); ->expects($this->once())->willReturn('hexResult');
$this->repository->shouldReceive('create')->with([ $this->repository->shouldReceive('create')->with([

View File

@ -97,14 +97,14 @@ class UpdateServiceTest extends TestCase
*/ */
public function testNodeIsUpdatedAndDaemonSecretIsReset() public function testNodeIsUpdatedAndDaemonSecretIsReset()
{ {
$this->getFunctionMock('\\Pterodactyl\\Service\\Nodes', 'random_bytes') $this->getFunctionMock('\\Pterodactyl\\Services\\Nodes', 'random_bytes')
->expects($this->once())->willReturnCallback(function ($bytes) { ->expects($this->once())->willReturnCallback(function ($bytes) {
$this->assertEquals(CreationService::DAEMON_SECRET_LENGTH, $bytes); $this->assertEquals(CreationService::DAEMON_SECRET_LENGTH, $bytes);
return '\00'; return '\00';
}); });
$this->getFunctionMock('\\Pterodactyl\\Service\\Nodes', 'bin2hex') $this->getFunctionMock('\\Pterodactyl\\Services\\Nodes', 'bin2hex')
->expects($this->once())->willReturn('hexResponse'); ->expects($this->once())->willReturn('hexResponse');
$this->repository->shouldReceive('withoutFresh')->withNoArgs()->once()->andReturnSelf() $this->repository->shouldReceive('withoutFresh')->withNoArgs()->once()->andReturnSelf()

View File

@ -155,7 +155,7 @@ class CreationServiceTest extends TestCase
$this->uuid = m::mock('overload:Ramsey\Uuid\Uuid'); $this->uuid = m::mock('overload:Ramsey\Uuid\Uuid');
$this->writer = m::mock(Writer::class); $this->writer = m::mock(Writer::class);
$this->getFunctionMock('\\Pterodactyl\\Service\\Servers', 'bin2hex') $this->getFunctionMock('\\Pterodactyl\\Services\\Servers', 'bin2hex')
->expects($this->any())->willReturn('randomstring'); ->expects($this->any())->willReturn('randomstring');
$this->getFunctionMock('\\Ramsey\\Uuid\\Uuid', 'uuid4') $this->getFunctionMock('\\Ramsey\\Uuid\\Uuid', 'uuid4')

View File

@ -84,7 +84,7 @@ class DetailsModificationServiceTest extends TestCase
$this->repository = m::mock(ServerRepository::class); $this->repository = m::mock(ServerRepository::class);
$this->writer = m::mock(Writer::class); $this->writer = m::mock(Writer::class);
$this->getFunctionMock('\\Pterodactyl\\Service\\Servers', 'bin2hex') $this->getFunctionMock('\\Pterodactyl\\Services\\Servers', 'bin2hex')
->expects($this->any())->willReturn('randomString'); ->expects($this->any())->willReturn('randomString');
$this->service = new DetailsModificationService( $this->service = new DetailsModificationService(

View File

@ -46,10 +46,10 @@ class UsernameGenerationServiceTest extends TestCase
$this->service = new UsernameGenerationService(); $this->service = new UsernameGenerationService();
$this->getFunctionMock('\\Pterodactyl\\Service\\Servers', 'bin2hex') $this->getFunctionMock('\\Pterodactyl\\Services\\Servers', 'bin2hex')
->expects($this->any())->willReturn('dddddddd'); ->expects($this->any())->willReturn('dddddddd');
$this->getFunctionMock('\\Pterodactyl\\Service\\Servers', 'str_random') $this->getFunctionMock('\\Pterodactyl\\Services\\Servers', 'str_random')
->expects($this->any())->willReturnCallback(function ($count) { ->expects($this->any())->willReturnCallback(function ($count) {
return str_pad('', $count, 'a'); return str_pad('', $count, 'a');
}); });