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

@ -27,6 +27,7 @@ namespace Tests\Unit\Services\Servers;
use Exception;
use GuzzleHttp\Exception\RequestException;
use Illuminate\Database\ConnectionInterface;
use Illuminate\Log\Writer;
use Mockery as m;
use Pterodactyl\Exceptions\DisplayException;
use Pterodactyl\Models\Server;
@ -67,6 +68,11 @@ class ReinstallServiceTest extends TestCase
*/
protected $service;
/**
* @var \Illuminate\Log\Writer
*/
protected $writer;
/**
* Setup tests.
*/
@ -78,12 +84,15 @@ class ReinstallServiceTest extends TestCase
$this->database = m::mock(ConnectionInterface::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 ReinstallService(
$this->database,
$this->daemonServerRepository,
$this->repository
$this->repository,
$this->writer
);
}
@ -146,6 +155,8 @@ class ReinstallServiceTest 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->reinstall($this->server);
} catch (Exception $exception) {