-
-
Notifications
You must be signed in to change notification settings - Fork 322
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
378 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
/** | ||
* We don't care for unhandled exceptions in tests. | ||
* It is the nature of a test to throw an exception. | ||
* Without this suppression we had 100+ Linter warning in this file which | ||
* don't help anything. | ||
* | ||
* @noinspection PhpDocMissingThrowsInspection | ||
* @noinspection PhpUnhandledExceptionInspection | ||
*/ | ||
|
||
namespace Tests\Feature_v2\Album; | ||
|
||
use Tests\Feature_v2\Base\BaseApiV2Test; | ||
|
||
class ConfigTest extends BaseApiV2Test | ||
{ | ||
public function testGet(): void | ||
{ | ||
$response = $this->getJson('Gallery::Init'); | ||
$this->assertOk($response); | ||
|
||
$response = $this->getJson('Gallery::getLayout'); | ||
$this->assertOk($response); | ||
|
||
$response = $this->getJson('Gallery::getMapProvider'); | ||
$this->assertOk($response); | ||
|
||
$response = $this->getJson('Gallery::getUploadLimits'); | ||
$this->assertOk($response); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
/** | ||
* We don't care for unhandled exceptions in tests. | ||
* It is the nature of a test to throw an exception. | ||
* Without this suppression we had 100+ Linter warning in this file which | ||
* don't help anything. | ||
* | ||
* @noinspection PhpDocMissingThrowsInspection | ||
* @noinspection PhpUnhandledExceptionInspection | ||
*/ | ||
|
||
namespace Tests\Feature_v2\Diagnostics; | ||
|
||
use Tests\Feature_v2\Base\BaseApiV2Test; | ||
|
||
class PermissionTest extends BaseApiV2Test | ||
{ | ||
public function testGetGuest(): void | ||
{ | ||
$response = $this->getJson('Diagnostics::permissions'); | ||
$this->assertUnauthorized($response); | ||
} | ||
|
||
public function testAuthenticated(): void | ||
{ | ||
$response = $this->actingAs($this->userLocked)->getJson('Diagnostics::permissions'); | ||
$this->assertForbidden($response); | ||
} | ||
|
||
public function testAuthorized(): void | ||
{ | ||
$response = $this->actingAs($this->admin)->getJson('Diagnostics::permissions'); | ||
$this->assertOk($response); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?php | ||
|
||
/** | ||
* We don't care for unhandled exceptions in tests. | ||
* It is the nature of a test to throw an exception. | ||
* Without this suppression we had 100+ Linter warning in this file which | ||
* don't help anything. | ||
* | ||
* @noinspection PhpDocMissingThrowsInspection | ||
* @noinspection PhpUnhandledExceptionInspection | ||
*/ | ||
|
||
namespace Tests\Feature_v2\Maintenance; | ||
|
||
use Tests\Feature_v2\Base\BaseApiV2Test; | ||
|
||
class CleaningTest extends BaseApiV2Test | ||
{ | ||
public function testGuest(): void | ||
{ | ||
$response = $this->getJsonWithData('Maintenance::cleaning', []); | ||
$this->assertUnprocessable($response); | ||
|
||
$response = $this->getJsonWithData('Maintenance::cleaning', ['path' => 'filesystems.disks.extract-jobs.root']); | ||
$this->assertUnauthorized($response); | ||
|
||
$response = $this->postJson('Maintenance::cleaning'); | ||
$this->assertUnprocessable($response); | ||
|
||
$response = $this->postJson('Maintenance::cleaning', ['path' => 'filesystems.disks.extract-jobs.root']); | ||
$this->assertUnauthorized($response); | ||
} | ||
|
||
public function testUser(): void | ||
{ | ||
$response = $this->actingAs($this->userLocked)->getJsonWithData('Maintenance::cleaning'); | ||
$this->assertUnprocessable($response); | ||
|
||
$response = $this->actingAs($this->userLocked)->getJsonWithData('Maintenance::cleaning', ['path' => 'filesystems.disks.extract-jobs.root']); | ||
$this->assertForbidden($response); | ||
|
||
$response = $this->actingAs($this->userLocked)->postJson('Maintenance::cleaning'); | ||
$this->assertUnprocessable($response); | ||
|
||
$response = $this->actingAs($this->userLocked)->postJson('Maintenance::cleaning', ['path' => 'filesystems.disks.extract-jobs.root']); | ||
$this->assertForbidden($response); | ||
} | ||
|
||
public function testAdmin(): void | ||
{ | ||
$response = $this->actingAs($this->admin)->getJsonWithData('Maintenance::cleaning'); | ||
$this->assertUnprocessable($response); | ||
|
||
$response = $this->actingAs($this->admin)->getJsonWithData('Maintenance::cleaning', ['path' => 'filesystems.disks.extract-jobs.root']); | ||
$this->assertOk($response); | ||
|
||
$response = $this->actingAs($this->admin)->postJson('Maintenance::cleaning'); | ||
$this->assertUnprocessable($response); | ||
|
||
$response = $this->actingAs($this->admin)->postJson('Maintenance::cleaning', ['path' => 'filesystems.disks.extract-jobs.root']); | ||
$this->assertOk($response); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?php | ||
|
||
/** | ||
* We don't care for unhandled exceptions in tests. | ||
* It is the nature of a test to throw an exception. | ||
* Without this suppression we had 100+ Linter warning in this file which | ||
* don't help anything. | ||
* | ||
* @noinspection PhpDocMissingThrowsInspection | ||
* @noinspection PhpUnhandledExceptionInspection | ||
*/ | ||
|
||
namespace Tests\Feature_v2\Maintenance; | ||
|
||
use Tests\Feature_v2\Base\BaseApiV2Test; | ||
|
||
class GenSizeVariantsTest extends BaseApiV2Test | ||
{ | ||
public function testGuest(): void | ||
{ | ||
$response = $this->getJsonWithData('Maintenance::genSizeVariants', []); | ||
$this->assertUnprocessable($response); | ||
|
||
$response = $this->getJsonWithData('Maintenance::genSizeVariants', ['kind' => 4]); | ||
$this->assertUnauthorized($response); | ||
|
||
$response = $this->postJson('Maintenance::genSizeVariants'); | ||
$this->assertUnprocessable($response); | ||
|
||
$response = $this->postJson('Maintenance::genSizeVariants', ['kind' => 4]); | ||
$this->assertUnauthorized($response); | ||
} | ||
|
||
public function testUser(): void | ||
{ | ||
$response = $this->actingAs($this->userLocked)->getJsonWithData('Maintenance::genSizeVariants'); | ||
$this->assertUnprocessable($response); | ||
|
||
$response = $this->actingAs($this->userLocked)->getJsonWithData('Maintenance::genSizeVariants', ['kind' => 4]); | ||
$this->assertForbidden($response); | ||
|
||
$response = $this->actingAs($this->userLocked)->postJson('Maintenance::genSizeVariants'); | ||
$this->assertUnprocessable($response); | ||
|
||
$response = $this->actingAs($this->userLocked)->postJson('Maintenance::genSizeVariants', ['kind' => 4]); | ||
$this->assertForbidden($response); | ||
} | ||
|
||
public function testAdmin(): void | ||
{ | ||
$response = $this->actingAs($this->admin)->getJsonWithData('Maintenance::genSizeVariants'); | ||
$this->assertUnprocessable($response); | ||
|
||
$response = $this->actingAs($this->admin)->getJsonWithData('Maintenance::genSizeVariants', ['kind' => 4]); | ||
$this->assertOk($response); | ||
|
||
$response = $this->actingAs($this->admin)->postJson('Maintenance::genSizeVariants'); | ||
$this->assertUnprocessable($response); | ||
|
||
$response = $this->actingAs($this->admin)->postJson('Maintenance::genSizeVariants', ['kind' => 4]); | ||
$this->assertNoContent($response); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
/** | ||
* We don't care for unhandled exceptions in tests. | ||
* It is the nature of a test to throw an exception. | ||
* Without this suppression we had 100+ Linter warning in this file which | ||
* don't help anything. | ||
* | ||
* @noinspection PhpDocMissingThrowsInspection | ||
* @noinspection PhpUnhandledExceptionInspection | ||
*/ | ||
|
||
namespace Tests\Feature_v2\Maintenance; | ||
|
||
use Tests\Feature_v2\Base\BaseApiV2Test; | ||
|
||
class JobsTest extends BaseApiV2Test | ||
{ | ||
public function testGuest(): void | ||
{ | ||
$response = $this->getJsonWithData('Maintenance::jobs', []); | ||
$this->assertUnauthorized($response); | ||
|
||
$response = $this->postJson('Maintenance::jobs'); | ||
$this->assertUnauthorized($response); | ||
} | ||
|
||
public function testUser(): void | ||
{ | ||
$response = $this->actingAs($this->userLocked)->getJsonWithData('Maintenance::jobs'); | ||
$this->assertForbidden($response); | ||
|
||
$response = $this->actingAs($this->userLocked)->postJson('Maintenance::jobs'); | ||
$this->assertForbidden($response); | ||
} | ||
|
||
public function testAdmin(): void | ||
{ | ||
$response = $this->actingAs($this->admin)->getJsonWithData('Maintenance::jobs'); | ||
$this->assertOk($response); | ||
|
||
$response = $this->actingAs($this->admin)->postJson('Maintenance::jobs'); | ||
$this->assertNoContent($response); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
/** | ||
* We don't care for unhandled exceptions in tests. | ||
* It is the nature of a test to throw an exception. | ||
* Without this suppression we had 100+ Linter warning in this file which | ||
* don't help anything. | ||
* | ||
* @noinspection PhpDocMissingThrowsInspection | ||
* @noinspection PhpUnhandledExceptionInspection | ||
*/ | ||
|
||
namespace Tests\Feature_v2\Maintenance; | ||
|
||
use Tests\Feature_v2\Base\BaseApiV2Test; | ||
|
||
class OptimizeTest extends BaseApiV2Test | ||
{ | ||
public function testGuest(): void | ||
{ | ||
$response = $this->postJson('Maintenance::optimize'); | ||
$this->assertUnauthorized($response); | ||
} | ||
|
||
public function testUser(): void | ||
{ | ||
$response = $this->actingAs($this->userLocked)->postJson('Maintenance::optimize'); | ||
$this->assertForbidden($response); | ||
} | ||
|
||
public function testAdmin(): void | ||
{ | ||
$response = $this->actingAs($this->admin)->postJson('Maintenance::optimize'); | ||
$this->assertOk($response); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
/** | ||
* We don't care for unhandled exceptions in tests. | ||
* It is the nature of a test to throw an exception. | ||
* Without this suppression we had 100+ Linter warning in this file which | ||
* don't help anything. | ||
* | ||
* @noinspection PhpDocMissingThrowsInspection | ||
* @noinspection PhpUnhandledExceptionInspection | ||
*/ | ||
|
||
namespace Tests\Feature_v2\Maintenance; | ||
|
||
use Tests\Feature_v2\Base\BaseApiV2Test; | ||
|
||
class TreeTest extends BaseApiV2Test | ||
{ | ||
public function testGuest(): void | ||
{ | ||
$response = $this->getJsonWithData('Maintenance::tree', []); | ||
$this->assertUnauthorized($response); | ||
|
||
$response = $this->postJson('Maintenance::tree'); | ||
$this->assertUnauthorized($response); | ||
} | ||
|
||
public function testUser(): void | ||
{ | ||
$response = $this->actingAs($this->userLocked)->getJsonWithData('Maintenance::tree'); | ||
$this->assertForbidden($response); | ||
|
||
$response = $this->actingAs($this->userLocked)->postJson('Maintenance::tree'); | ||
$this->assertForbidden($response); | ||
} | ||
|
||
public function testAdmin(): void | ||
{ | ||
$response = $this->actingAs($this->admin)->getJsonWithData('Maintenance::tree'); | ||
$this->assertOk($response); | ||
|
||
// FIX ME: The attribute [cover_id] either does not exist or was not retrieved for model [App\Models\BaseAlbumImpl] | ||
// $response = $this->actingAs($this->admin)->postJson('Maintenance::tree'); | ||
// $this->assertCreated($response); | ||
} | ||
} |
Oops, something went wrong.