Add more front-end controllers, language file cleanup
This commit is contained in:
parent
4532811fcd
commit
54554465f2
59 changed files with 1100 additions and 336 deletions
|
@ -149,7 +149,7 @@ class APIControllerTest extends TestCase
|
|||
|
||||
$response = $this->controller->store($this->request);
|
||||
$this->assertIsRedirectResponse($response);
|
||||
$this->assertRouteRedirectEquals('account.api', $response);
|
||||
$this->assertRedirectRouteEquals('account.api', $response);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -95,7 +95,7 @@ class AccountControllerTest extends TestCase
|
|||
|
||||
$response = $this->controller->update($this->request);
|
||||
$this->assertIsRedirectResponse($response);
|
||||
$this->assertRouteRedirectEquals('account', $response);
|
||||
$this->assertRedirectRouteEquals('account', $response);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -112,7 +112,7 @@ class AccountControllerTest extends TestCase
|
|||
|
||||
$response = $this->controller->update($this->request);
|
||||
$this->assertIsRedirectResponse($response);
|
||||
$this->assertRouteRedirectEquals('account', $response);
|
||||
$this->assertRedirectRouteEquals('account', $response);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -131,6 +131,6 @@ class AccountControllerTest extends TestCase
|
|||
|
||||
$response = $this->controller->update($this->request);
|
||||
$this->assertIsRedirectResponse($response);
|
||||
$this->assertRouteRedirectEquals('account', $response);
|
||||
$this->assertRedirectRouteEquals('account', $response);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -167,7 +167,7 @@ class SecurityControllerTest extends TestCase
|
|||
|
||||
$response = $this->controller->disableTotp($this->request);
|
||||
$this->assertIsRedirectResponse($response);
|
||||
$this->assertRouteRedirectEquals('account.security', $response);
|
||||
$this->assertRedirectRouteEquals('account.security', $response);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -186,7 +186,7 @@ class SecurityControllerTest extends TestCase
|
|||
|
||||
$response = $this->controller->disableTotp($this->request);
|
||||
$this->assertIsRedirectResponse($response);
|
||||
$this->assertRouteRedirectEquals('account.security', $response);
|
||||
$this->assertRedirectRouteEquals('account.security', $response);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -201,6 +201,6 @@ class SecurityControllerTest extends TestCase
|
|||
|
||||
$response = $this->controller->revoke($this->request, 123);
|
||||
$this->assertIsRedirectResponse($response);
|
||||
$this->assertRouteRedirectEquals('account.security', $response);
|
||||
$this->assertRedirectRouteEquals('account.security', $response);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,6 @@ namespace Tests\Unit\Http\Controllers\Server;
|
|||
use Illuminate\Contracts\Session\Session;
|
||||
use Mockery as m;
|
||||
use Pterodactyl\Http\Controllers\Server\ConsoleController;
|
||||
use Pterodactyl\Models\Node;
|
||||
use Pterodactyl\Models\Server;
|
||||
use Tests\Assertions\ControllerAssertionsTrait;
|
||||
use Tests\TestCase;
|
||||
|
@ -73,10 +72,10 @@ class ConsoleControllerTest extends TestCase
|
|||
public function testAllControllers($function, $view)
|
||||
{
|
||||
$server = factory(Server::class)->make();
|
||||
$node = factory(Node::class)->make();
|
||||
$server->node = $node;
|
||||
|
||||
$this->session->shouldReceive('get')->with('server_data.model')->once()->andReturn($server);
|
||||
if ($function === 'index') {
|
||||
$this->session->shouldReceive('get')->with('server_data.model')->once()->andReturn($server);
|
||||
}
|
||||
$this->config->shouldReceive('get')->with('pterodactyl.console.count')->once()->andReturn(100);
|
||||
$this->config->shouldReceive('get')->with('pterodactyl.console.frequency')->once()->andReturn(10);
|
||||
$this->controller->shouldReceive('injectJavascript')->once()->andReturnNull();
|
||||
|
@ -84,10 +83,6 @@ class ConsoleControllerTest extends TestCase
|
|||
$response = $this->controller->$function();
|
||||
$this->assertIsViewResponse($response);
|
||||
$this->assertViewNameEquals($view, $response);
|
||||
$this->assertViewHasKey('server', $response);
|
||||
$this->assertViewHasKey('node', $response);
|
||||
$this->assertViewKeyEquals('server', $server, $response);
|
||||
$this->assertViewKeyEquals('node', $node, $response);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,92 @@
|
|||
<?php
|
||||
/*
|
||||
* Pterodactyl - Panel
|
||||
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace Tests\Unit\Http\Controllers\Server\Files;
|
||||
|
||||
use Mockery as m;
|
||||
use Illuminate\Cache\Repository;
|
||||
use Illuminate\Contracts\Session\Session;
|
||||
use phpmock\phpunit\PHPMock;
|
||||
use Pterodactyl\Http\Controllers\Server\Files\DownloadController;
|
||||
use Pterodactyl\Models\Node;
|
||||
use Pterodactyl\Models\Server;
|
||||
use Tests\Assertions\ControllerAssertionsTrait;
|
||||
use Tests\TestCase;
|
||||
|
||||
class DownloadControllerTest extends TestCase
|
||||
{
|
||||
use ControllerAssertionsTrait, PHPMock;
|
||||
|
||||
/**
|
||||
* @var \Illuminate\Cache\Repository
|
||||
*/
|
||||
protected $cache;
|
||||
|
||||
/**
|
||||
* @var \Pterodactyl\Http\Controllers\Server\Files\DownloadController
|
||||
*/
|
||||
protected $controller;
|
||||
|
||||
/**
|
||||
* @var \Illuminate\Contracts\Session\Session
|
||||
*/
|
||||
protected $session;
|
||||
|
||||
/**
|
||||
* Setup tests.
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->cache = m::mock(Repository::class);
|
||||
$this->session = m::mock(Session::class);
|
||||
|
||||
$this->controller = m::mock(DownloadController::class, [$this->cache, $this->session])->makePartial();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the download controller redirects correctly.
|
||||
*/
|
||||
public function testIndexController()
|
||||
{
|
||||
$server = factory(Server::class)->make();
|
||||
$node = factory(Node::class)->make();
|
||||
$server->node = $node;
|
||||
|
||||
$this->session->shouldReceive('get')->with('server_data.model')->once()->andReturn($server);
|
||||
$this->controller->shouldReceive('authorize')->with('download-files', $server)->once()->andReturnNull();
|
||||
$this->getFunctionMock('\\Pterodactyl\\Http\\Controllers\\Server\\Files', 'str_random')
|
||||
->expects($this->once())->willReturn('randomString');
|
||||
|
||||
$this->cache->shouldReceive('tags')->with(['Server:Downloads'])->once()->andReturnSelf()
|
||||
->shouldReceive('put')->with('randomString', ['server' => $server->uuid, 'path' => '/my/file.txt'], 5)->once()->andReturnNull();
|
||||
|
||||
$response = $this->controller->index('1234', '/my/file.txt');
|
||||
$this->assertIsRedirectResponse($response);
|
||||
$this->assertRedirectUrlEquals(sprintf(
|
||||
'%s://%s:%s/server/file/download/%s', $server->node->scheme, $server->node->fqdn, $server->node->daemonListen, 'randomString'
|
||||
), $response);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,217 @@
|
|||
<?php
|
||||
/*
|
||||
* Pterodactyl - Panel
|
||||
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace Tests\Unit\Http\Controllers\Server\Files;
|
||||
|
||||
use GuzzleHttp\Exception\RequestException;
|
||||
use Illuminate\Contracts\Session\Session;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Log\Writer;
|
||||
use Mockery as m;
|
||||
use Pterodactyl\Contracts\Repository\Daemon\FileRepositoryInterface;
|
||||
use Pterodactyl\Exceptions\DisplayException;
|
||||
use Pterodactyl\Http\Controllers\Server\Files\FileActionsController;
|
||||
use Pterodactyl\Http\Requests\Server\UpdateFileContentsFormRequest;
|
||||
use Pterodactyl\Models\Server;
|
||||
use Tests\Assertions\ControllerAssertionsTrait;
|
||||
use Tests\TestCase;
|
||||
|
||||
class FileActionsControllerTest extends TestCase
|
||||
{
|
||||
use ControllerAssertionsTrait;
|
||||
|
||||
/**
|
||||
* @var \Pterodactyl\Http\Controllers\Server\Files\FileActionsController
|
||||
*/
|
||||
protected $controller;
|
||||
|
||||
/**
|
||||
* @var \Pterodactyl\Http\Requests\Server\UpdateFileContentsFormRequest
|
||||
*/
|
||||
protected $fileContentsFormRequest;
|
||||
|
||||
/**
|
||||
* @var \Pterodactyl\Contracts\Repository\Daemon\FileRepositoryInterface
|
||||
*/
|
||||
protected $fileRepository;
|
||||
|
||||
/**
|
||||
* @var \Illuminate\Http\Request
|
||||
*/
|
||||
protected $request;
|
||||
|
||||
/**
|
||||
* @var \Illuminate\Contracts\Session\Session
|
||||
*/
|
||||
protected $session;
|
||||
|
||||
/**
|
||||
* @var \Illuminate\Log\Writer
|
||||
*/
|
||||
protected $writer;
|
||||
|
||||
/**
|
||||
* Setup tests.
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->fileContentsFormRequest = m::mock(UpdateFileContentsFormRequest::class);
|
||||
$this->fileRepository = m::mock(FileRepositoryInterface::class);
|
||||
$this->request = m::mock(Request::class);
|
||||
$this->session = m::mock(Session::class);
|
||||
$this->writer = m::mock(Writer::class);
|
||||
|
||||
$this->controller = m::mock(FileActionsController::class, [
|
||||
$this->fileRepository, $this->session, $this->writer,
|
||||
])->makePartial();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the index view controller.
|
||||
*/
|
||||
public function testIndexController()
|
||||
{
|
||||
$server = factory(Server::class)->make();
|
||||
|
||||
$this->session->shouldReceive('get')->with('server_data.model')->once()->andReturn($server);
|
||||
$this->controller->shouldReceive('authorize')->with('list-files', $server)->once()->andReturnNull();
|
||||
$this->request->shouldReceive('user->can')->andReturn(true);
|
||||
$this->controller->shouldReceive('injectJavascript')->once()->andReturnNull();
|
||||
|
||||
$response = $this->controller->index($this->request);
|
||||
$this->assertIsViewResponse($response);
|
||||
$this->assertViewNameEquals('server.files.index', $response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the file creation view controller.
|
||||
*
|
||||
* @dataProvider directoryNameProvider
|
||||
*/
|
||||
public function testCreateController($directory, $expected)
|
||||
{
|
||||
$server = factory(Server::class)->make();
|
||||
|
||||
$this->session->shouldReceive('get')->with('server_data.model')->once()->andReturn($server);
|
||||
$this->controller->shouldReceive('authorize')->with('create-files', $server)->once()->andReturnNull();
|
||||
$this->controller->shouldReceive('injectJavascript')->once()->andReturnNull();
|
||||
$this->request->shouldReceive('get')->with('dir')->andReturn($directory);
|
||||
|
||||
$response = $this->controller->create($this->request);
|
||||
$this->assertIsViewResponse($response);
|
||||
$this->assertViewNameEquals('server.files.add', $response);
|
||||
$this->assertViewHasKey('directory', $response);
|
||||
$this->assertViewKeyEquals('directory', $expected, $response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the update controller.
|
||||
*
|
||||
* @dataProvider fileNameProvider
|
||||
*/
|
||||
public function testUpdateController($file, $expected)
|
||||
{
|
||||
$server = factory(Server::class)->make();
|
||||
|
||||
$this->session->shouldReceive('get')->with('server_data.model')->once()->andReturn($server);
|
||||
$this->controller->shouldReceive('authorize')->with('edit-files', $server)->once()->andReturnNull();
|
||||
$this->session->shouldReceive('get')->with('server_data.token')->once()->andReturn($server->daemonSecret);
|
||||
$this->fileRepository->shouldReceive('setNode')->with($server->node_id)->once()->andReturnSelf()
|
||||
->shouldReceive('setAccessServer')->with($server->uuid)->once()->andReturnSelf()
|
||||
->shouldReceive('setAccessToken')->with($server->daemonSecret)->once()->andReturnSelf()
|
||||
->shouldReceive('getContent')->with($file)->once()->andReturn('file contents');
|
||||
|
||||
$this->fileContentsFormRequest->shouldReceive('getStats')->withNoArgs()->twice()->andReturn(['stats']);
|
||||
$this->controller->shouldReceive('injectJavascript')->with(['stat' => ['stats']])->once()->andReturnNull();
|
||||
|
||||
$response = $this->controller->update($this->fileContentsFormRequest, '1234', $file);
|
||||
$this->assertIsViewResponse($response);
|
||||
$this->assertViewNameEquals('server.files.edit', $response);
|
||||
$this->assertViewHasKey('file', $response);
|
||||
$this->assertViewHasKey('stat', $response);
|
||||
$this->assertViewHasKey('contents', $response);
|
||||
$this->assertViewHasKey('directory', $response);
|
||||
$this->assertViewKeyEquals('file', $file, $response);
|
||||
$this->assertViewKeyEquals('stat', ['stats'], $response);
|
||||
$this->assertViewKeyEquals('contents', 'file contents', $response);
|
||||
$this->assertViewKeyEquals('directory', $expected, $response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that an exception is handled correctly in the controller.
|
||||
*/
|
||||
public function testExceptionRenderedByUpdateController()
|
||||
{
|
||||
$server = factory(Server::class)->make();
|
||||
$exception = m::mock(RequestException::class);
|
||||
|
||||
$this->session->shouldReceive('get')->with('server_data.model')->once()->andReturn($server);
|
||||
$this->controller->shouldReceive('authorize')->with('edit-files', $server)->once()->andReturnNull();
|
||||
$this->fileRepository->shouldReceive('setNode')->with($server->node_id)->once()->andThrow($exception);
|
||||
|
||||
$exception->shouldReceive('getResponse')->withNoArgs()->once()->andReturnNull();
|
||||
$this->writer->shouldReceive('warning')->with($exception)->once()->andReturnNull();
|
||||
|
||||
try {
|
||||
$this->controller->update($this->fileContentsFormRequest, '1234', 'file.txt');
|
||||
} catch (DisplayException $exception) {
|
||||
$this->assertEquals(trans('exceptions.daemon_connection_failed', ['code' => 'E_CONN_REFUSED']), $exception->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides a list of directory names and the expected output from formatting.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function directoryNameProvider()
|
||||
{
|
||||
return [
|
||||
[null, ''],
|
||||
['/', ''],
|
||||
['', ''],
|
||||
['my/directory', 'my/directory/'],
|
||||
['/my/directory/', 'my/directory/'],
|
||||
['/////my/directory////', 'my/directory/'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides a list of file names and the expected output from formatting.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function fileNameProvider()
|
||||
{
|
||||
return [
|
||||
['/my/file.txt', 'my/'],
|
||||
['my/file.txt', 'my/'],
|
||||
['file.txt', '/'],
|
||||
['/file.txt', '/'],
|
||||
['./file.txt', '/'],
|
||||
];
|
||||
}
|
||||
}
|
|
@ -247,7 +247,7 @@ class AssignmentServiceTest extends TestCase
|
|||
$this->service->handle($this->node->id, $data);
|
||||
} catch (Exception $exception) {
|
||||
$this->assertInstanceOf(DisplayException::class, $exception);
|
||||
$this->assertEquals(trans('admin/exceptions.allocations.cidr_out_of_range'), $exception->getMessage());
|
||||
$this->assertEquals(trans('exceptions.allocations.cidr_out_of_range'), $exception->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -271,7 +271,7 @@ class AssignmentServiceTest extends TestCase
|
|||
}
|
||||
|
||||
$this->assertInstanceOf(DisplayException::class, $exception);
|
||||
$this->assertEquals(trans('admin/exceptions.allocations.too_many_ports'), $exception->getMessage());
|
||||
$this->assertEquals(trans('exceptions.allocations.too_many_ports'), $exception->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -295,7 +295,7 @@ class AssignmentServiceTest extends TestCase
|
|||
}
|
||||
|
||||
$this->assertInstanceOf(DisplayException::class, $exception);
|
||||
$this->assertEquals(trans('admin/exceptions.allocations.invalid_mapping', ['port' => 'test123']), $exception->getMessage());
|
||||
$this->assertEquals(trans('exceptions.allocations.invalid_mapping', ['port' => 'test123']), $exception->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -211,7 +211,7 @@ class DatabaseHostServiceTest extends TestCase
|
|||
try {
|
||||
$this->service->delete(1);
|
||||
} catch (DisplayException $exception) {
|
||||
$this->assertEquals(trans('admin/exceptions.databases.delete_has_databases'), $exception->getMessage());
|
||||
$this->assertEquals(trans('exceptions.databases.delete_has_databases'), $exception->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ class NodeDeletionServiceTest extends TestCase
|
|||
{
|
||||
$this->serverRepository->shouldReceive('withColumns')->with('id')->once()->andReturnSelf()
|
||||
->shouldReceive('findCountWhere')->with([['node_id', '=', 1]])->once()->andReturn(1);
|
||||
$this->translator->shouldReceive('trans')->with('admin/exceptions.node.servers_attached')->once()->andReturnNull();
|
||||
$this->translator->shouldReceive('trans')->with('exceptions.node.servers_attached')->once()->andReturnNull();
|
||||
$this->repository->shouldNotReceive('delete');
|
||||
|
||||
$this->service->handle(1);
|
||||
|
|
|
@ -157,7 +157,7 @@ class NodeUpdateServiceTest extends TestCase
|
|||
} catch (Exception $exception) {
|
||||
$this->assertInstanceOf(DisplayException::class, $exception);
|
||||
$this->assertEquals(
|
||||
trans('admin/exceptions.node.daemon_off_config_updated', ['code' => 400]),
|
||||
trans('exceptions.node.daemon_off_config_updated', ['code' => 400]),
|
||||
$exception->getMessage()
|
||||
);
|
||||
}
|
||||
|
|
|
@ -152,7 +152,7 @@ class PackCreationServiceTest extends TestCase
|
|||
$this->service->handle([], $this->file);
|
||||
} catch (Exception $exception) {
|
||||
$this->assertInstanceOf(InvalidFileUploadException::class, $exception);
|
||||
$this->assertEquals(trans('admin/exceptions.packs.invalid_upload'), $exception->getMessage());
|
||||
$this->assertEquals(trans('exceptions.packs.invalid_upload'), $exception->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -169,7 +169,7 @@ class PackCreationServiceTest extends TestCase
|
|||
try {
|
||||
$this->service->handle([], $this->file);
|
||||
} catch (InvalidFileMimeTypeException $exception) {
|
||||
$this->assertEquals(trans('admin/exceptions.packs.invalid_mime', [
|
||||
$this->assertEquals(trans('exceptions.packs.invalid_mime', [
|
||||
'type' => implode(', ', PackCreationService::VALID_UPLOAD_TYPES),
|
||||
]), $exception->getMessage());
|
||||
}
|
||||
|
|
|
@ -130,7 +130,7 @@ class PackDeletionServiceTest extends TestCase
|
|||
try {
|
||||
$this->service->handle($model);
|
||||
} catch (HasActiveServersException $exception) {
|
||||
$this->assertEquals(trans('admin/exceptions.packs.delete_has_servers'), $exception->getMessage());
|
||||
$this->assertEquals(trans('exceptions.packs.delete_has_servers'), $exception->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ class PackUpdateServiceTest extends TestCase
|
|||
try {
|
||||
$this->service->handle($model, ['option_id' => 0]);
|
||||
} catch (HasActiveServersException $exception) {
|
||||
$this->assertEquals(trans('admin/exceptions.packs.update_has_servers'), $exception->getMessage());
|
||||
$this->assertEquals(trans('exceptions.packs.update_has_servers'), $exception->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ class TemplateUploadServiceTest extends TestCase
|
|||
try {
|
||||
$this->service->handle(1, $this->file);
|
||||
} catch (InvalidFileUploadException $exception) {
|
||||
$this->assertEquals(trans('admin/exceptions.packs.invalid_upload'), $exception->getMessage());
|
||||
$this->assertEquals(trans('exceptions.packs.invalid_upload'), $exception->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -145,7 +145,7 @@ class TemplateUploadServiceTest extends TestCase
|
|||
try {
|
||||
$this->service->handle(1, $this->file);
|
||||
} catch (InvalidFileMimeTypeException $exception) {
|
||||
$this->assertEquals(trans('admin/exceptions.packs.invalid_mime', [
|
||||
$this->assertEquals(trans('exceptions.packs.invalid_mime', [
|
||||
'type' => implode(', ', TemplateUploadService::VALID_UPLOAD_TYPES),
|
||||
]), $exception->getMessage());
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ class TemplateUploadServiceTest extends TestCase
|
|||
try {
|
||||
$this->service->handle(1, $this->file);
|
||||
} catch (UnreadableZipArchiveException $exception) {
|
||||
$this->assertEquals(trans('admin/exceptions.packs.unreadable'), $exception->getMessage());
|
||||
$this->assertEquals(trans('exceptions.packs.unreadable'), $exception->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -190,7 +190,7 @@ class TemplateUploadServiceTest extends TestCase
|
|||
try {
|
||||
$this->service->handle(1, $this->file);
|
||||
} catch (InvalidPackArchiveFormatException $exception) {
|
||||
$this->assertEquals(trans('admin/exceptions.packs.invalid_archive_exception'), $exception->getMessage());
|
||||
$this->assertEquals(trans('exceptions.packs.invalid_archive_exception'), $exception->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -214,7 +214,7 @@ class TemplateUploadServiceTest extends TestCase
|
|||
try {
|
||||
$this->service->handle(1, $this->file);
|
||||
} catch (ZipExtractionException $exception) {
|
||||
$this->assertEquals(trans('admin/exceptions.packs.zip_extraction'), $exception->getMessage());
|
||||
$this->assertEquals(trans('exceptions.packs.zip_extraction'), $exception->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ class InstallScriptUpdateServiceTest extends TestCase
|
|||
$this->service->handle($this->model, $this->data);
|
||||
} catch (Exception $exception) {
|
||||
$this->assertInstanceOf(InvalidCopyFromException::class, $exception);
|
||||
$this->assertEquals(trans('admin/exceptions.service.options.invalid_copy_id'), $exception->getMessage());
|
||||
$this->assertEquals(trans('exceptions.service.options.invalid_copy_id'), $exception->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@ class OptionCreationServiceTest extends TestCase
|
|||
$this->service->handle(['config_from' => 1]);
|
||||
} catch (Exception $exception) {
|
||||
$this->assertInstanceOf(NoParentConfigurationFoundException::class, $exception);
|
||||
$this->assertEquals(trans('admin/exceptions.service.options.must_be_child'), $exception->getMessage());
|
||||
$this->assertEquals(trans('exceptions.service.options.must_be_child'), $exception->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ class OptionDeletionServiceTest extends TestCase
|
|||
$this->service->handle(1);
|
||||
} catch (\Exception $exception) {
|
||||
$this->assertInstanceOf(HasActiveServersException::class, $exception);
|
||||
$this->assertEquals(trans('admin/exceptions.service.options.delete_has_servers'), $exception->getMessage());
|
||||
$this->assertEquals(trans('exceptions.service.options.delete_has_servers'), $exception->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ class OptionUpdateServiceTest extends TestCase
|
|||
$this->service->handle($this->model, ['config_from' => 1]);
|
||||
} catch (Exception $exception) {
|
||||
$this->assertInstanceOf(NoParentConfigurationFoundException::class, $exception);
|
||||
$this->assertEquals(trans('admin/exceptions.service.options.must_be_child'), $exception->getMessage());
|
||||
$this->assertEquals(trans('exceptions.service.options.must_be_child'), $exception->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ class ServiceDeletionServiceTest extends TestCase
|
|||
$this->service->handle(1);
|
||||
} catch (Exception $exception) {
|
||||
$this->assertInstanceOf(HasActiveServersException::class, $exception);
|
||||
$this->assertEquals(trans('admin/exceptions.service.delete_has_servers'), $exception->getMessage());
|
||||
$this->assertEquals(trans('exceptions.service.delete_has_servers'), $exception->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@ class VariableUpdateServiceTest extends TestCase
|
|||
$this->service->handle($this->model, ['env_variable' => 'TEST_VAR_123']);
|
||||
} catch (Exception $exception) {
|
||||
$this->assertInstanceOf(DisplayException::class, $exception);
|
||||
$this->assertEquals(trans('admin/exceptions.service.variables.env_not_unique', [
|
||||
$this->assertEquals(trans('exceptions.service.variables.env_not_unique', [
|
||||
'name' => 'TEST_VAR_123',
|
||||
]), $exception->getMessage());
|
||||
}
|
||||
|
|
|
@ -213,7 +213,7 @@ class SubuserCreationServiceTest extends TestCase
|
|||
$this->service->handle($server, $user->email, []);
|
||||
} catch (DisplayException $exception) {
|
||||
$this->assertInstanceOf(UserIsServerOwnerException::class, $exception);
|
||||
$this->assertEquals(trans('admin/exceptions.subusers.user_is_owner'), $exception->getMessage());
|
||||
$this->assertEquals(trans('exceptions.subusers.user_is_owner'), $exception->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -235,7 +235,7 @@ class SubuserCreationServiceTest extends TestCase
|
|||
$this->service->handle($server, $user->email, []);
|
||||
} catch (DisplayException $exception) {
|
||||
$this->assertInstanceOf(ServerSubuserExistsException::class, $exception);
|
||||
$this->assertEquals(trans('admin/exceptions.subusers.subuser_exists'), $exception->getMessage());
|
||||
$this->assertEquals(trans('exceptions.subusers.subuser_exists'), $exception->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -132,7 +132,7 @@ class SubuserDeletionServiceTest extends TestCase
|
|||
try {
|
||||
$this->service->handle($subuser->id);
|
||||
} catch (DisplayException $exception) {
|
||||
$this->assertEquals(trans('admin/exceptions.daemon_connection_failed', ['code' => 'E_CONN_REFUSED']), $exception->getMessage());
|
||||
$this->assertEquals(trans('exceptions.daemon_connection_failed', ['code' => 'E_CONN_REFUSED']), $exception->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -152,7 +152,7 @@ class SubuserUpdateServiceTest extends TestCase
|
|||
try {
|
||||
$this->service->handle($subuser->id, []);
|
||||
} catch (DisplayException $exception) {
|
||||
$this->assertEquals(trans('admin/exceptions.daemon_connection_failed', ['code' => 'E_CONN_REFUSED']), $exception->getMessage());
|
||||
$this->assertEquals(trans('exceptions.daemon_connection_failed', ['code' => 'E_CONN_REFUSED']), $exception->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue