More test suite coverage

This commit is contained in:
Dane Everitt 2017-09-26 22:16:26 -05:00
parent 8908a758ca
commit 774c9680a3
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
14 changed files with 373 additions and 46 deletions

View file

@ -141,6 +141,7 @@ class SubuserCreationServiceTest extends TestCase
$user = factory(User::class)->make();
$subuser = factory(Subuser::class)->make(['user_id' => $user->id, 'server_id' => $server->id]);
$this->serverRepository->shouldReceive('find')->with($server->id)->once()->andReturn($server);
$this->connection->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull();
$this->userRepository->shouldReceive('findFirstWhere')->with([['email', '=', $user->email]])->once()->andReturn($user);
$this->subuserRepository->shouldReceive('findCountWhere')->with([
@ -154,7 +155,7 @@ class SubuserCreationServiceTest extends TestCase
$this->permissionService->shouldReceive('handle')->with($subuser->id, $permissions)->once()->andReturnNull();
$this->connection->shouldReceive('commit')->withNoArgs()->once()->andReturnNull();
$response = $this->service->handle($server, $user->email, $permissions);
$response = $this->service->handle($server->id, $user->email, $permissions);
$this->assertInstanceOf(Subuser::class, $response);
$this->assertSame($subuser, $response);
}