Update repository base code to be cleaner and make use of PHP 7 features

This commit is contained in:
Dane Everitt 2018-01-04 22:49:50 -06:00
parent 0ec5a4e08c
commit 60eb60013c
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
96 changed files with 1048 additions and 1785 deletions

View file

@ -116,13 +116,13 @@ class ServerDeletionServiceTest extends TestCase
->shouldReceive('delete')->withNoArgs()->once()->andReturnNull();
$this->connection->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull();
$this->databaseRepository->shouldReceive('withColumns')->with('id')->once()->andReturnSelf()
$this->databaseRepository->shouldReceive('setColumns')->with('id')->once()->andReturnSelf()
->shouldReceive('findWhere')->with([
['server_id', '=', $this->model->id],
])->once()->andReturn(collect([(object) ['id' => 50]]));
$this->databaseManagementService->shouldReceive('delete')->with(50)->once()->andReturnNull();
$this->repository->shouldReceive('delete')->with($this->model->id)->once()->andReturnNull();
$this->repository->shouldReceive('delete')->with($this->model->id)->once()->andReturn(1);
$this->connection->shouldReceive('commit')->withNoArgs()->once()->andReturnNull();
$this->service->handle($this->model);
@ -140,13 +140,13 @@ class ServerDeletionServiceTest extends TestCase
$this->exception->shouldReceive('getResponse')->withNoArgs()->once()->andReturnNull();
$this->writer->shouldReceive('warning')->with($this->exception)->once()->andReturnNull();
$this->connection->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull();
$this->databaseRepository->shouldReceive('withColumns')->with('id')->once()->andReturnSelf()
$this->databaseRepository->shouldReceive('setColumns')->with('id')->once()->andReturnSelf()
->shouldReceive('findWhere')->with([
['server_id', '=', $this->model->id],
])->once()->andReturn(collect([(object) ['id' => 50]]));
$this->databaseManagementService->shouldReceive('delete')->with(50)->once()->andReturnNull();
$this->repository->shouldReceive('delete')->with($this->model->id)->once()->andReturnNull();
$this->repository->shouldReceive('delete')->with($this->model->id)->once()->andReturn(1);
$this->connection->shouldReceive('commit')->withNoArgs()->once()->andReturnNull();
$this->service->withForce()->handle($this->model);
@ -176,21 +176,21 @@ class ServerDeletionServiceTest extends TestCase
*/
public function testIntegerCanBePassedInPlaceOfServerModel()
{
$this->repository->shouldReceive('withColumns')->with(['id', 'node_id', 'uuid'])->once()->andReturnSelf()
$this->repository->shouldReceive('setColumns')->with(['id', 'node_id', 'uuid'])->once()->andReturnSelf()
->shouldReceive('find')->with($this->model->id)->once()->andReturn($this->model);
$this->daemonServerRepository->shouldReceive('setNode')->with($this->model->node_id)->once()->andReturnSelf()
->shouldReceive('setAccessServer')->with($this->model->uuid)->once()->andReturnSelf()
->shouldReceive('delete')->withNoArgs()->once()->andReturnNull();
->shouldReceive('delete')->withNoArgs()->once()->andReturn(1);
$this->connection->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull();
$this->databaseRepository->shouldReceive('withColumns')->with('id')->once()->andReturnSelf()
$this->databaseRepository->shouldReceive('setColumns')->with('id')->once()->andReturnSelf()
->shouldReceive('findWhere')->with([
['server_id', '=', $this->model->id],
])->once()->andReturn(collect([(object) ['id' => 50]]));
$this->databaseManagementService->shouldReceive('delete')->with(50)->once()->andReturnNull();
$this->repository->shouldReceive('delete')->with($this->model->id)->once()->andReturnNull();
$this->repository->shouldReceive('delete')->with($this->model->id)->once()->andReturn(1);
$this->connection->shouldReceive('commit')->withNoArgs()->once()->andReturnNull();
$this->service->handle($this->model->id);