mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-19 17:34:45 +02:00
chore: Upgrade Dependencies (#1005)
* chore: yarn upgrade * chore: composer upgrade * chore: php artisan filament:upgrade * chore: update filament-monaco-editor-views * chore: update filament-monaco-editor-configs * chore: move turnstile-views to plugins * fix monaco-editor loader & css
This commit is contained in:
parent
2f56ca5ed5
commit
3d764a89f7
@ -28,7 +28,8 @@ class Login extends BaseLogin
|
||||
->hidden(!config('turnstile.turnstile_enabled'))
|
||||
->validationMessages([
|
||||
'required' => config('turnstile.error_messages.turnstile_check_message'),
|
||||
]),
|
||||
])
|
||||
->view('filament.plugins.turnstile'),
|
||||
])
|
||||
->statePath('data'),
|
||||
),
|
||||
|
0
bootstrap/cache/.gitignore
vendored
Normal file → Executable file
0
bootstrap/cache/.gitignore
vendored
Normal file → Executable file
1146
composer.lock
generated
1146
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -8,7 +8,7 @@ return [
|
||||
'placeholder-text' => 'Your code here...',
|
||||
'show-loader' => false,
|
||||
'font-size' => '16px',
|
||||
'line-numbers-min-chars' => true,
|
||||
'line-numbers-min-chars' => 3,
|
||||
'automatic-layout' => true,
|
||||
'default-theme' => 'blackboard',
|
||||
],
|
||||
|
@ -4,6 +4,7 @@
|
||||
"concat_space": false,
|
||||
"new_with_parentheses": {"anonymous_class": false},
|
||||
"not_operator_with_successor_space": false,
|
||||
"ordered_imports": false
|
||||
"ordered_imports": false,
|
||||
"single_line_comment_spacing": false
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -65,7 +65,7 @@
|
||||
|
||||
monacoEditorAddLoaderScriptToHead() {
|
||||
script = document.createElement('script');
|
||||
script.src = 'https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.49.0/min/vs/loader.min.js';
|
||||
script.src = 'https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.52.2/min/vs/loader.js';
|
||||
document.head.appendChild(script);
|
||||
},
|
||||
|
||||
@ -78,6 +78,11 @@
|
||||
`</body>`;
|
||||
},
|
||||
|
||||
showCodePreview(){
|
||||
this.previewContent = this.wrapPreview(this.monacoContent);
|
||||
this.showPreview = true;
|
||||
},
|
||||
|
||||
}" x-init="
|
||||
previewContent = wrapPreview(monacoContent);
|
||||
$el.style.height = '500px';
|
||||
@ -96,9 +101,9 @@
|
||||
monacoLoaderInterval = setInterval(() => {
|
||||
if(typeof _amdLoaderGlobal !== 'undefined'){
|
||||
|
||||
// Based on https://jsfiddle.net/developit/bwgkr6uq/ which works without needing service worker. Provided by loader.min.js.
|
||||
require.config({ paths: { 'vs': 'https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.49.0/min/vs' }});
|
||||
let proxy = URL.createObjectURL(new Blob([` self.MonacoEnvironment = { baseUrl: 'https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.49.0/min' }; importScripts('https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.49.0/min/vs/base/worker/workerMain.min.js');`], { type: 'text/javascript' }));
|
||||
// Based on https://jsfiddle.net/developit/bwgkr6uq/ which works without needing service worker. Provided by loader.js.
|
||||
require.config({ paths: { 'vs': 'https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.52.2/min/vs' }});
|
||||
let proxy = URL.createObjectURL(new Blob([` self.MonacoEnvironment = { baseUrl: 'https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.52.2/min' }; importScripts('https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.52.2/min/vs/base/worker/workerMain.js');`], { type: 'text/javascript' }));
|
||||
window.MonacoEnvironment = { getWorkerUrl: () => proxy };
|
||||
|
||||
require(['vs/editor/editor.main'], () => {
|
||||
@ -134,6 +139,27 @@
|
||||
}, 5); " :id="monacoId"
|
||||
class="fme-wrapper"
|
||||
:class="{ 'fme-full-screen': fullScreenModeEnabled }" x-cloak>
|
||||
<div class="fme-control-section">
|
||||
@if($getEnablePreview())
|
||||
<div x-data="{
|
||||
repositionTabMarker(el){
|
||||
this.$refs.marker.classList.remove('p-1');
|
||||
this.$refs.marker.style.width = el.offsetWidth + 'px';
|
||||
this.$refs.marker.style.height = el.offsetHeight + 'px';
|
||||
this.$refs.marker.style.left = el.offsetLeft + 'px';
|
||||
}
|
||||
}" x-cloak class="fme-code-preview-tab" wire:ignore>
|
||||
<button type="button" @click="repositionTabMarker($el); showPreview = false;" class="fme-code-preview-tab-item">
|
||||
{{ __("Code") }}
|
||||
</button>
|
||||
<button type="button" @click="repositionTabMarker($el); showCodePreview();" class="fme-code-preview-tab-item">
|
||||
{{ __("Preview") }}
|
||||
</button>
|
||||
<div x-ref="marker" class="fme-code-preview-tab-marker-container p-1">
|
||||
<div class="fme-code-preview-tab-marker"></div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
<div class="flex items-center ml-auto">
|
||||
@if($getShowFullScreenToggle())
|
||||
<button type="button" aria-label="{{ __("full_screen_btn_label") }}" class="fme-full-screen-btn" @click="toggleFullScreenMode()">
|
||||
@ -142,12 +168,25 @@
|
||||
</button>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<div class="h-full w-full">
|
||||
<div class="fme-container" x-show="!showPreview">
|
||||
<!-- Loader -->
|
||||
<div x-show="monacoLoader" class="fme-loader">
|
||||
<svg class="fme-loader-icon" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path></svg>
|
||||
</div>
|
||||
|
||||
<!-- Editor -->
|
||||
<div x-show="!monacoLoader" class="fme-element-wrapper">
|
||||
<div x-ref="monacoEditorElement" class="fme-element" wire:ignore style="height: 100%"></div>
|
||||
<div x-ref="monacoPlaceholderElement" x-show="monacoPlaceholder" @click="monacoEditorFocus()" :style="'font-size: ' + monacoFontSize" class="fme-placeholder" x-text="monacoPlaceholderText"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="fme-preview-wrapper">
|
||||
<!-- Preview -->
|
||||
<iframe class="fme-preview" :srcdoc="previewContent" x-show="showPreview" wire:ignore></iframe>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
0
storage/framework/testing/.gitignore
vendored
Normal file → Executable file
0
storage/framework/testing/.gitignore
vendored
Normal file → Executable file
@ -13,7 +13,7 @@ class DispatchWebhooksTest extends TestCase
|
||||
{
|
||||
use LazilyRefreshDatabase;
|
||||
|
||||
public function setUp(): void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
Queue::fake();
|
||||
|
@ -17,7 +17,7 @@ class ProcessWebhooksTest extends TestCase
|
||||
{
|
||||
use LazilyRefreshDatabase;
|
||||
|
||||
public function setUp(): void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
Http::preventStrayRequests();
|
||||
|
@ -13,7 +13,7 @@ class EggControllerTest extends ApplicationApiIntegrationTestCase
|
||||
/**
|
||||
* Test that all the eggs can be returned.
|
||||
*/
|
||||
public function testListAllEggs(): void
|
||||
public function test_list_all_eggs(): void
|
||||
{
|
||||
$eggs = Egg::query()->get();
|
||||
|
||||
@ -57,7 +57,7 @@ class EggControllerTest extends ApplicationApiIntegrationTestCase
|
||||
/**
|
||||
* Test that a single egg can be returned.
|
||||
*/
|
||||
public function testReturnSingleEgg(): void
|
||||
public function test_return_single_egg(): void
|
||||
{
|
||||
$egg = Egg::query()->findOrFail(1);
|
||||
|
||||
@ -79,7 +79,7 @@ class EggControllerTest extends ApplicationApiIntegrationTestCase
|
||||
/**
|
||||
* Test that a single egg and all the defined relationships can be returned.
|
||||
*/
|
||||
public function testReturnSingleEggWithRelationships(): void
|
||||
public function test_return_single_egg_with_relationships(): void
|
||||
{
|
||||
$egg = Egg::query()->findOrFail(1);
|
||||
|
||||
@ -99,7 +99,7 @@ class EggControllerTest extends ApplicationApiIntegrationTestCase
|
||||
/**
|
||||
* Test that a missing egg returns a 404 error.
|
||||
*/
|
||||
public function testGetMissingEgg(): void
|
||||
public function test_get_missing_egg(): void
|
||||
{
|
||||
$response = $this->getJson('/api/application/eggs/nil');
|
||||
$this->assertNotFoundJson($response);
|
||||
@ -109,7 +109,7 @@ class EggControllerTest extends ApplicationApiIntegrationTestCase
|
||||
* Test that an authentication error occurs if a key does not have permission
|
||||
* to access a resource.
|
||||
*/
|
||||
public function testErrorReturnedIfNoPermission(): void
|
||||
public function test_error_returned_if_no_permission(): void
|
||||
{
|
||||
$egg = Egg::query()->findOrFail(1);
|
||||
$this->createNewDefaultApiKey($this->getApiUser(), [Egg::RESOURCE_NAME => AdminAcl::NONE]);
|
||||
|
@ -13,7 +13,7 @@ class ExternalUserControllerTest extends ApplicationApiIntegrationTestCase
|
||||
/**
|
||||
* Test that a user can be retrieved by their external ID.
|
||||
*/
|
||||
public function testGetRemoteUser(): void
|
||||
public function test_get_remote_user(): void
|
||||
{
|
||||
$user = User::factory()->create(['external_id' => Str::random()]);
|
||||
|
||||
@ -48,7 +48,7 @@ class ExternalUserControllerTest extends ApplicationApiIntegrationTestCase
|
||||
/**
|
||||
* Test that an invalid external ID returns a 404 error.
|
||||
*/
|
||||
public function testGetMissingUser(): void
|
||||
public function test_get_missing_user(): void
|
||||
{
|
||||
$response = $this->getJson('/api/application/users/external/nil');
|
||||
$this->assertNotFoundJson($response);
|
||||
@ -58,7 +58,7 @@ class ExternalUserControllerTest extends ApplicationApiIntegrationTestCase
|
||||
* Test that an authentication error occurs if a key does not have permission
|
||||
* to access a resource.
|
||||
*/
|
||||
public function testErrorReturnedIfNoPermission(): void
|
||||
public function test_error_returned_if_no_permission(): void
|
||||
{
|
||||
$user = User::factory()->create(['external_id' => Str::random()]);
|
||||
$this->createNewDefaultApiKey($this->getApiUser(), [User::RESOURCE_NAME => AdminAcl::NONE]);
|
||||
|
@ -16,7 +16,7 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase
|
||||
/**
|
||||
* Test the response when requesting all users on the panel.
|
||||
*/
|
||||
public function testGetUsers(): void
|
||||
public function test_get_users(): void
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
|
||||
@ -83,7 +83,7 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase
|
||||
/**
|
||||
* Test getting a single user.
|
||||
*/
|
||||
public function testGetSingleUser(): void
|
||||
public function test_get_single_user(): void
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
|
||||
@ -115,7 +115,7 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase
|
||||
/**
|
||||
* Test that the correct relationships can be loaded.
|
||||
*/
|
||||
public function testRelationshipsCanBeLoaded(): void
|
||||
public function test_relationships_can_be_loaded(): void
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
$server = $this->createServerModel(['user_id' => $user->id]);
|
||||
@ -146,7 +146,7 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase
|
||||
* Test that attempting to load a relationship that the key does not have permission
|
||||
* for returns a null object.
|
||||
*/
|
||||
public function testKeyWithoutPermissionCannotLoadRelationship(): void
|
||||
public function test_key_without_permission_cannot_load_relationship(): void
|
||||
{
|
||||
$this->createNewDefaultApiKey($this->getApiUser(), [Server::RESOURCE_NAME => AdminAcl::NONE]);
|
||||
|
||||
@ -180,7 +180,7 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase
|
||||
/**
|
||||
* Test that an invalid external ID returns a 404 error.
|
||||
*/
|
||||
public function testGetMissingUser(): void
|
||||
public function test_get_missing_user(): void
|
||||
{
|
||||
$response = $this->getJson('/api/application/users/nil');
|
||||
$this->assertNotFoundJson($response);
|
||||
@ -190,7 +190,7 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase
|
||||
* Test that an authentication error occurs if a key does not have permission
|
||||
* to access a resource.
|
||||
*/
|
||||
public function testErrorReturnedIfNoPermission(): void
|
||||
public function test_error_returned_if_no_permission(): void
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
$this->createNewDefaultApiKey($this->getApiUser(), [User::RESOURCE_NAME => AdminAcl::NONE]);
|
||||
@ -202,7 +202,7 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase
|
||||
/**
|
||||
* Test that a user can be created.
|
||||
*/
|
||||
public function testCreateUser(): void
|
||||
public function test_create_user(): void
|
||||
{
|
||||
$response = $this->postJson('/api/application/users', [
|
||||
'username' => 'testuser',
|
||||
@ -232,7 +232,7 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase
|
||||
/**
|
||||
* Test that a user can be updated.
|
||||
*/
|
||||
public function testUpdateUser(): void
|
||||
public function test_update_user(): void
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
|
||||
@ -259,7 +259,7 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase
|
||||
/**
|
||||
* Test that a user can be deleted from the database.
|
||||
*/
|
||||
public function testDeleteUser(): void
|
||||
public function test_delete_user(): void
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
$this->assertDatabaseHas('users', ['id' => $user->id]);
|
||||
@ -275,7 +275,7 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase
|
||||
* delete a user model.
|
||||
*/
|
||||
#[DataProvider('userWriteEndpointsDataProvider')]
|
||||
public function testApiKeyWithoutWritePermissions(string $method, string $url): void
|
||||
public function test_api_key_without_write_permissions(string $method, string $url): void
|
||||
{
|
||||
$this->createNewDefaultApiKey($this->getApiUser(), [User::RESOURCE_NAME => AdminAcl::READ]);
|
||||
|
||||
|
@ -12,7 +12,7 @@ class AccountControllerTest extends ClientApiIntegrationTestCase
|
||||
/**
|
||||
* Test that the user's account details are returned from the account endpoint.
|
||||
*/
|
||||
public function testAccountDetailsAreReturned(): void
|
||||
public function test_account_details_are_returned(): void
|
||||
{
|
||||
/** @var \App\Models\User $user */
|
||||
$user = User::factory()->create();
|
||||
@ -39,7 +39,7 @@ class AccountControllerTest extends ClientApiIntegrationTestCase
|
||||
/**
|
||||
* Test that the user's email address can be updated via the API.
|
||||
*/
|
||||
public function testEmailIsUpdated(): void
|
||||
public function test_email_is_updated(): void
|
||||
{
|
||||
/** @var \App\Models\User $user */
|
||||
$user = User::factory()->create();
|
||||
@ -58,7 +58,7 @@ class AccountControllerTest extends ClientApiIntegrationTestCase
|
||||
* Tests that an email is not updated if the password provided in the request is not
|
||||
* valid for the account.
|
||||
*/
|
||||
public function testEmailIsNotUpdatedWhenPasswordIsInvalid(): void
|
||||
public function test_email_is_not_updated_when_password_is_invalid(): void
|
||||
{
|
||||
/** @var \App\Models\User $user */
|
||||
$user = User::factory()->create();
|
||||
@ -77,7 +77,7 @@ class AccountControllerTest extends ClientApiIntegrationTestCase
|
||||
* Tests that an email is not updated if an invalid email address is passed through
|
||||
* in the request.
|
||||
*/
|
||||
public function testEmailIsNotUpdatedWhenNotValid(): void
|
||||
public function test_email_is_not_updated_when_not_valid(): void
|
||||
{
|
||||
/** @var \App\Models\User $user */
|
||||
$user = User::factory()->create();
|
||||
@ -104,7 +104,7 @@ class AccountControllerTest extends ClientApiIntegrationTestCase
|
||||
/**
|
||||
* Test that the password for an account can be successfully updated.
|
||||
*/
|
||||
public function testPasswordIsUpdated(): void
|
||||
public function test_password_is_updated(): void
|
||||
{
|
||||
/** @var \App\Models\User $user */
|
||||
$user = User::factory()->create();
|
||||
@ -130,7 +130,7 @@ class AccountControllerTest extends ClientApiIntegrationTestCase
|
||||
* Test that the password for an account is not updated if the current password is not
|
||||
* provided correctly.
|
||||
*/
|
||||
public function testPasswordIsNotUpdatedIfCurrentPasswordIsInvalid(): void
|
||||
public function test_password_is_not_updated_if_current_password_is_invalid(): void
|
||||
{
|
||||
/** @var \App\Models\User $user */
|
||||
$user = User::factory()->create();
|
||||
@ -150,7 +150,7 @@ class AccountControllerTest extends ClientApiIntegrationTestCase
|
||||
* Test that a validation error is returned to the user if no password is provided or if
|
||||
* the password is below the minimum password length.
|
||||
*/
|
||||
public function testErrorIsReturnedForInvalidRequestData(): void
|
||||
public function test_error_is_returned_for_invalid_request_data(): void
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
|
||||
@ -173,7 +173,7 @@ class AccountControllerTest extends ClientApiIntegrationTestCase
|
||||
* Test that a validation error is returned if the password passed in the request
|
||||
* does not have a confirmation, or the confirmation is not the same as the password.
|
||||
*/
|
||||
public function testErrorIsReturnedIfPasswordIsNotConfirmed(): void
|
||||
public function test_error_is_returned_if_password_is_not_confirmed(): void
|
||||
{
|
||||
/** @var \App\Models\User $user */
|
||||
$user = User::factory()->create();
|
||||
|
@ -24,7 +24,7 @@ class ApiKeyControllerTest extends ClientApiIntegrationTestCase
|
||||
/**
|
||||
* Test that the client's API key can be returned successfully.
|
||||
*/
|
||||
public function testApiKeysAreReturned(): void
|
||||
public function test_api_keys_are_returned(): void
|
||||
{
|
||||
/** @var \App\Models\User $user */
|
||||
$user = User::factory()->create();
|
||||
@ -47,7 +47,7 @@ class ApiKeyControllerTest extends ClientApiIntegrationTestCase
|
||||
* after that point.
|
||||
*/
|
||||
#[DataProvider('validIPAddressDataProvider')]
|
||||
public function testApiKeyCanBeCreatedForAccount(array $data): void
|
||||
public function test_api_key_can_be_created_for_account(array $data): void
|
||||
{
|
||||
/** @var \App\Models\User $user */
|
||||
$user = User::factory()->create();
|
||||
@ -79,7 +79,7 @@ class ApiKeyControllerTest extends ClientApiIntegrationTestCase
|
||||
/**
|
||||
* Block requests to create an API key specifying more than 50 IP addresses.
|
||||
*/
|
||||
public function testApiKeyCannotSpecifyMoreThanFiftyIps(): void
|
||||
public function test_api_key_cannot_specify_more_than_fifty_ips(): void
|
||||
{
|
||||
$ips = [];
|
||||
for ($i = 0; $i < 100; $i++) {
|
||||
@ -99,7 +99,7 @@ class ApiKeyControllerTest extends ClientApiIntegrationTestCase
|
||||
* Test that no more than the Max number of API keys can exist at one time for an account. This prevents
|
||||
* a DoS attack vector against the panel.
|
||||
*/
|
||||
public function testApiKeyLimitIsApplied(): void
|
||||
public function test_api_key_limit_is_applied(): void
|
||||
{
|
||||
/** @var \App\Models\User $user */
|
||||
$user = User::factory()->create();
|
||||
@ -119,7 +119,7 @@ class ApiKeyControllerTest extends ClientApiIntegrationTestCase
|
||||
/**
|
||||
* Test that a bad request results in a validation error being returned by the API.
|
||||
*/
|
||||
public function testValidationErrorIsReturnedForBadRequests(): void
|
||||
public function test_validation_error_is_returned_for_bad_requests(): void
|
||||
{
|
||||
$this->actingAs(User::factory()->create());
|
||||
|
||||
@ -153,7 +153,7 @@ class ApiKeyControllerTest extends ClientApiIntegrationTestCase
|
||||
/**
|
||||
* Tests that an API key can be deleted from the account.
|
||||
*/
|
||||
public function testApiKeyCanBeDeleted(): void
|
||||
public function test_api_key_can_be_deleted(): void
|
||||
{
|
||||
/** @var \App\Models\User $user */
|
||||
$user = User::factory()->create();
|
||||
@ -172,7 +172,7 @@ class ApiKeyControllerTest extends ClientApiIntegrationTestCase
|
||||
/**
|
||||
* Test that trying to delete an API key that does not exist results in a 404.
|
||||
*/
|
||||
public function testNonExistentApiKeyDeletionReturns404Error(): void
|
||||
public function test_non_existent_api_key_deletion_returns404_error(): void
|
||||
{
|
||||
/** @var \App\Models\User $user */
|
||||
$user = User::factory()->create();
|
||||
@ -193,7 +193,7 @@ class ApiKeyControllerTest extends ClientApiIntegrationTestCase
|
||||
* Test that an API key that exists on the system cannot be deleted if the user
|
||||
* who created it is not the authenticated user.
|
||||
*/
|
||||
public function testApiKeyBelongingToAnotherUserCannotBeDeleted(): void
|
||||
public function test_api_key_belonging_to_another_user_cannot_be_deleted(): void
|
||||
{
|
||||
/** @var \App\Models\User $user */
|
||||
$user = User::factory()->create();
|
||||
@ -216,7 +216,7 @@ class ApiKeyControllerTest extends ClientApiIntegrationTestCase
|
||||
* Tests that an application API key also belonging to the logged-in user cannot be
|
||||
* deleted through this endpoint if it exists.
|
||||
*/
|
||||
public function testApplicationApiKeyCannotBeDeleted(): void
|
||||
public function test_application_api_key_cannot_be_deleted(): void
|
||||
{
|
||||
/** @var \App\Models\User $user */
|
||||
$user = User::factory()->create();
|
||||
|
@ -18,7 +18,7 @@ class ClientControllerTest extends ClientApiIntegrationTestCase
|
||||
* a subuser, but for this test we just want to test a basic scenario and pretend
|
||||
* subusers do not exist at all.
|
||||
*/
|
||||
public function testOnlyLoggedInUsersServersAreReturned(): void
|
||||
public function test_only_logged_in_users_servers_are_returned(): void
|
||||
{
|
||||
/** @var \App\Models\User[] $users */
|
||||
$users = User::factory()->times(3)->create();
|
||||
@ -45,7 +45,7 @@ class ClientControllerTest extends ClientApiIntegrationTestCase
|
||||
* Test that using ?filter[*]=name|uuid returns any server matching that name or UUID
|
||||
* with the search filters.
|
||||
*/
|
||||
public function testServersAreFilteredUsingNameAndUuidInformation(): void
|
||||
public function test_servers_are_filtered_using_name_and_uuid_information(): void
|
||||
{
|
||||
/** @var \App\Models\User[] $users */
|
||||
$users = User::factory()->times(2)->create();
|
||||
@ -101,7 +101,7 @@ class ClientControllerTest extends ClientApiIntegrationTestCase
|
||||
* Test that using ?filter[*]=:25565 or ?filter[*]=192.168.1.1:25565 returns only those servers
|
||||
* with the same allocation for the given user.
|
||||
*/
|
||||
public function testServersAreFilteredUsingAllocationInformation(): void
|
||||
public function test_servers_are_filtered_using_allocation_information(): void
|
||||
{
|
||||
/** @var \App\Models\User $user */
|
||||
/** @var \App\Models\Server $server */
|
||||
@ -143,7 +143,7 @@ class ClientControllerTest extends ClientApiIntegrationTestCase
|
||||
/**
|
||||
* Test that servers where the user is a subuser are returned by default in the API call.
|
||||
*/
|
||||
public function testServersUserIsASubuserOfAreReturned(): void
|
||||
public function test_servers_user_is_a_subuser_of_are_returned(): void
|
||||
{
|
||||
/** @var \App\Models\User[] $users */
|
||||
$users = User::factory()->times(3)->create();
|
||||
@ -174,7 +174,7 @@ class ClientControllerTest extends ClientApiIntegrationTestCase
|
||||
/**
|
||||
* Returns only servers that the user owns, not servers they are a subuser of.
|
||||
*/
|
||||
public function testFilterOnlyOwnerServers(): void
|
||||
public function test_filter_only_owner_servers(): void
|
||||
{
|
||||
/** @var \App\Models\User[] $users */
|
||||
$users = User::factory()->times(3)->create();
|
||||
@ -203,7 +203,7 @@ class ClientControllerTest extends ClientApiIntegrationTestCase
|
||||
/**
|
||||
* Tests that the permissions from the Panel are returned correctly.
|
||||
*/
|
||||
public function testPermissionsAreReturned(): void
|
||||
public function test_permissions_are_returned(): void
|
||||
{
|
||||
/** @var \App\Models\User $user */
|
||||
$user = User::factory()->create();
|
||||
@ -223,7 +223,7 @@ class ClientControllerTest extends ClientApiIntegrationTestCase
|
||||
* Test that only servers a user can access because they are an administrator are returned. This
|
||||
* will always exclude any servers they can see because they're the owner or a subuser of the server.
|
||||
*/
|
||||
public function testOnlyAdminLevelServersAreReturned(): void
|
||||
public function test_only_admin_level_servers_are_returned(): void
|
||||
{
|
||||
/** @var \App\Models\User[] $users */
|
||||
$users = User::factory()->times(4)->create();
|
||||
@ -258,7 +258,7 @@ class ClientControllerTest extends ClientApiIntegrationTestCase
|
||||
/**
|
||||
* Test that all servers a user can access as an admin are returned if using ?filter=admin-all.
|
||||
*/
|
||||
public function testAllServersAreReturnedToAdmin(): void
|
||||
public function test_all_servers_are_returned_to_admin(): void
|
||||
{
|
||||
/** @var \App\Models\User[] $users */
|
||||
$users = User::factory()->times(4)->create();
|
||||
@ -289,7 +289,7 @@ class ClientControllerTest extends ClientApiIntegrationTestCase
|
||||
* ?type=admin or ?type=admin-all in the request.
|
||||
*/
|
||||
#[DataProvider('filterTypeDataProvider')]
|
||||
public function testNoServersAreReturnedIfAdminFilterIsPassedByRegularUser(string $type): void
|
||||
public function test_no_servers_are_returned_if_admin_filter_is_passed_by_regular_user(string $type): void
|
||||
{
|
||||
/** @var \App\Models\User[] $users */
|
||||
$users = User::factory()->times(3)->create();
|
||||
@ -308,7 +308,7 @@ class ClientControllerTest extends ClientApiIntegrationTestCase
|
||||
* Test that a subuser without the allocation.read permission is only able to see the primary
|
||||
* allocation for the server.
|
||||
*/
|
||||
public function testOnlyPrimaryAllocationIsReturnedToSubuser(): void
|
||||
public function test_only_primary_allocation_is_returned_to_subuser(): void
|
||||
{
|
||||
/** @var \App\Models\Server $server */
|
||||
[$user, $server] = $this->generateTestAccount([Permission::ACTION_WEBSOCKET_CONNECT]);
|
||||
|
@ -11,7 +11,7 @@ class SSHKeyControllerTest extends ClientApiIntegrationTestCase
|
||||
/**
|
||||
* Test that only the SSH keys for the authenticated user are returned.
|
||||
*/
|
||||
public function testSSHKeysAreReturned(): void
|
||||
public function test_ssh_keys_are_returned(): void
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
$user2 = User::factory()->create();
|
||||
@ -32,7 +32,7 @@ class SSHKeyControllerTest extends ClientApiIntegrationTestCase
|
||||
* Test that a user's SSH key can be deleted, and that passing the fingerprint
|
||||
* of another user's SSH key won't delete that key.
|
||||
*/
|
||||
public function testSSHKeyCanBeDeleted(): void
|
||||
public function test_ssh_key_can_be_deleted(): void
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
$user2 = User::factory()->create();
|
||||
@ -58,7 +58,7 @@ class SSHKeyControllerTest extends ClientApiIntegrationTestCase
|
||||
$this->assertNotSoftDeleted($key2);
|
||||
}
|
||||
|
||||
public function testDSAKeyIsRejected(): void
|
||||
public function test_dsa_key_is_rejected(): void
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
$key = UserSSHKey::factory()->dsa()->make();
|
||||
@ -73,7 +73,7 @@ class SSHKeyControllerTest extends ClientApiIntegrationTestCase
|
||||
$this->assertEquals(0, $user->sshKeys()->count());
|
||||
}
|
||||
|
||||
public function testWeakRSAKeyIsRejected(): void
|
||||
public function test_weak_rsa_key_is_rejected(): void
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
$key = UserSSHKey::factory()->rsa(true)->make();
|
||||
@ -88,7 +88,7 @@ class SSHKeyControllerTest extends ClientApiIntegrationTestCase
|
||||
$this->assertEquals(0, $user->sshKeys()->count());
|
||||
}
|
||||
|
||||
public function testInvalidOrPrivateKeyIsRejected(): void
|
||||
public function test_invalid_or_private_key_is_rejected(): void
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
|
||||
@ -110,7 +110,7 @@ class SSHKeyControllerTest extends ClientApiIntegrationTestCase
|
||||
->assertJsonPath('errors.0.detail', 'The public key provided is not valid.');
|
||||
}
|
||||
|
||||
public function testPublicKeyCanBeStored(): void
|
||||
public function test_public_key_can_be_stored(): void
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
$key = UserSSHKey::factory()->make();
|
||||
@ -127,7 +127,7 @@ class SSHKeyControllerTest extends ClientApiIntegrationTestCase
|
||||
$this->assertEquals($key->public_key, $user->sshKeys[0]->public_key);
|
||||
}
|
||||
|
||||
public function testPublicKeyThatAlreadyExistsCannotBeAddedASecondTime(): void
|
||||
public function test_public_key_that_already_exists_cannot_be_added_a_second_time(): void
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
$key = UserSSHKey::factory()->for($user)->create();
|
||||
|
@ -10,7 +10,7 @@ use PHPUnit\Framework\Attributes\DataProvider;
|
||||
class AllocationAuthorizationTest extends ClientApiIntegrationTestCase
|
||||
{
|
||||
#[DataProvider('methodDataProvider')]
|
||||
public function testAccessToAServersAllocationsIsRestrictedProperly(string $method, string $endpoint): void
|
||||
public function test_access_to_a_servers_allocations_is_restricted_properly(string $method, string $endpoint): void
|
||||
{
|
||||
// The API $user is the owner of $server1.
|
||||
[$user, $server1] = $this->generateTestAccount();
|
||||
|
@ -26,7 +26,7 @@ class CreateNewAllocationTest extends ClientApiIntegrationTestCase
|
||||
* Tests that a new allocation can be properly assigned to a server.
|
||||
*/
|
||||
#[DataProvider('permissionDataProvider')]
|
||||
public function testNewAllocationCanBeAssignedToServer(array $permission): void
|
||||
public function test_new_allocation_can_be_assigned_to_server(array $permission): void
|
||||
{
|
||||
/** @var \App\Models\Server $server */
|
||||
[$user, $server] = $this->generateTestAccount($permission);
|
||||
@ -45,7 +45,7 @@ class CreateNewAllocationTest extends ClientApiIntegrationTestCase
|
||||
* Test that a user without the required permissions cannot create an allocation for
|
||||
* the server instance.
|
||||
*/
|
||||
public function testAllocationCannotBeCreatedIfUserDoesNotHavePermission(): void
|
||||
public function test_allocation_cannot_be_created_if_user_does_not_have_permission(): void
|
||||
{
|
||||
/** @var \App\Models\Server $server */
|
||||
[$user, $server] = $this->generateTestAccount([Permission::ACTION_ALLOCATION_UPDATE]);
|
||||
@ -57,7 +57,7 @@ class CreateNewAllocationTest extends ClientApiIntegrationTestCase
|
||||
/**
|
||||
* Test that an error is returned to the user if this feature is not enabled on the system.
|
||||
*/
|
||||
public function testAllocationCannotBeCreatedIfNotEnabled(): void
|
||||
public function test_allocation_cannot_be_created_if_not_enabled(): void
|
||||
{
|
||||
config()->set('panel.client_features.allocations.enabled', false);
|
||||
|
||||
@ -74,7 +74,7 @@ class CreateNewAllocationTest extends ClientApiIntegrationTestCase
|
||||
/**
|
||||
* Test that an allocation cannot be created if the server has reached its allocation limit.
|
||||
*/
|
||||
public function testAllocationCannotBeCreatedIfServerIsAtLimit(): void
|
||||
public function test_allocation_cannot_be_created_if_server_is_at_limit(): void
|
||||
{
|
||||
/** @var \App\Models\Server $server */
|
||||
[$user, $server] = $this->generateTestAccount();
|
||||
|
@ -15,7 +15,7 @@ class DeleteAllocationTest extends ClientApiIntegrationTestCase
|
||||
* to an empty value on assignment.
|
||||
*/
|
||||
#[DataProvider('permissionDataProvider')]
|
||||
public function testAllocationCanBeDeletedFromServer(array $permission): void
|
||||
public function test_allocation_can_be_deleted_from_server(array $permission): void
|
||||
{
|
||||
/** @var \App\Models\Server $server */
|
||||
[$user, $server] = $this->generateTestAccount($permission);
|
||||
@ -36,7 +36,7 @@ class DeleteAllocationTest extends ClientApiIntegrationTestCase
|
||||
/**
|
||||
* Test that an error is returned if the user does not have permissiont to delete an allocation.
|
||||
*/
|
||||
public function testErrorIsReturnedIfUserDoesNotHavePermission(): void
|
||||
public function test_error_is_returned_if_user_does_not_have_permission(): void
|
||||
{
|
||||
/** @var \App\Models\Server $server */
|
||||
[$user, $server] = $this->generateTestAccount([Permission::ACTION_ALLOCATION_CREATE]);
|
||||
@ -57,7 +57,7 @@ class DeleteAllocationTest extends ClientApiIntegrationTestCase
|
||||
* Test that an allocation is not deleted if it is currently marked as the primary allocation
|
||||
* for the server.
|
||||
*/
|
||||
public function testErrorIsReturnedIfAllocationIsPrimary(): void
|
||||
public function test_error_is_returned_if_allocation_is_primary(): void
|
||||
{
|
||||
/** @var \App\Models\Server $server */
|
||||
[$user, $server] = $this->generateTestAccount();
|
||||
@ -69,7 +69,7 @@ class DeleteAllocationTest extends ClientApiIntegrationTestCase
|
||||
->assertJsonPath('errors.0.detail', 'You cannot delete the primary allocation for this server.');
|
||||
}
|
||||
|
||||
public function testAllocationCannotBeDeletedIfServerLimitIsNotDefined(): void
|
||||
public function test_allocation_cannot_be_deleted_if_server_limit_is_not_defined(): void
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount();
|
||||
|
||||
@ -88,7 +88,7 @@ class DeleteAllocationTest extends ClientApiIntegrationTestCase
|
||||
/**
|
||||
* Test that an allocation cannot be deleted if it does not belong to the server instance.
|
||||
*/
|
||||
public function testErrorIsReturnedIfAllocationDoesNotBelongToServer(): void
|
||||
public function test_error_is_returned_if_allocation_does_not_belong_to_server(): void
|
||||
{
|
||||
/** @var \App\Models\Server $server */
|
||||
[$user, $server] = $this->generateTestAccount();
|
||||
|
@ -12,7 +12,7 @@ use PHPUnit\Framework\Attributes\DataProvider;
|
||||
class BackupAuthorizationTest extends ClientApiIntegrationTestCase
|
||||
{
|
||||
#[DataProvider('methodDataProvider')]
|
||||
public function testAccessToAServersBackupIsRestrictedProperly(string $method, string $endpoint): void
|
||||
public function test_access_to_a_servers_backup_is_restricted_properly(string $method, string $endpoint): void
|
||||
{
|
||||
// The API $user is the owner of $server1.
|
||||
[$user, $server1] = $this->generateTestAccount();
|
||||
|
@ -22,7 +22,7 @@ class DeleteBackupTest extends ClientApiIntegrationTestCase
|
||||
$this->repository = $this->mock(DaemonBackupRepository::class);
|
||||
}
|
||||
|
||||
public function testUserWithoutPermissionCannotDeleteBackup(): void
|
||||
public function test_user_without_permission_cannot_delete_backup(): void
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount([Permission::ACTION_BACKUP_CREATE]);
|
||||
|
||||
@ -37,7 +37,7 @@ class DeleteBackupTest extends ClientApiIntegrationTestCase
|
||||
* in the database. Once deleted there should also be a corresponding record in the
|
||||
* activity logs table for this API call.
|
||||
*/
|
||||
public function testBackupCanBeDeleted(): void
|
||||
public function test_backup_can_be_deleted(): void
|
||||
{
|
||||
Event::fake([ActivityLogged::class]);
|
||||
|
||||
|
@ -20,7 +20,7 @@ class CommandControllerTest extends ClientApiIntegrationTestCase
|
||||
* Test that a validation error is returned if there is no command present in the
|
||||
* request.
|
||||
*/
|
||||
public function testValidationErrorIsReturnedIfNoCommandIsPresent(): void
|
||||
public function test_validation_error_is_returned_if_no_command_is_present(): void
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount();
|
||||
|
||||
@ -36,7 +36,7 @@ class CommandControllerTest extends ClientApiIntegrationTestCase
|
||||
* Test that a subuser without the required permission receives an error when trying to
|
||||
* execute the command.
|
||||
*/
|
||||
public function testSubuserWithoutPermissionReceivesError(): void
|
||||
public function test_subuser_without_permission_receives_error(): void
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount([Permission::ACTION_WEBSOCKET_CONNECT]);
|
||||
|
||||
@ -50,7 +50,7 @@ class CommandControllerTest extends ClientApiIntegrationTestCase
|
||||
/**
|
||||
* Test that a command can be sent to the server.
|
||||
*/
|
||||
public function testCommandCanSendToServer(): void
|
||||
public function test_command_can_send_to_server(): void
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount([Permission::ACTION_CONTROL_CONSOLE]);
|
||||
|
||||
@ -72,7 +72,7 @@ class CommandControllerTest extends ClientApiIntegrationTestCase
|
||||
* Test that an error is returned when the server is offline that is more specific than the
|
||||
* regular daemon connection error.
|
||||
*/
|
||||
public function testErrorIsReturnedWhenServerIsOffline(): void
|
||||
public function test_error_is_returned_when_server_is_offline(): void
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount();
|
||||
|
||||
|
@ -13,7 +13,7 @@ use PHPUnit\Framework\Attributes\DataProvider;
|
||||
class DatabaseAuthorizationTest extends ClientApiIntegrationTestCase
|
||||
{
|
||||
#[DataProvider('methodDataProvider')]
|
||||
public function testAccessToAServersDatabasesIsRestrictedProperly(string $method, string $endpoint): void
|
||||
public function test_access_to_a_servers_databases_is_restricted_properly(string $method, string $endpoint): void
|
||||
{
|
||||
// The API $user is the owner of $server1.
|
||||
[$user, $server1] = $this->generateTestAccount();
|
||||
|
@ -14,7 +14,7 @@ class NetworkAllocationControllerTest extends ClientApiIntegrationTestCase
|
||||
/**
|
||||
* Test that a servers allocations are returned in the expected format.
|
||||
*/
|
||||
public function testServerAllocationsAreReturned(): void
|
||||
public function test_server_allocations_are_returned(): void
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount();
|
||||
|
||||
@ -30,7 +30,7 @@ class NetworkAllocationControllerTest extends ClientApiIntegrationTestCase
|
||||
/**
|
||||
* Test that allocations cannot be returned without the required user permissions.
|
||||
*/
|
||||
public function testServerAllocationsAreNotReturnedWithoutPermission(): void
|
||||
public function test_server_allocations_are_not_returned_without_permission(): void
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount();
|
||||
$user2 = User::factory()->create();
|
||||
@ -51,7 +51,7 @@ class NetworkAllocationControllerTest extends ClientApiIntegrationTestCase
|
||||
* Tests that notes on an allocation can be set correctly.
|
||||
*/
|
||||
#[DataProvider('updatePermissionsDataProvider')]
|
||||
public function testAllocationNotesCanBeUpdated(array $permissions): void
|
||||
public function test_allocation_notes_can_be_updated(array $permissions): void
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount($permissions);
|
||||
$allocation = $server->allocation;
|
||||
@ -81,7 +81,7 @@ class NetworkAllocationControllerTest extends ClientApiIntegrationTestCase
|
||||
$this->assertNull($allocation->notes);
|
||||
}
|
||||
|
||||
public function testAllocationNotesCannotBeUpdatedByInvalidUsers(): void
|
||||
public function test_allocation_notes_cannot_be_updated_by_invalid_users(): void
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount();
|
||||
$user2 = User::factory()->create();
|
||||
@ -97,7 +97,7 @@ class NetworkAllocationControllerTest extends ClientApiIntegrationTestCase
|
||||
}
|
||||
|
||||
#[DataProvider('updatePermissionsDataProvider')]
|
||||
public function testPrimaryAllocationCanBeModified(array $permissions): void
|
||||
public function test_primary_allocation_can_be_modified(array $permissions): void
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount($permissions);
|
||||
$allocation = $server->allocation;
|
||||
@ -114,7 +114,7 @@ class NetworkAllocationControllerTest extends ClientApiIntegrationTestCase
|
||||
$this->assertSame($allocation2->id, $server->allocation_id);
|
||||
}
|
||||
|
||||
public function testPrimaryAllocationCannotBeModifiedByInvalidUser(): void
|
||||
public function test_primary_allocation_cannot_be_modified_by_invalid_user(): void
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount();
|
||||
$user2 = User::factory()->create();
|
||||
|
@ -18,7 +18,7 @@ class PowerControllerTest extends ClientApiIntegrationTestCase
|
||||
* @param string[] $permissions
|
||||
*/
|
||||
#[DataProvider('invalidPermissionDataProvider')]
|
||||
public function testSubuserWithoutPermissionsReceivesError(string $action, array $permissions): void
|
||||
public function test_subuser_without_permissions_receives_error(string $action, array $permissions): void
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount($permissions);
|
||||
|
||||
@ -30,7 +30,7 @@ class PowerControllerTest extends ClientApiIntegrationTestCase
|
||||
/**
|
||||
* Test that sending an invalid power signal returns an error.
|
||||
*/
|
||||
public function testInvalidPowerSignalResultsInError(): void
|
||||
public function test_invalid_power_signal_results_in_error(): void
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount();
|
||||
|
||||
@ -47,7 +47,7 @@ class PowerControllerTest extends ClientApiIntegrationTestCase
|
||||
* Test that sending a valid power actions works.
|
||||
*/
|
||||
#[DataProvider('validPowerActionDataProvider')]
|
||||
public function testActionCanBeSentToServer(string $action, string $permission): void
|
||||
public function test_action_can_be_sent_to_server(string $action, string $permission): void
|
||||
{
|
||||
$service = \Mockery::mock(DaemonPowerRepository::class);
|
||||
$this->app->instance(DaemonPowerRepository::class, $service);
|
||||
|
@ -11,7 +11,7 @@ class ResourceUtilizationControllerTest extends ClientApiIntegrationTestCase
|
||||
/**
|
||||
* Test that the resource utilization for a server is returned in the expected format.
|
||||
*/
|
||||
public function testServerResourceUtilizationIsReturned(): void
|
||||
public function test_server_resource_utilization_is_returned(): void
|
||||
{
|
||||
$service = \Mockery::mock(DaemonServerRepository::class);
|
||||
$this->app->instance(DaemonServerRepository::class, $service);
|
||||
|
@ -14,7 +14,7 @@ class CreateServerScheduleTest extends ClientApiIntegrationTestCase
|
||||
* Test that a schedule can be created for the server.
|
||||
*/
|
||||
#[DataProvider('permissionsDataProvider')]
|
||||
public function testScheduleCanBeCreatedForServer(array $permissions): void
|
||||
public function test_schedule_can_be_created_for_server(array $permissions): void
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount($permissions);
|
||||
|
||||
@ -50,7 +50,7 @@ class CreateServerScheduleTest extends ClientApiIntegrationTestCase
|
||||
/**
|
||||
* Test that the validation rules for scheduling work as expected.
|
||||
*/
|
||||
public function testScheduleValidationRules(): void
|
||||
public function test_schedule_validation_rules(): void
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount();
|
||||
|
||||
@ -81,7 +81,7 @@ class CreateServerScheduleTest extends ClientApiIntegrationTestCase
|
||||
/**
|
||||
* Test that a subuser without required permissions cannot create a schedule.
|
||||
*/
|
||||
public function testSubuserCannotCreateScheduleWithoutPermissions(): void
|
||||
public function test_subuser_cannot_create_schedule_without_permissions(): void
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount([Permission::ACTION_SCHEDULE_UPDATE]);
|
||||
|
||||
|
@ -15,7 +15,7 @@ class DeleteServerScheduleTest extends ClientApiIntegrationTestCase
|
||||
* Test that a schedule can be deleted from the system.
|
||||
*/
|
||||
#[DataProvider('permissionsDataProvider')]
|
||||
public function testScheduleCanBeDeleted(array $permissions): void
|
||||
public function test_schedule_can_be_deleted(array $permissions): void
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount($permissions);
|
||||
|
||||
@ -33,7 +33,7 @@ class DeleteServerScheduleTest extends ClientApiIntegrationTestCase
|
||||
/**
|
||||
* Test that no error is returned if the schedule does not exist on the system at all.
|
||||
*/
|
||||
public function testNotFoundErrorIsReturnedIfScheduleDoesNotExistAtAll(): void
|
||||
public function test_not_found_error_is_returned_if_schedule_does_not_exist_at_all(): void
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount();
|
||||
|
||||
@ -46,7 +46,7 @@ class DeleteServerScheduleTest extends ClientApiIntegrationTestCase
|
||||
* Ensure that a schedule belonging to another server cannot be deleted and its presence is not
|
||||
* revealed to the user.
|
||||
*/
|
||||
public function testNotFoundErrorIsReturnedIfScheduleDoesNotBelongToServer(): void
|
||||
public function test_not_found_error_is_returned_if_schedule_does_not_belong_to_server(): void
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount();
|
||||
$server2 = $this->createServerModel(['owner_id' => $user->id]);
|
||||
@ -64,7 +64,7 @@ class DeleteServerScheduleTest extends ClientApiIntegrationTestCase
|
||||
* Test that an error is returned if the subuser does not have the required permissions to
|
||||
* delete the schedule from the server.
|
||||
*/
|
||||
public function testErrorIsReturnedIfSubuserDoesNotHaveRequiredPermissions(): void
|
||||
public function test_error_is_returned_if_subuser_does_not_have_required_permissions(): void
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount([Permission::ACTION_SCHEDULE_UPDATE]);
|
||||
|
||||
|
@ -17,7 +17,7 @@ class ExecuteScheduleTest extends ClientApiIntegrationTestCase
|
||||
* Test that a schedule can be executed and is updated in the database correctly.
|
||||
*/
|
||||
#[DataProvider('permissionsDataProvider')]
|
||||
public function testScheduleIsExecutedRightAway(array $permissions): void
|
||||
public function test_schedule_is_executed_right_away(array $permissions): void
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount($permissions);
|
||||
|
||||
@ -54,7 +54,7 @@ class ExecuteScheduleTest extends ClientApiIntegrationTestCase
|
||||
/**
|
||||
* Test that a user without the schedule update permission cannot execute it.
|
||||
*/
|
||||
public function testUserWithoutScheduleUpdatePermissionCannotExecute(): void
|
||||
public function test_user_without_schedule_update_permission_cannot_execute(): void
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount([Permission::ACTION_SCHEDULE_CREATE]);
|
||||
|
||||
|
@ -25,7 +25,7 @@ class GetServerSchedulesTest extends ClientApiIntegrationTestCase
|
||||
* Test that schedules for a server are returned.
|
||||
*/
|
||||
#[DataProvider('permissionsDataProvider')]
|
||||
public function testServerSchedulesAreReturned(array $permissions, bool $individual): void
|
||||
public function test_server_schedules_are_returned(array $permissions, bool $individual): void
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount($permissions);
|
||||
|
||||
@ -59,7 +59,7 @@ class GetServerSchedulesTest extends ClientApiIntegrationTestCase
|
||||
/**
|
||||
* Test that a schedule belonging to another server cannot be viewed.
|
||||
*/
|
||||
public function testScheduleBelongingToAnotherServerCannotBeViewed(): void
|
||||
public function test_schedule_belonging_to_another_server_cannot_be_viewed(): void
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount();
|
||||
$server2 = $this->createServerModel(['owner_id' => $user->id]);
|
||||
@ -74,7 +74,7 @@ class GetServerSchedulesTest extends ClientApiIntegrationTestCase
|
||||
/**
|
||||
* Test that a subuser without the required permissions is unable to access the schedules endpoint.
|
||||
*/
|
||||
public function testUserWithoutPermissionCannotViewSchedules(): void
|
||||
public function test_user_without_permission_cannot_view_schedules(): void
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount([Permission::ACTION_WEBSOCKET_CONNECT]);
|
||||
|
||||
|
@ -19,7 +19,7 @@ class ScheduleAuthorizationTest extends ClientApiIntegrationTestCase
|
||||
* being tested and protected against.
|
||||
*/
|
||||
#[DataProvider('methodDataProvider')]
|
||||
public function testAccessToAServersSchedulesIsRestrictedProperly(string $method, string $endpoint): void
|
||||
public function test_access_to_a_servers_schedules_is_restricted_properly(string $method, string $endpoint): void
|
||||
{
|
||||
// The API $user is the owner of $server1.
|
||||
[$user, $server1] = $this->generateTestAccount();
|
||||
|
@ -27,7 +27,7 @@ class UpdateServerScheduleTest extends ClientApiIntegrationTestCase
|
||||
* Test that a schedule can be updated.
|
||||
*/
|
||||
#[DataProvider('permissionsDataProvider')]
|
||||
public function testScheduleCanBeUpdated(array $permissions): void
|
||||
public function test_schedule_can_be_updated(array $permissions): void
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount($permissions);
|
||||
|
||||
@ -52,7 +52,7 @@ class UpdateServerScheduleTest extends ClientApiIntegrationTestCase
|
||||
* Test that an error is returned if the schedule exists but does not belong to this
|
||||
* specific server instance.
|
||||
*/
|
||||
public function testErrorIsReturnedIfScheduleDoesNotBelongToServer(): void
|
||||
public function test_error_is_returned_if_schedule_does_not_belong_to_server(): void
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount();
|
||||
$server2 = $this->createServerModel(['owner_id' => $user->id]);
|
||||
@ -68,7 +68,7 @@ class UpdateServerScheduleTest extends ClientApiIntegrationTestCase
|
||||
* Test that an error is returned if the subuser does not have permission to modify a
|
||||
* server schedule.
|
||||
*/
|
||||
public function testErrorIsReturnedIfSubuserDoesNotHavePermissionToModifySchedule(): void
|
||||
public function test_error_is_returned_if_subuser_does_not_have_permission_to_modify_schedule(): void
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount([Permission::ACTION_SCHEDULE_CREATE]);
|
||||
|
||||
@ -83,7 +83,7 @@ class UpdateServerScheduleTest extends ClientApiIntegrationTestCase
|
||||
* Test that the "is_processing" field gets reset to false when the schedule is enabled
|
||||
* or disabled so that an invalid state can be more easily fixed.
|
||||
*/
|
||||
public function testScheduleIsProcessingIsSetToFalseWhenActiveStateChanges(): void
|
||||
public function test_schedule_is_processing_is_set_to_false_when_active_state_changes(): void
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount();
|
||||
|
||||
|
@ -15,7 +15,7 @@ class CreateServerScheduleTaskTest extends ClientApiIntegrationTestCase
|
||||
* Test that a task can be created.
|
||||
*/
|
||||
#[DataProvider('permissionsDataProvider')]
|
||||
public function testTaskCanBeCreated(array $permissions): void
|
||||
public function test_task_can_be_created(array $permissions): void
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount($permissions);
|
||||
|
||||
@ -45,7 +45,7 @@ class CreateServerScheduleTaskTest extends ClientApiIntegrationTestCase
|
||||
/**
|
||||
* Test that validation errors are returned correctly if bad data is passed into the API.
|
||||
*/
|
||||
public function testValidationErrorsAreReturned(): void
|
||||
public function test_validation_errors_are_returned(): void
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount();
|
||||
|
||||
@ -90,7 +90,7 @@ class CreateServerScheduleTaskTest extends ClientApiIntegrationTestCase
|
||||
/**
|
||||
* Test that backups can not be tasked when the backup limit is 0.
|
||||
*/
|
||||
public function testBackupsCanNotBeTaskedIfLimit0(): void
|
||||
public function test_backups_can_not_be_tasked_if_limit0(): void
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount();
|
||||
|
||||
@ -117,7 +117,7 @@ class CreateServerScheduleTaskTest extends ClientApiIntegrationTestCase
|
||||
* Test that an error is returned if the user attempts to create an additional task that
|
||||
* would put the schedule over the task limit.
|
||||
*/
|
||||
public function testErrorIsReturnedIfTooManyTasksExistForSchedule(): void
|
||||
public function test_error_is_returned_if_too_many_tasks_exist_for_schedule(): void
|
||||
{
|
||||
config()->set('panel.client_features.schedules.per_schedule_task_limit', 2);
|
||||
|
||||
@ -141,7 +141,7 @@ class CreateServerScheduleTaskTest extends ClientApiIntegrationTestCase
|
||||
* Test that an error is returned if the targeted schedule does not belong to the server
|
||||
* in the request.
|
||||
*/
|
||||
public function testErrorIsReturnedIfScheduleDoesNotBelongToServer(): void
|
||||
public function test_error_is_returned_if_schedule_does_not_belong_to_server(): void
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount();
|
||||
$server2 = $this->createServerModel(['owner_id' => $user->id]);
|
||||
@ -158,7 +158,7 @@ class CreateServerScheduleTaskTest extends ClientApiIntegrationTestCase
|
||||
* Test that an error is returned if the subuser making the request does not have permission
|
||||
* to update a schedule.
|
||||
*/
|
||||
public function testErrorIsReturnedIfSubuserDoesNotHaveScheduleUpdatePermissions(): void
|
||||
public function test_error_is_returned_if_subuser_does_not_have_schedule_update_permissions(): void
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount([Permission::ACTION_SCHEDULE_CREATE]);
|
||||
|
||||
|
@ -14,7 +14,7 @@ class DeleteScheduleTaskTest extends ClientApiIntegrationTestCase
|
||||
/**
|
||||
* Test that an error is returned if the schedule does not belong to the server.
|
||||
*/
|
||||
public function testScheduleNotBelongingToServerReturnsError(): void
|
||||
public function test_schedule_not_belonging_to_server_returns_error(): void
|
||||
{
|
||||
$server2 = $this->createServerModel();
|
||||
[$user] = $this->generateTestAccount();
|
||||
@ -29,7 +29,7 @@ class DeleteScheduleTaskTest extends ClientApiIntegrationTestCase
|
||||
* Test that an error is returned if the task and schedule in the URL do not line up
|
||||
* with each other.
|
||||
*/
|
||||
public function testTaskBelongingToDifferentScheduleReturnsError(): void
|
||||
public function test_task_belonging_to_different_schedule_returns_error(): void
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount();
|
||||
|
||||
@ -43,7 +43,7 @@ class DeleteScheduleTaskTest extends ClientApiIntegrationTestCase
|
||||
/**
|
||||
* Test that a user without the required permissions returns an error.
|
||||
*/
|
||||
public function testUserWithoutPermissionReturnsError(): void
|
||||
public function test_user_without_permission_returns_error(): void
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount([Permission::ACTION_SCHEDULE_CREATE]);
|
||||
|
||||
@ -61,7 +61,7 @@ class DeleteScheduleTaskTest extends ClientApiIntegrationTestCase
|
||||
* Test that a schedule task is deleted and items with a higher sequence ID are decremented
|
||||
* properly in the database.
|
||||
*/
|
||||
public function testScheduleTaskIsDeletedAndSubsequentTasksAreUpdated(): void
|
||||
public function test_schedule_task_is_deleted_and_subsequent_tasks_are_updated(): void
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount();
|
||||
|
||||
|
@ -16,7 +16,7 @@ class SettingsControllerTest extends ClientApiIntegrationTestCase
|
||||
* Test that the server's name can be changed.
|
||||
*/
|
||||
#[DataProvider('renamePermissionsDataProvider')]
|
||||
public function testServerNameCanBeChanged(array $permissions): void
|
||||
public function test_server_name_can_be_changed(array $permissions): void
|
||||
{
|
||||
/** @var \App\Models\Server $server */
|
||||
[$user, $server] = $this->generateTestAccount($permissions);
|
||||
@ -51,7 +51,7 @@ class SettingsControllerTest extends ClientApiIntegrationTestCase
|
||||
* Test that a subuser receives a permissions error if they do not have the required permission
|
||||
* and attempt to change the name.
|
||||
*/
|
||||
public function testSubuserCannotChangeServerNameWithoutPermission(): void
|
||||
public function test_subuser_cannot_change_server_name_without_permission(): void
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount([Permission::ACTION_WEBSOCKET_CONNECT]);
|
||||
$originalName = $server->name;
|
||||
@ -71,7 +71,7 @@ class SettingsControllerTest extends ClientApiIntegrationTestCase
|
||||
* than make sure the endpoint works since.
|
||||
*/
|
||||
#[DataProvider('reinstallPermissionsDataProvider')]
|
||||
public function testServerCanBeReinstalled(array $permissions): void
|
||||
public function test_server_can_be_reinstalled(array $permissions): void
|
||||
{
|
||||
/** @var \App\Models\Server $server */
|
||||
[$user, $server] = $this->generateTestAccount($permissions);
|
||||
@ -100,7 +100,7 @@ class SettingsControllerTest extends ClientApiIntegrationTestCase
|
||||
* Test that a subuser receives a permissions error if they do not have the required permission
|
||||
* and attempt to reinstall a server.
|
||||
*/
|
||||
public function testSubuserCannotReinstallServerWithoutPermission(): void
|
||||
public function test_subuser_cannot_reinstall_server_without_permission(): void
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount([Permission::ACTION_WEBSOCKET_CONNECT]);
|
||||
|
||||
|
@ -15,7 +15,7 @@ class GetStartupAndVariablesTest extends ClientApiIntegrationTestCase
|
||||
* that can be viewed by a user (e.g. user_viewable=true).
|
||||
*/
|
||||
#[DataProvider('permissionsDataProvider')]
|
||||
public function testStartupVariablesAreReturnedForServer(array $permissions): void
|
||||
public function test_startup_variables_are_returned_for_server(array $permissions): void
|
||||
{
|
||||
/** @var \App\Models\Server $server */
|
||||
[$user, $server] = $this->generateTestAccount($permissions);
|
||||
@ -49,7 +49,7 @@ class GetStartupAndVariablesTest extends ClientApiIntegrationTestCase
|
||||
* Test that a user without the required permission, or who does not have any permission to
|
||||
* access the server cannot get the startup information for it.
|
||||
*/
|
||||
public function testStartupDataIsNotReturnedWithoutPermission(): void
|
||||
public function test_startup_data_is_not_returned_without_permission(): void
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount([Permission::ACTION_WEBSOCKET_CONNECT]);
|
||||
$this->actingAs($user)->getJson($this->link($server) . '/startup')->assertForbidden();
|
||||
|
@ -15,7 +15,7 @@ class UpdateStartupVariableTest extends ClientApiIntegrationTestCase
|
||||
* Test that a startup variable can be edited successfully for a server.
|
||||
*/
|
||||
#[DataProvider('permissionsDataProvider')]
|
||||
public function testStartupVariableCanBeUpdated(array $permissions): void
|
||||
public function test_startup_variable_can_be_updated(array $permissions): void
|
||||
{
|
||||
/** @var \App\Models\Server $server */
|
||||
[$user, $server] = $this->generateTestAccount($permissions);
|
||||
@ -49,7 +49,7 @@ class UpdateStartupVariableTest extends ClientApiIntegrationTestCase
|
||||
* updated via this endpoint.
|
||||
*/
|
||||
#[DataProvider('permissionsDataProvider')]
|
||||
public function testStartupVariableCannotBeUpdatedIfNotUserViewableOrEditable(array $permissions): void
|
||||
public function test_startup_variable_cannot_be_updated_if_not_user_viewable_or_editable(array $permissions): void
|
||||
{
|
||||
/** @var \App\Models\Server $server */
|
||||
[$user, $server] = $this->generateTestAccount($permissions);
|
||||
@ -84,7 +84,7 @@ class UpdateStartupVariableTest extends ClientApiIntegrationTestCase
|
||||
* Test that a hidden variable is not included in the startup_command output for the server if
|
||||
* a different variable is updated.
|
||||
*/
|
||||
public function testHiddenVariablesAreNotReturnedInStartupCommandWhenUpdatingVariable(): void
|
||||
public function test_hidden_variables_are_not_returned_in_startup_command_when_updating_variable(): void
|
||||
{
|
||||
/** @var \App\Models\Server $server */
|
||||
[$user, $server] = $this->generateTestAccount();
|
||||
@ -113,7 +113,7 @@ class UpdateStartupVariableTest extends ClientApiIntegrationTestCase
|
||||
* Test that an egg variable with a validation rule of 'nullable|string' works if no value
|
||||
* is passed through in the request.
|
||||
*/
|
||||
public function testEggVariableWithNullableStringIsNotRequired(): void
|
||||
public function test_egg_variable_with_nullable_string_is_not_required(): void
|
||||
{
|
||||
/** @var \App\Models\Server $server */
|
||||
[$user, $server] = $this->generateTestAccount();
|
||||
@ -137,7 +137,7 @@ class UpdateStartupVariableTest extends ClientApiIntegrationTestCase
|
||||
* Test that a variable cannot be updated if the user does not have permission to perform
|
||||
* that action, or they aren't assigned at all to the server.
|
||||
*/
|
||||
public function testStartupVariableCannotBeUpdatedIfNotUserViewable(): void
|
||||
public function test_startup_variable_cannot_be_updated_if_not_user_viewable(): void
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount([Permission::ACTION_WEBSOCKET_CONNECT]);
|
||||
$this->actingAs($user)->putJson($this->link($server) . '/startup/variable')->assertForbidden();
|
||||
|
@ -19,7 +19,7 @@ class CreateServerSubuserTest extends ClientApiIntegrationTestCase
|
||||
* Test that a subuser can be created for a server.
|
||||
*/
|
||||
#[DataProvider('permissionsDataProvider')]
|
||||
public function testSubuserCanBeCreated(array $permissions): void
|
||||
public function test_subuser_can_be_created(array $permissions): void
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount($permissions);
|
||||
|
||||
@ -52,7 +52,7 @@ class CreateServerSubuserTest extends ClientApiIntegrationTestCase
|
||||
* Tests that an error is returned if a subuser attempts to create a new subuser and assign
|
||||
* permissions that their account does not also possess.
|
||||
*/
|
||||
public function testErrorIsReturnedIfAssigningPermissionsNotAssignedToSelf(): void
|
||||
public function test_error_is_returned_if_assigning_permissions_not_assigned_to_self(): void
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount([
|
||||
Permission::ACTION_USER_CREATE,
|
||||
@ -76,7 +76,7 @@ class CreateServerSubuserTest extends ClientApiIntegrationTestCase
|
||||
/**
|
||||
* Throws some bad data at the API and ensures that a subuser cannot be created.
|
||||
*/
|
||||
public function testSubuserWithExcessivelyLongEmailCannotBeCreated(): void
|
||||
public function test_subuser_with_excessively_long_email_cannot_be_created(): void
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount();
|
||||
|
||||
@ -107,7 +107,7 @@ class CreateServerSubuserTest extends ClientApiIntegrationTestCase
|
||||
* Test that creating a subuser when there is already an account with that email runs
|
||||
* as expected and does not create a new account.
|
||||
*/
|
||||
public function testCreatingSubuserWithSameEmailAsExistingUserWorks(): void
|
||||
public function test_creating_subuser_with_same_email_as_existing_user_works(): void
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount();
|
||||
|
||||
@ -130,7 +130,7 @@ class CreateServerSubuserTest extends ClientApiIntegrationTestCase
|
||||
* Test that an error is returned if the account associated with an email address is already
|
||||
* associated with the server instance.
|
||||
*/
|
||||
public function testAddingSubuserThatAlreadyIsAssignedReturnsError(): void
|
||||
public function test_adding_subuser_that_already_is_assigned_returns_error(): void
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount();
|
||||
|
||||
|
@ -20,7 +20,7 @@ class DeleteSubuserTest extends ClientApiIntegrationTestCase
|
||||
* it to an integer. Then, in the deep API middlewares you would end up trying to load a user
|
||||
* with an ID of 12, which may or may not exist and be wrongly assigned to the model object.
|
||||
*/
|
||||
public function testCorrectSubuserIsDeletedFromServer(): void
|
||||
public function test_correct_subuser_is_deleted_from_server(): void
|
||||
{
|
||||
$this->swap(DaemonServerRepository::class, $mock = \Mockery::mock(DaemonServerRepository::class));
|
||||
|
||||
|
@ -14,7 +14,7 @@ class SubuserAuthorizationTest extends ClientApiIntegrationTestCase
|
||||
* Test that mismatched subusers are not accessible to a server.
|
||||
*/
|
||||
#[DataProvider('methodDataProvider')]
|
||||
public function testUserCannotAccessResourceBelongingToOtherServers(string $method): void
|
||||
public function test_user_cannot_access_resource_belonging_to_other_servers(string $method): void
|
||||
{
|
||||
// Generic subuser, the specific resource we're trying to access.
|
||||
/** @var \App\Models\User $internal */
|
||||
|
@ -14,7 +14,7 @@ class UpdateSubuserTest extends ClientApiIntegrationTestCase
|
||||
* Test that the correct permissions are applied to the account when making updates
|
||||
* to a subusers permissions.
|
||||
*/
|
||||
public function testCorrectPermissionsAreRequiredForUpdating(): void
|
||||
public function test_correct_permissions_are_required_for_updating(): void
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount(['user.read']);
|
||||
|
||||
@ -56,7 +56,7 @@ class UpdateSubuserTest extends ClientApiIntegrationTestCase
|
||||
* Tests that permissions for the account are updated and any extraneous values
|
||||
* we don't know about are removed.
|
||||
*/
|
||||
public function testPermissionsAreSavedToAccount(): void
|
||||
public function test_permissions_are_saved_to_account(): void
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount();
|
||||
|
||||
@ -93,7 +93,7 @@ class UpdateSubuserTest extends ClientApiIntegrationTestCase
|
||||
* Ensure a subuser cannot assign permissions to an account that they do not have
|
||||
* themselves.
|
||||
*/
|
||||
public function testUserCannotAssignPermissionsTheyDoNotHave(): void
|
||||
public function test_user_cannot_assign_permissions_they_do_not_have(): void
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount([Permission::ACTION_USER_READ, Permission::ACTION_USER_UPDATE]);
|
||||
|
||||
@ -114,7 +114,7 @@ class UpdateSubuserTest extends ClientApiIntegrationTestCase
|
||||
/**
|
||||
* Test that a user cannot update thyself.
|
||||
*/
|
||||
public function testUserCannotUpdateSelf(): void
|
||||
public function test_user_cannot_update_self(): void
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount([Permission::ACTION_USER_READ, Permission::ACTION_USER_UPDATE]);
|
||||
|
||||
@ -126,7 +126,7 @@ class UpdateSubuserTest extends ClientApiIntegrationTestCase
|
||||
/**
|
||||
* Test that an error is returned if you attempt to update a subuser on a different account.
|
||||
*/
|
||||
public function testCannotUpdateSubuserForDifferentServer(): void
|
||||
public function test_cannot_update_subuser_for_different_server(): void
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount();
|
||||
[$user2] = $this->generateTestAccount(['foo.bar']);
|
||||
|
@ -17,7 +17,7 @@ class WebsocketControllerTest extends ClientApiIntegrationTestCase
|
||||
* Test that a subuser attempting to connect to the websocket receives an error if they
|
||||
* do not explicitly have the permission.
|
||||
*/
|
||||
public function testSubuserWithoutWebsocketPermissionReceivesError(): void
|
||||
public function test_subuser_without_websocket_permission_receives_error(): void
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount([Permission::ACTION_CONTROL_RESTART]);
|
||||
|
||||
@ -30,7 +30,7 @@ class WebsocketControllerTest extends ClientApiIntegrationTestCase
|
||||
/**
|
||||
* Confirm users cannot access the websocket for another user's server.
|
||||
*/
|
||||
public function testUserWithoutPermissionForServerReceivesError(): void
|
||||
public function test_user_without_permission_for_server_receives_error(): void
|
||||
{
|
||||
[, $server] = $this->generateTestAccount([Permission::ACTION_WEBSOCKET_CONNECT]);
|
||||
[$user] = $this->generateTestAccount([Permission::ACTION_WEBSOCKET_CONNECT]);
|
||||
@ -43,7 +43,7 @@ class WebsocketControllerTest extends ClientApiIntegrationTestCase
|
||||
* Test that the expected permissions are returned for the server owner and that the JWT is
|
||||
* configured correctly.
|
||||
*/
|
||||
public function testJwtAndWebsocketUrlAreReturnedForServerOwner(): void
|
||||
public function test_jwt_and_websocket_url_are_returned_for_server_owner(): void
|
||||
{
|
||||
/** @var \App\Models\User $user */
|
||||
/** @var \App\Models\Server $server */
|
||||
@ -94,7 +94,7 @@ class WebsocketControllerTest extends ClientApiIntegrationTestCase
|
||||
/**
|
||||
* Test that the subuser's permissions are passed along correctly in the generated JWT.
|
||||
*/
|
||||
public function testJwtIsConfiguredCorrectlyForServerSubuser(): void
|
||||
public function test_jwt_is_configured_correctly_for_server_subuser(): void
|
||||
{
|
||||
$permissions = [Permission::ACTION_WEBSOCKET_CONNECT, Permission::ACTION_CONTROL_CONSOLE];
|
||||
|
||||
|
@ -15,7 +15,7 @@ class TwoFactorControllerTest extends ClientApiIntegrationTestCase
|
||||
* Test that image data for enabling 2FA is returned by the endpoint and that the user
|
||||
* record in the database is updated as expected.
|
||||
*/
|
||||
public function testTwoFactorImageDataIsReturned(): void
|
||||
public function test_two_factor_image_data_is_returned(): void
|
||||
{
|
||||
/** @var \App\Models\User $user */
|
||||
$user = User::factory()->create(['use_totp' => false]);
|
||||
@ -39,7 +39,7 @@ class TwoFactorControllerTest extends ClientApiIntegrationTestCase
|
||||
/**
|
||||
* Test that an error is returned if the user's account already has 2FA enabled on it.
|
||||
*/
|
||||
public function testErrorIsReturnedWhenTwoFactorIsAlreadyEnabled(): void
|
||||
public function test_error_is_returned_when_two_factor_is_already_enabled(): void
|
||||
{
|
||||
/** @var \App\Models\User $user */
|
||||
$user = User::factory()->create(['use_totp' => true]);
|
||||
@ -54,7 +54,7 @@ class TwoFactorControllerTest extends ClientApiIntegrationTestCase
|
||||
/**
|
||||
* Test that a validation error is thrown if invalid data is passed to the 2FA endpoint.
|
||||
*/
|
||||
public function testValidationErrorIsReturnedIfInvalidDataIsPassedToEnabled2FA(): void
|
||||
public function test_validation_error_is_returned_if_invalid_data_is_passed_to_enabled2_fa(): void
|
||||
{
|
||||
/** @var \App\Models\User $user */
|
||||
$user = User::factory()->create(['use_totp' => false]);
|
||||
@ -71,7 +71,7 @@ class TwoFactorControllerTest extends ClientApiIntegrationTestCase
|
||||
/**
|
||||
* Tests that 2FA can be enabled on an account for the user.
|
||||
*/
|
||||
public function testTwoFactorCanBeEnabledOnAccount(): void
|
||||
public function test_two_factor_can_be_enabled_on_account(): void
|
||||
{
|
||||
/** @var \App\Models\User $user */
|
||||
$user = User::factory()->create(['use_totp' => false]);
|
||||
@ -118,7 +118,7 @@ class TwoFactorControllerTest extends ClientApiIntegrationTestCase
|
||||
* Test that two-factor authentication can be disabled on an account as long as the password
|
||||
* provided is valid for the account.
|
||||
*/
|
||||
public function testTwoFactorCanBeDisabledOnAccount(): void
|
||||
public function test_two_factor_can_be_disabled_on_account(): void
|
||||
{
|
||||
Carbon::setTestNow(Carbon::now());
|
||||
|
||||
@ -149,7 +149,7 @@ class TwoFactorControllerTest extends ClientApiIntegrationTestCase
|
||||
* Test that no error is returned when trying to disabled two factor on an account where it
|
||||
* was not enabled in the first place.
|
||||
*/
|
||||
public function testNoErrorIsReturnedIfTwoFactorIsNotEnabled(): void
|
||||
public function test_no_error_is_returned_if_two_factor_is_not_enabled(): void
|
||||
{
|
||||
Carbon::setTestNow(Carbon::now());
|
||||
|
||||
@ -166,7 +166,7 @@ class TwoFactorControllerTest extends ClientApiIntegrationTestCase
|
||||
/**
|
||||
* Test that a valid account password is required when enabling two-factor.
|
||||
*/
|
||||
public function testEnablingTwoFactorRequiresValidPassword(): void
|
||||
public function test_enabling_two_factor_requires_valid_password(): void
|
||||
{
|
||||
$user = User::factory()->create(['use_totp' => false]);
|
||||
|
||||
@ -184,7 +184,7 @@ class TwoFactorControllerTest extends ClientApiIntegrationTestCase
|
||||
/**
|
||||
* Test that a valid account password is required when disabling two-factor.
|
||||
*/
|
||||
public function testDisablingTwoFactorRequiresValidPassword(): void
|
||||
public function test_disabling_two_factor_requires_valid_password(): void
|
||||
{
|
||||
$user = User::factory()->create(['use_totp' => true]);
|
||||
|
||||
|
@ -17,7 +17,7 @@ class DaemonAuthenticateTest extends MiddlewareTestCase
|
||||
* Test that if we are accessing the daemon configuration route this middleware is not
|
||||
* applied in order to allow an unauthenticated request to use a token to grab data.
|
||||
*/
|
||||
public function testResponseShouldContinueIfRouteIsExempted(): void
|
||||
public function test_response_should_continue_if_route_is_exempted(): void
|
||||
{
|
||||
$this->request->expects('route->getName')->withNoArgs()->andReturn('daemon.configuration');
|
||||
|
||||
@ -28,7 +28,7 @@ class DaemonAuthenticateTest extends MiddlewareTestCase
|
||||
* Test that not passing in the bearer token will result in a HTTP/401 error with the
|
||||
* proper response headers.
|
||||
*/
|
||||
public function testResponseShouldFailIfNoTokenIsProvided(): void
|
||||
public function test_response_should_fail_if_no_token_is_provided(): void
|
||||
{
|
||||
$this->request->expects('route->getName')->withNoArgs()->andReturn('random.route');
|
||||
$this->request->expects('bearerToken')->withNoArgs()->andReturnNull();
|
||||
@ -48,7 +48,7 @@ class DaemonAuthenticateTest extends MiddlewareTestCase
|
||||
* exception being returned.
|
||||
*/
|
||||
#[DataProvider('badTokenDataProvider')]
|
||||
public function testResponseShouldFailIfTokenFormatIsIncorrect(string $token): void
|
||||
public function test_response_should_fail_if_token_format_is_incorrect(string $token): void
|
||||
{
|
||||
$this->expectException(BadRequestHttpException::class);
|
||||
|
||||
@ -62,7 +62,7 @@ class DaemonAuthenticateTest extends MiddlewareTestCase
|
||||
* Test that an access denied error is returned if the node is valid but the token
|
||||
* provided is not valid.
|
||||
*/
|
||||
public function testResponseShouldFailIfTokenIsNotValid(): void
|
||||
public function test_response_should_fail_if_token_is_not_valid(): void
|
||||
{
|
||||
$node = Node::factory()->create();
|
||||
|
||||
@ -78,7 +78,7 @@ class DaemonAuthenticateTest extends MiddlewareTestCase
|
||||
* Test that an access denied exception is returned if the node is not found using
|
||||
* the token ID provided.
|
||||
*/
|
||||
public function testResponseShouldFailIfNodeIsNotFound(): void
|
||||
public function test_response_should_fail_if_node_is_not_found(): void
|
||||
{
|
||||
$this->expectException(ModelNotFoundException::class);
|
||||
|
||||
@ -91,7 +91,7 @@ class DaemonAuthenticateTest extends MiddlewareTestCase
|
||||
/**
|
||||
* Test a successful middleware process.
|
||||
*/
|
||||
public function testSuccessfulMiddlewareProcess(): void
|
||||
public function test_successful_middleware_process(): void
|
||||
{
|
||||
$node = Node::factory()->create();
|
||||
$node->daemon_token = 'the_same';
|
||||
|
@ -38,7 +38,7 @@ class SftpAuthenticationControllerTest extends IntegrationTestCase
|
||||
/**
|
||||
* Test that a public key is validated correctly.
|
||||
*/
|
||||
public function testPublicKeyIsValidatedCorrectly(): void
|
||||
public function test_public_key_is_validated_correctly(): void
|
||||
{
|
||||
$key = UserSSHKey::factory()->for($this->user)->create();
|
||||
|
||||
@ -68,7 +68,7 @@ class SftpAuthenticationControllerTest extends IntegrationTestCase
|
||||
/**
|
||||
* Test that an account password is validated correctly.
|
||||
*/
|
||||
public function testPasswordIsValidatedCorrectly(): void
|
||||
public function test_password_is_validated_correctly(): void
|
||||
{
|
||||
$this->postJson('/api/remote/sftp/auth', [
|
||||
'username' => $this->getUsername(),
|
||||
@ -98,7 +98,7 @@ class SftpAuthenticationControllerTest extends IntegrationTestCase
|
||||
* the endpoint.
|
||||
*/
|
||||
#[DataProvider('authorizationTypeDataProvider')]
|
||||
public function testUserIsThrottledIfInvalidCredentialsAreProvided(): void
|
||||
public function test_user_is_throttled_if_invalid_credentials_are_provided(): void
|
||||
{
|
||||
for ($i = 0; $i <= 10; $i++) {
|
||||
$this->postJson('/api/remote/sftp/auth', [
|
||||
@ -115,7 +115,7 @@ class SftpAuthenticationControllerTest extends IntegrationTestCase
|
||||
* a server on a different node.
|
||||
*/
|
||||
#[DataProvider('authorizationTypeDataProvider')]
|
||||
public function testRequestIsRejectedIfServerBelongsToDifferentNode(string $type): void
|
||||
public function test_request_is_rejected_if_server_belongs_to_different_node(string $type): void
|
||||
{
|
||||
$node2 = $this->createServerModel()->node;
|
||||
|
||||
@ -133,7 +133,7 @@ class SftpAuthenticationControllerTest extends IntegrationTestCase
|
||||
->assertForbidden();
|
||||
}
|
||||
|
||||
public function testRequestIsDeniedIfUserLacksSftpPermission(): void
|
||||
public function test_request_is_denied_if_user_lacks_sftp_permission(): void
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount([Permission::ACTION_FILE_READ]);
|
||||
|
||||
@ -150,7 +150,7 @@ class SftpAuthenticationControllerTest extends IntegrationTestCase
|
||||
}
|
||||
|
||||
#[DataProvider('serverStateDataProvider')]
|
||||
public function testInvalidServerStateReturnsConflictError(string $status): void
|
||||
public function test_invalid_server_state_returns_conflict_error(string $status): void
|
||||
{
|
||||
$this->server->update(['status' => $status]);
|
||||
|
||||
@ -161,7 +161,7 @@ class SftpAuthenticationControllerTest extends IntegrationTestCase
|
||||
/**
|
||||
* Test that permissions are returned for the user account correctly.
|
||||
*/
|
||||
public function testUserPermissionsAreReturnedCorrectly(): void
|
||||
public function test_user_permissions_are_returned_correctly(): void
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount([Permission::ACTION_FILE_READ, Permission::ACTION_FILE_SFTP]);
|
||||
|
||||
|
@ -20,7 +20,7 @@ class RunTaskJobTest extends IntegrationTestCase
|
||||
/**
|
||||
* An inactive job should not be run by the system.
|
||||
*/
|
||||
public function testInactiveJobIsNotRun(): void
|
||||
public function test_inactive_job_is_not_run(): void
|
||||
{
|
||||
$server = $this->createServerModel();
|
||||
|
||||
@ -47,7 +47,7 @@ class RunTaskJobTest extends IntegrationTestCase
|
||||
$this->assertTrue(CarbonImmutable::now()->isSameAs(\DateTimeInterface::ATOM, $schedule->last_run_at));
|
||||
}
|
||||
|
||||
public function testJobWithInvalidActionThrowsException(): void
|
||||
public function test_job_with_invalid_action_throws_exception(): void
|
||||
{
|
||||
$server = $this->createServerModel();
|
||||
|
||||
@ -64,7 +64,7 @@ class RunTaskJobTest extends IntegrationTestCase
|
||||
}
|
||||
|
||||
#[DataProvider('isManualRunDataProvider')]
|
||||
public function testJobIsExecuted(bool $isManualRun): void
|
||||
public function test_job_is_executed(bool $isManualRun): void
|
||||
{
|
||||
$server = $this->createServerModel();
|
||||
|
||||
@ -103,7 +103,7 @@ class RunTaskJobTest extends IntegrationTestCase
|
||||
}
|
||||
|
||||
#[DataProvider('isManualRunDataProvider')]
|
||||
public function testExceptionDuringRunIsHandledCorrectly(bool $continueOnFailure): void
|
||||
public function test_exception_during_run_is_handled_correctly(bool $continueOnFailure): void
|
||||
{
|
||||
$server = $this->createServerModel();
|
||||
|
||||
@ -141,7 +141,7 @@ class RunTaskJobTest extends IntegrationTestCase
|
||||
/**
|
||||
* Test that a schedule is not executed if the server is suspended.
|
||||
*/
|
||||
public function testTaskIsNotRunIfServerIsSuspended(): void
|
||||
public function test_task_is_not_run_if_server_is_suspended(): void
|
||||
{
|
||||
$server = $this->createServerModel([
|
||||
'status' => ServerState::Suspended,
|
||||
|
@ -26,7 +26,7 @@ class FindAssignableAllocationServiceTest extends IntegrationTestCase
|
||||
* Test that an unassigned allocation is preferred rather than creating an entirely new
|
||||
* allocation for the server.
|
||||
*/
|
||||
public function testExistingAllocationIsPreferred(): void
|
||||
public function test_existing_allocation_is_preferred(): void
|
||||
{
|
||||
$server = $this->createServerModel();
|
||||
|
||||
@ -47,7 +47,7 @@ class FindAssignableAllocationServiceTest extends IntegrationTestCase
|
||||
/**
|
||||
* Test that a new allocation is created if there is not a free one available.
|
||||
*/
|
||||
public function testNewAllocationIsCreatedIfOneIsNotFound(): void
|
||||
public function test_new_allocation_is_created_if_one_is_not_found(): void
|
||||
{
|
||||
$server = $this->createServerModel();
|
||||
config()->set('panel.client_features.allocations.range_start', 5000);
|
||||
@ -64,7 +64,7 @@ class FindAssignableAllocationServiceTest extends IntegrationTestCase
|
||||
/**
|
||||
* Test that a currently assigned port is never assigned to a server.
|
||||
*/
|
||||
public function testOnlyPortNotInUseIsCreated(): void
|
||||
public function test_only_port_not_in_use_is_created(): void
|
||||
{
|
||||
$server = $this->createServerModel();
|
||||
$server2 = $this->createServerModel(['node_id' => $server->node_id]);
|
||||
@ -83,7 +83,7 @@ class FindAssignableAllocationServiceTest extends IntegrationTestCase
|
||||
$this->assertSame(5001, $response->port);
|
||||
}
|
||||
|
||||
public function testExceptionIsThrownIfNoMoreAllocationsCanBeCreatedInRange(): void
|
||||
public function test_exception_is_thrown_if_no_more_allocations_can_be_created_in_range(): void
|
||||
{
|
||||
$server = $this->createServerModel();
|
||||
$server2 = $this->createServerModel(['node_id' => $server->node_id]);
|
||||
@ -109,7 +109,7 @@ class FindAssignableAllocationServiceTest extends IntegrationTestCase
|
||||
* Test that we only auto-allocate from the current server's IP address space, and not a random
|
||||
* IP address available on that node.
|
||||
*/
|
||||
public function testExceptionIsThrownIfOnlyFreePortIsOnADifferentIp(): void
|
||||
public function test_exception_is_thrown_if_only_free_port_is_on_a_different_ip(): void
|
||||
{
|
||||
$server = $this->createServerModel();
|
||||
|
||||
@ -121,7 +121,7 @@ class FindAssignableAllocationServiceTest extends IntegrationTestCase
|
||||
$this->getService()->handle($server);
|
||||
}
|
||||
|
||||
public function testExceptionIsThrownIfStartOrEndRangeIsNotDefined(): void
|
||||
public function test_exception_is_thrown_if_start_or_end_range_is_not_defined(): void
|
||||
{
|
||||
$server = $this->createServerModel();
|
||||
|
||||
@ -131,7 +131,7 @@ class FindAssignableAllocationServiceTest extends IntegrationTestCase
|
||||
$this->getService()->handle($server);
|
||||
}
|
||||
|
||||
public function testExceptionIsThrownIfStartOrEndRangeIsNotNumeric(): void
|
||||
public function test_exception_is_thrown_if_start_or_end_range_is_not_numeric(): void
|
||||
{
|
||||
$server = $this->createServerModel();
|
||||
config()->set('panel.client_features.allocations.range_start', 'hodor');
|
||||
@ -157,7 +157,7 @@ class FindAssignableAllocationServiceTest extends IntegrationTestCase
|
||||
}
|
||||
}
|
||||
|
||||
public function testExceptionIsThrownIfFeatureIsNotEnabled(): void
|
||||
public function test_exception_is_thrown_if_feature_is_not_enabled(): void
|
||||
{
|
||||
config()->set('panel.client_features.allocations.enabled', false);
|
||||
$server = $this->createServerModel();
|
||||
|
@ -16,7 +16,7 @@ use Illuminate\Http\Client\ConnectionException;
|
||||
|
||||
class DeleteBackupServiceTest extends IntegrationTestCase
|
||||
{
|
||||
public function testLockedBackupCannotBeDeleted(): void
|
||||
public function test_locked_backup_cannot_be_deleted(): void
|
||||
{
|
||||
$server = $this->createServerModel();
|
||||
$backup = Backup::factory()->create([
|
||||
@ -29,7 +29,7 @@ class DeleteBackupServiceTest extends IntegrationTestCase
|
||||
$this->app->make(DeleteBackupService::class)->handle($backup);
|
||||
}
|
||||
|
||||
public function testFailedBackupThatIsLockedCanBeDeleted(): void
|
||||
public function test_failed_backup_that_is_locked_can_be_deleted(): void
|
||||
{
|
||||
$server = $this->createServerModel();
|
||||
$backup = Backup::factory()->create([
|
||||
@ -48,7 +48,7 @@ class DeleteBackupServiceTest extends IntegrationTestCase
|
||||
$this->assertNotNull($backup->deleted_at);
|
||||
}
|
||||
|
||||
public function testExceptionThrownDueToMissingBackupIsIgnored(): void
|
||||
public function test_exception_thrown_due_to_missing_backup_is_ignored(): void
|
||||
{
|
||||
$server = $this->createServerModel();
|
||||
$backup = Backup::factory()->create(['server_id' => $server->id]);
|
||||
@ -63,7 +63,7 @@ class DeleteBackupServiceTest extends IntegrationTestCase
|
||||
$this->assertNotNull($backup->deleted_at);
|
||||
}
|
||||
|
||||
public function testExceptionIsThrownIfNot404(): void
|
||||
public function test_exception_is_thrown_if_not404(): void
|
||||
{
|
||||
$server = $this->createServerModel();
|
||||
$backup = Backup::factory()->create(['server_id' => $server->id]);
|
||||
@ -80,7 +80,7 @@ class DeleteBackupServiceTest extends IntegrationTestCase
|
||||
$this->assertNull($backup->deleted_at);
|
||||
}
|
||||
|
||||
public function testS3ObjectCanBeDeleted(): void
|
||||
public function test_s3_object_can_be_deleted(): void
|
||||
{
|
||||
$server = $this->createServerModel();
|
||||
$backup = Backup::factory()->create([
|
||||
|
@ -26,7 +26,7 @@ class DatabaseManagementServiceTest extends IntegrationTestCase
|
||||
/**
|
||||
* Test that the name generated by the unique name function is what we expect.
|
||||
*/
|
||||
public function testUniqueDatabaseNameIsGeneratedCorrectly(): void
|
||||
public function test_unique_database_name_is_generated_correctly(): void
|
||||
{
|
||||
$this->assertSame('s1_example', DatabaseManagementService::generateUniqueDatabaseName('example', 1));
|
||||
$this->assertSame('s123_something_else', DatabaseManagementService::generateUniqueDatabaseName('something_else', 123));
|
||||
@ -36,7 +36,7 @@ class DatabaseManagementServiceTest extends IntegrationTestCase
|
||||
/**
|
||||
* Test that disabling the client database feature flag prevents the creation of databases.
|
||||
*/
|
||||
public function testExceptionIsThrownIfClientDatabasesAreNotEnabled(): void
|
||||
public function test_exception_is_thrown_if_client_databases_are_not_enabled(): void
|
||||
{
|
||||
config()->set('panel.client_features.databases.enabled', false);
|
||||
|
||||
@ -50,7 +50,7 @@ class DatabaseManagementServiceTest extends IntegrationTestCase
|
||||
* Test that a server at its database limit cannot have an additional one created if
|
||||
* the $validateDatabaseLimit flag is not set to false.
|
||||
*/
|
||||
public function testDatabaseCannotBeCreatedIfServerHasReachedLimit(): void
|
||||
public function test_database_cannot_be_created_if_server_has_reached_limit(): void
|
||||
{
|
||||
$server = $this->createServerModel(['database_limit' => 2]);
|
||||
$host = DatabaseHost::factory()->recycle($server->node)->create();
|
||||
@ -66,7 +66,7 @@ class DatabaseManagementServiceTest extends IntegrationTestCase
|
||||
* Test that a missing or invalid database name format causes an exception to be thrown.
|
||||
*/
|
||||
#[DataProvider('invalidDataDataProvider')]
|
||||
public function testEmptyDatabaseNameOrInvalidNameTriggersAnException(array $data): void
|
||||
public function test_empty_database_name_or_invalid_name_triggers_an_exception(array $data): void
|
||||
{
|
||||
$server = $this->createServerModel();
|
||||
|
||||
@ -79,7 +79,7 @@ class DatabaseManagementServiceTest extends IntegrationTestCase
|
||||
/**
|
||||
* Test that creating a server database with an identical name triggers an exception.
|
||||
*/
|
||||
public function testCreatingDatabaseWithIdenticalNameTriggersAnException(): void
|
||||
public function test_creating_database_with_identical_name_triggers_an_exception(): void
|
||||
{
|
||||
$server = $this->createServerModel();
|
||||
$name = DatabaseManagementService::generateUniqueDatabaseName('something', $server->id);
|
||||
@ -108,7 +108,7 @@ class DatabaseManagementServiceTest extends IntegrationTestCase
|
||||
/**
|
||||
* Test that a server database can be created successfully.
|
||||
*/
|
||||
public function testServerDatabaseCanBeCreated(): void
|
||||
public function test_server_database_can_be_created(): void
|
||||
{
|
||||
$this->markTestSkipped();
|
||||
/* TODO: The exception is because the transaction is closed
|
||||
@ -142,7 +142,7 @@ class DatabaseManagementServiceTest extends IntegrationTestCase
|
||||
* Test that an exception encountered while creating the database leads to the cleanup code
|
||||
* being called and any exceptions encountered while cleaning up go unreported.
|
||||
*/
|
||||
public function testExceptionEncounteredWhileCreatingDatabaseAttemptsToCleanup(): void
|
||||
public function test_exception_encountered_while_creating_database_attempts_to_cleanup(): void
|
||||
{
|
||||
$this->markTestSkipped();
|
||||
|
||||
|
@ -44,7 +44,7 @@ class DeployServerDatabaseServiceTest extends IntegrationTestCase
|
||||
* Test that an error is thrown if either the database name or the remote host are empty.
|
||||
*/
|
||||
#[DataProvider('invalidDataProvider')]
|
||||
public function testErrorIsThrownIfDatabaseNameIsEmpty(array $data): void
|
||||
public function test_error_is_thrown_if_database_name_is_empty(array $data): void
|
||||
{
|
||||
$server = $this->createServerModel();
|
||||
|
||||
@ -57,7 +57,7 @@ class DeployServerDatabaseServiceTest extends IntegrationTestCase
|
||||
* Test that an error is thrown if there are no database hosts on the same node as the
|
||||
* server and the allow_random config value is false.
|
||||
*/
|
||||
public function testErrorIsThrownIfNoDatabaseHostsExistOnNode(): void
|
||||
public function test_error_is_thrown_if_no_database_hosts_exist_on_node(): void
|
||||
{
|
||||
$server = $this->createServerModel();
|
||||
|
||||
@ -77,7 +77,7 @@ class DeployServerDatabaseServiceTest extends IntegrationTestCase
|
||||
/**
|
||||
* Test that an error is thrown if no database hosts exist at all on the system.
|
||||
*/
|
||||
public function testErrorIsThrownIfNoDatabaseHostsExistOnSystem(): void
|
||||
public function test_error_is_thrown_if_no_database_hosts_exist_on_system(): void
|
||||
{
|
||||
$server = $this->createServerModel();
|
||||
|
||||
@ -92,7 +92,7 @@ class DeployServerDatabaseServiceTest extends IntegrationTestCase
|
||||
/**
|
||||
* Test that a database host on the same node as the server is preferred.
|
||||
*/
|
||||
public function testDatabaseHostOnSameNodeIsPreferred(): void
|
||||
public function test_database_host_on_same_node_is_preferred(): void
|
||||
{
|
||||
$server = $this->createServerModel();
|
||||
$host = DatabaseHost::factory()->recycle($server->node)->create();
|
||||
@ -116,7 +116,7 @@ class DeployServerDatabaseServiceTest extends IntegrationTestCase
|
||||
* there are no same-node hosts and the allow_random configuration value is set to
|
||||
* true.
|
||||
*/
|
||||
public function testDatabaseHostIsSelectedIfNoSuitableHostExistsOnSameNode(): void
|
||||
public function test_database_host_is_selected_if_no_suitable_host_exists_on_same_node(): void
|
||||
{
|
||||
$server = $this->createServerModel();
|
||||
|
||||
|
@ -19,7 +19,7 @@ class ProcessScheduleServiceTest extends IntegrationTestCase
|
||||
/**
|
||||
* Test that a schedule with no tasks registered returns an error.
|
||||
*/
|
||||
public function testScheduleWithNoTasksReturnsException(): void
|
||||
public function test_schedule_with_no_tasks_returns_exception(): void
|
||||
{
|
||||
$server = $this->createServerModel();
|
||||
$schedule = Schedule::factory()->create(['server_id' => $server->id]);
|
||||
@ -33,7 +33,7 @@ class ProcessScheduleServiceTest extends IntegrationTestCase
|
||||
/**
|
||||
* Test that an error during the schedule update is not persisted to the database.
|
||||
*/
|
||||
public function testErrorDuringScheduleDataUpdateDoesNotPersistChanges(): void
|
||||
public function test_error_during_schedule_data_update_does_not_persist_changes(): void
|
||||
{
|
||||
$server = $this->createServerModel();
|
||||
|
||||
@ -58,7 +58,7 @@ class ProcessScheduleServiceTest extends IntegrationTestCase
|
||||
* Test that a job is dispatched as expected using the initial delay.
|
||||
*/
|
||||
#[DataProvider('dispatchNowDataProvider')]
|
||||
public function testJobCanBeDispatchedWithExpectedInitialDelay(bool $now): void
|
||||
public function test_job_can_be_dispatched_with_expected_initial_delay(bool $now): void
|
||||
{
|
||||
Bus::fake();
|
||||
|
||||
@ -89,7 +89,7 @@ class ProcessScheduleServiceTest extends IntegrationTestCase
|
||||
* Test that even if a schedule's task sequence gets messed up the first task based on
|
||||
* the ascending order of tasks is used.
|
||||
*/
|
||||
public function testFirstSequenceTaskIsFound(): void
|
||||
public function test_first_sequence_task_is_found(): void
|
||||
{
|
||||
Bus::fake();
|
||||
|
||||
@ -118,7 +118,7 @@ class ProcessScheduleServiceTest extends IntegrationTestCase
|
||||
* Tests that a task's processing state is reset correctly if using "dispatchNow" and there is
|
||||
* an exception encountered while running it.
|
||||
*/
|
||||
public function testTaskDispatchedNowIsResetProperlyIfErrorIsEncountered(): void
|
||||
public function test_task_dispatched_now_is_reset_properly_if_error_is_encountered(): void
|
||||
{
|
||||
$this->swap(Dispatcher::class, $dispatcher = \Mockery::mock(Dispatcher::class));
|
||||
|
||||
|
@ -29,7 +29,7 @@ class BuildModificationServiceTest extends IntegrationTestCase
|
||||
* Test that allocations can be added and removed from a server. Only the allocations on the
|
||||
* current node and belonging to this server should be modified.
|
||||
*/
|
||||
public function testAllocationsCanBeModifiedForTheServer(): void
|
||||
public function test_allocations_can_be_modified_for_the_server(): void
|
||||
{
|
||||
$server = $this->createServerModel();
|
||||
$server2 = $this->createServerModel();
|
||||
@ -78,7 +78,7 @@ class BuildModificationServiceTest extends IntegrationTestCase
|
||||
* Test that an exception is thrown if removing the default allocation without also assigning
|
||||
* new allocations to the server.
|
||||
*/
|
||||
public function testExceptionIsThrownIfRemovingTheDefaultAllocation(): void
|
||||
public function test_exception_is_thrown_if_removing_the_default_allocation(): void
|
||||
{
|
||||
$server = $this->createServerModel();
|
||||
/** @var \App\Models\Allocation[] $allocations */
|
||||
@ -100,7 +100,7 @@ class BuildModificationServiceTest extends IntegrationTestCase
|
||||
* the server data is updated in realtime. This test also ensures that only certain fields get updated
|
||||
* for the server, and not just any arbitrary field.
|
||||
*/
|
||||
public function testServerBuildDataIsProperlyUpdatedOndaemon(): void
|
||||
public function test_server_build_data_is_properly_updated_ondaemon(): void
|
||||
{
|
||||
$server = $this->createServerModel();
|
||||
|
||||
@ -140,7 +140,7 @@ class BuildModificationServiceTest extends IntegrationTestCase
|
||||
* when making updates. This allows for a server to be modified even when the Daemon
|
||||
* node is offline.
|
||||
*/
|
||||
public function testConnectionExceptionIsIgnoredWhenUpdatingServerSettings(): void
|
||||
public function test_connection_exception_is_ignored_when_updating_server_settings(): void
|
||||
{
|
||||
$this->markTestSkipped();
|
||||
|
||||
@ -160,7 +160,7 @@ class BuildModificationServiceTest extends IntegrationTestCase
|
||||
/**
|
||||
* Test that no exception is thrown if we are only removing an allocation.
|
||||
*/
|
||||
public function testNoExceptionIsThrownIfOnlyRemovingAllocation(): void
|
||||
public function test_no_exception_is_thrown_if_only_removing_allocation(): void
|
||||
{
|
||||
$server = $this->createServerModel();
|
||||
/** @var \App\Models\Allocation $allocation */
|
||||
@ -183,7 +183,7 @@ class BuildModificationServiceTest extends IntegrationTestCase
|
||||
*
|
||||
* We'll default to adding the allocation in this case.
|
||||
*/
|
||||
public function testAllocationInBothAddAndRemoveIsAdded(): void
|
||||
public function test_allocation_in_both_add_and_remove_is_added(): void
|
||||
{
|
||||
$server = $this->createServerModel();
|
||||
/** @var \App\Models\Allocation $allocation */
|
||||
@ -202,7 +202,7 @@ class BuildModificationServiceTest extends IntegrationTestCase
|
||||
/**
|
||||
* Test that using the same allocation ID multiple times in the array does not cause an error.
|
||||
*/
|
||||
public function testUsingSameAllocationIdMultipleTimesDoesNotError(): void
|
||||
public function test_using_same_allocation_id_multiple_times_does_not_error(): void
|
||||
{
|
||||
$server = $this->createServerModel();
|
||||
/** @var \App\Models\Allocation $allocation */
|
||||
@ -227,7 +227,7 @@ class BuildModificationServiceTest extends IntegrationTestCase
|
||||
* test which should properly ignore connection issues. We want any other type of exception
|
||||
* to properly be thrown back to the caller.
|
||||
*/
|
||||
public function testThatUpdatesAreRolledBackIfExceptionIsEncountered(): void
|
||||
public function test_that_updates_are_rolled_back_if_exception_is_encountered(): void
|
||||
{
|
||||
$server = $this->createServerModel();
|
||||
/** @var \App\Models\Allocation $allocation */
|
||||
|
@ -48,7 +48,7 @@ class ServerCreationServiceTest extends IntegrationTestCase
|
||||
* tests to cover that the logic being used does indeed find suitable nodes and ports. For
|
||||
* this test we just care that it is recognized and passed off to those functions.
|
||||
*/
|
||||
public function testServerIsCreatedWithDeploymentObject(): void
|
||||
public function test_server_is_created_with_deployment_object(): void
|
||||
{
|
||||
/** @var \App\Models\User $user */
|
||||
$user = User::factory()->create();
|
||||
@ -145,7 +145,7 @@ class ServerCreationServiceTest extends IntegrationTestCase
|
||||
* Test that a server is deleted from the Panel if daemon returns an error during the creation
|
||||
* process.
|
||||
*/
|
||||
public function testErrorEncounteredByDaemonCausesServerToBeDeleted(): void
|
||||
public function test_error_encountered_by_daemon_causes_server_to_be_deleted(): void
|
||||
{
|
||||
/** @var \App\Models\User $user */
|
||||
$user = User::factory()->create();
|
||||
|
@ -52,7 +52,7 @@ class ServerDeletionServiceTest extends IntegrationTestCase
|
||||
* Test that a server is not deleted if the force option is not set and an error
|
||||
* is returned by daemon.
|
||||
*/
|
||||
public function testRegularDeleteFailsIfDaemonReturnsError(): void
|
||||
public function test_regular_delete_fails_if_daemon_returns_error(): void
|
||||
{
|
||||
$server = $this->createServerModel();
|
||||
|
||||
@ -68,7 +68,7 @@ class ServerDeletionServiceTest extends IntegrationTestCase
|
||||
/**
|
||||
* Test that a 404 from Daemon while deleting a server does not cause the deletion to fail.
|
||||
*/
|
||||
public function testRegularDeleteIgnores404FromDaemon(): void
|
||||
public function test_regular_delete_ignores404_from_daemon(): void
|
||||
{
|
||||
$server = $this->createServerModel();
|
||||
|
||||
@ -83,7 +83,7 @@ class ServerDeletionServiceTest extends IntegrationTestCase
|
||||
* Test that an error from Daemon does not cause the deletion to fail if the server is being
|
||||
* force deleted.
|
||||
*/
|
||||
public function testForceDeleteIgnoresExceptionFromDaemon(): void
|
||||
public function test_force_delete_ignores_exception_from_daemon(): void
|
||||
{
|
||||
$server = $this->createServerModel();
|
||||
|
||||
@ -98,7 +98,7 @@ class ServerDeletionServiceTest extends IntegrationTestCase
|
||||
* Test that a non-force-delete call does not delete the server if one of the databases
|
||||
* cannot be deleted from the host.
|
||||
*/
|
||||
public function testExceptionWhileDeletingStopsProcess(): void
|
||||
public function test_exception_while_deleting_stops_process(): void
|
||||
{
|
||||
$server = $this->createServerModel();
|
||||
$host = DatabaseHost::factory()->create();
|
||||
@ -123,7 +123,7 @@ class ServerDeletionServiceTest extends IntegrationTestCase
|
||||
/**
|
||||
* Test that a server is deleted even if the server databases cannot be deleted from the host.
|
||||
*/
|
||||
public function testExceptionWhileDeletingDatabasesDoesNotAbortIfForceDeleted(): void
|
||||
public function test_exception_while_deleting_databases_does_not_abort_if_force_deleted(): void
|
||||
{
|
||||
$server = $this->createServerModel();
|
||||
$host = DatabaseHost::factory()->create();
|
||||
|
@ -19,7 +19,7 @@ class StartupModificationServiceTest extends IntegrationTestCase
|
||||
* egg_id variable which should have no impact if the request is coming from
|
||||
* a non-admin entity.
|
||||
*/
|
||||
public function testNonAdminCanModifyServerVariables(): void
|
||||
public function test_non_admin_can_modify_server_variables(): void
|
||||
{
|
||||
$server = $this->createServerModel();
|
||||
|
||||
@ -67,7 +67,7 @@ class StartupModificationServiceTest extends IntegrationTestCase
|
||||
/**
|
||||
* Test that modifying an egg as an admin properly updates the data for the server.
|
||||
*/
|
||||
public function testServerIsProperlyModifiedAsAdminUser(): void
|
||||
public function test_server_is_properly_modified_as_admin_user(): void
|
||||
{
|
||||
/** @var \App\Models\Egg $nextEgg */
|
||||
$nextEgg = Egg::query()->findOrFail(6);
|
||||
@ -99,7 +99,7 @@ class StartupModificationServiceTest extends IntegrationTestCase
|
||||
* Test that hidden variables can be updated by an admin but are not affected by a
|
||||
* regular user who attempts to pass them through.
|
||||
*/
|
||||
public function testEnvironmentVariablesCanBeUpdatedByAdmin(): void
|
||||
public function test_environment_variables_can_be_updated_by_admin(): void
|
||||
{
|
||||
$server = $this->createServerModel();
|
||||
$server->loadMissing(['egg', 'variables']);
|
||||
@ -147,7 +147,7 @@ class StartupModificationServiceTest extends IntegrationTestCase
|
||||
* Test that passing an invalid egg ID into the function throws an exception
|
||||
* rather than silently failing or skipping.
|
||||
*/
|
||||
public function testInvalidEggIdTriggersException(): void
|
||||
public function test_invalid_egg_id_triggers_exception(): void
|
||||
{
|
||||
$server = $this->createServerModel();
|
||||
|
||||
|
@ -24,7 +24,7 @@ class SuspensionServiceTest extends IntegrationTestCase
|
||||
$this->app->instance(DaemonServerRepository::class, $this->repository);
|
||||
}
|
||||
|
||||
public function testServerIsSuspendedAndUnsuspended(): void
|
||||
public function test_server_is_suspended_and_unsuspended(): void
|
||||
{
|
||||
$server = $this->createServerModel();
|
||||
|
||||
@ -39,7 +39,7 @@ class SuspensionServiceTest extends IntegrationTestCase
|
||||
$this->assertFalse($server->refresh()->isSuspended());
|
||||
}
|
||||
|
||||
public function testNoActionIsTakenIfSuspensionStatusIsUnchanged(): void
|
||||
public function test_no_action_is_taken_if_suspension_status_is_unchanged(): void
|
||||
{
|
||||
$server = $this->createServerModel();
|
||||
|
||||
|
@ -27,7 +27,7 @@ class VariableValidatorServiceTest extends IntegrationTestCase
|
||||
/**
|
||||
* Test that environment variables for a server are validated as expected.
|
||||
*/
|
||||
public function testEnvironmentVariablesCanBeValidated(): void
|
||||
public function test_environment_variables_can_be_validated(): void
|
||||
{
|
||||
$egg = $this->cloneEggAndVariables($this->egg);
|
||||
|
||||
@ -64,7 +64,7 @@ class VariableValidatorServiceTest extends IntegrationTestCase
|
||||
* Test that variables that are user_editable=false do not get validated (or returned) by
|
||||
* the handler.
|
||||
*/
|
||||
public function testNormalUserCannotValidateNonUserEditableVariables(): void
|
||||
public function test_normal_user_cannot_validate_non_user_editable_variables(): void
|
||||
{
|
||||
$egg = $this->cloneEggAndVariables($this->egg);
|
||||
$egg->variables()->first()->update([
|
||||
@ -83,7 +83,7 @@ class VariableValidatorServiceTest extends IntegrationTestCase
|
||||
$this->assertSame('server.jar', $response->get(0)->value);
|
||||
}
|
||||
|
||||
public function testEnvironmentVariablesCanBeUpdatedAsAdmin(): void
|
||||
public function test_environment_variables_can_be_updated_as_admin(): void
|
||||
{
|
||||
$egg = $this->cloneEggAndVariables($this->egg);
|
||||
$egg->variables()->first()->update([
|
||||
@ -115,7 +115,7 @@ class VariableValidatorServiceTest extends IntegrationTestCase
|
||||
$this->assertSame('server.jar', $response->get(1)->value);
|
||||
}
|
||||
|
||||
public function testNullableEnvironmentVariablesCanBeUsedCorrectly(): void
|
||||
public function test_nullable_environment_variables_can_be_used_correctly(): void
|
||||
{
|
||||
$egg = $this->cloneEggAndVariables($this->egg);
|
||||
$egg->variables()->where('env_variable', '!=', 'BUNGEE_VERSION')->delete();
|
||||
|
@ -9,7 +9,7 @@ use PHPUnit\Framework\Attributes\DataProvider;
|
||||
class EnvironmentWriterTraitTest extends TestCase
|
||||
{
|
||||
#[DataProvider('variableDataProvider')]
|
||||
public function testVariableIsEscapedProperly($input, $expected): void
|
||||
public function test_variable_is_escaped_properly($input, $expected): void
|
||||
{
|
||||
$output = (new FooClass())->escapeEnvironmentValue($input);
|
||||
|
||||
|
@ -11,7 +11,7 @@ class IsDigitTest extends TestCase
|
||||
* Test the is_digit helper.
|
||||
*/
|
||||
#[DataProvider('helperDataProvider')]
|
||||
public function testHelper($value, $response): void
|
||||
public function test_helper($value, $response): void
|
||||
{
|
||||
$this->assertSame($response, is_digit($value));
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ class AuthenticateUserTest extends MiddlewareTestCase
|
||||
/**
|
||||
* Test that no user defined results in an access denied exception.
|
||||
*/
|
||||
public function testNoUserDefined(): void
|
||||
public function test_no_user_defined(): void
|
||||
{
|
||||
$this->expectException(AccessDeniedHttpException::class);
|
||||
|
||||
@ -23,7 +23,7 @@ class AuthenticateUserTest extends MiddlewareTestCase
|
||||
/**
|
||||
* Test that a non-admin user results in an exception.
|
||||
*/
|
||||
public function testNonAdminUser(): void
|
||||
public function test_non_admin_user(): void
|
||||
{
|
||||
$this->expectException(AccessDeniedHttpException::class);
|
||||
|
||||
@ -35,7 +35,7 @@ class AuthenticateUserTest extends MiddlewareTestCase
|
||||
/**
|
||||
* Test that an admin user continues though the middleware.
|
||||
*/
|
||||
public function testAdminUser(): void
|
||||
public function test_admin_user(): void
|
||||
{
|
||||
$this->generateRequestUserModel(true);
|
||||
|
||||
|
@ -25,7 +25,7 @@ class LanguageMiddlewareTest extends MiddlewareTestCase
|
||||
/**
|
||||
* Test that a language is defined via the middleware for guests.
|
||||
*/
|
||||
public function testLanguageIsSetForGuest(): void
|
||||
public function test_language_is_set_for_guest(): void
|
||||
{
|
||||
$this->request->shouldReceive('user')->withNoArgs()->andReturnNull();
|
||||
$this->appMock->shouldReceive('setLocale')->with('en')->once()->andReturnNull();
|
||||
@ -36,7 +36,7 @@ class LanguageMiddlewareTest extends MiddlewareTestCase
|
||||
/**
|
||||
* Test that a language is defined via the middleware for a user.
|
||||
*/
|
||||
public function testLanguageIsSetWithAuthenticatedUser(): void
|
||||
public function test_language_is_set_with_authenticated_user(): void
|
||||
{
|
||||
$user = User::factory()->make(['language' => 'de']);
|
||||
|
||||
|
@ -27,7 +27,7 @@ class MaintenanceMiddlewareTest extends MiddlewareTestCase
|
||||
/**
|
||||
* Test that a node not in maintenance mode continues through the request cycle.
|
||||
*/
|
||||
public function testHandle(): void
|
||||
public function test_handle(): void
|
||||
{
|
||||
// maintenance mode is off by default
|
||||
$server = new Server();
|
||||
@ -45,7 +45,7 @@ class MaintenanceMiddlewareTest extends MiddlewareTestCase
|
||||
/**
|
||||
* Test that a node in maintenance mode returns an error view.
|
||||
*/
|
||||
public function testHandleInMaintenanceMode(): void
|
||||
public function test_handle_in_maintenance_mode(): void
|
||||
{
|
||||
$server = new Server();
|
||||
|
||||
|
@ -11,7 +11,7 @@ class UsernameTest extends TestCase
|
||||
/**
|
||||
* Test that this rule can be cast to a string correctly.
|
||||
*/
|
||||
public function testRuleIsStringable(): void
|
||||
public function test_rule_is_stringable(): void
|
||||
{
|
||||
$this->assertSame('p_username', (string) new Username());
|
||||
}
|
||||
@ -20,7 +20,7 @@ class UsernameTest extends TestCase
|
||||
* Test valid usernames.
|
||||
*/
|
||||
#[DataProvider('validUsernameDataProvider')]
|
||||
public function testValidUsernames(string $username): void
|
||||
public function test_valid_usernames(string $username): void
|
||||
{
|
||||
$this->assertTrue((new Username())->passes('test', $username), 'Assert username is valid.');
|
||||
}
|
||||
@ -29,7 +29,7 @@ class UsernameTest extends TestCase
|
||||
* Test invalid usernames return false.
|
||||
*/
|
||||
#[DataProvider('invalidUsernameDataProvider')]
|
||||
public function testInvalidUsernames(string $username): void
|
||||
public function test_invalid_usernames(string $username): void
|
||||
{
|
||||
$this->assertFalse((new Username())->passes('test', $username), 'Assert username is not valid.');
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ class AdminAclTest extends TestCase
|
||||
* Test that permissions return the expects values.
|
||||
*/
|
||||
#[DataProvider('permissionsDataProvider')]
|
||||
public function testPermissions(int $permission, int $check, bool $outcome): void
|
||||
public function test_permissions(int $permission, int $check, bool $outcome): void
|
||||
{
|
||||
$this->assertSame($outcome, AdminAcl::can($permission, $check));
|
||||
}
|
||||
@ -22,7 +22,7 @@ class AdminAclTest extends TestCase
|
||||
/**
|
||||
* Test that checking against a model works as expected.
|
||||
*/
|
||||
public function testCheck(): void
|
||||
public function test_check(): void
|
||||
{
|
||||
$model = ApiKey::factory()->make(['permissions' => [
|
||||
Server::RESOURCE_NAME => AdminAcl::READ | AdminAcl::WRITE,
|
||||
|
Loading…
x
Reference in New Issue
Block a user