Add build modification settings, fix exception handling to log to file

This commit is contained in:
Dane Everitt 2017-07-23 19:57:43 -05:00
parent ace70a3599
commit f842aae3d3
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
15 changed files with 427 additions and 50 deletions

View file

@ -26,6 +26,7 @@ namespace Tests\Unit\Services\Servers;
use Exception;
use GuzzleHttp\Exception\RequestException;
use Illuminate\Log\Writer;
use Mockery as m;
use Pterodactyl\Exceptions\DisplayException;
use Pterodactyl\Models\Server;
@ -61,6 +62,11 @@ class ContainerRebuildServiceTest extends TestCase
*/
protected $service;
/**
* @var \Illuminate\Log\Writer
*/
protected $writer;
/**
* Setup tests.
*/
@ -71,9 +77,15 @@ class ContainerRebuildServiceTest extends TestCase
$this->daemonServerRepository = m::mock(DaemonServerRepositoryInterface::class);
$this->exception = m::mock(RequestException::class)->makePartial();
$this->repository = m::mock(ServerRepositoryInterface::class);
$this->writer = m::mock(Writer::class);
$this->server = factory(Server::class)->make(['node_id' => 1]);
$this->service = new ContainerRebuildService($this->daemonServerRepository, $this->repository);
$this->service = new ContainerRebuildService(
$this->daemonServerRepository,
$this->repository,
$this->writer
);
}
/**
@ -114,6 +126,8 @@ class ContainerRebuildServiceTest extends TestCase
$this->exception->shouldReceive('getResponse')->withNoArgs()->once()->andReturnSelf()
->shouldReceive('getStatusCode')->withNoArgs()->once()->andReturn(400);
$this->writer->shouldReceive('warning')->with($this->exception)->once()->andReturnNull();
try {
$this->service->rebuild($this->server);
} catch (Exception $exception) {