Files
animethemes-server/tests/Feature/Http/Api/Wiki/Video/Script/ScriptForceDeleteTest.php
T
paranarimasu 8b6b196c99 feat(admin): migrate db dumps from github to platform (#465)
* feat: migrate encoding scripts from github to platform

* style: fix StyleCI finding

* fix: don't concatenate updated videos when attempting to attach entry on video upload

* fix(api): fix field dependencies & feat(admin): upload script from video detail screen
2022-09-24 00:01:37 -05:00

53 lines
1.2 KiB
PHP

<?php
declare(strict_types=1);
namespace Tests\Feature\Http\Api\Wiki\Video\Script;
use App\Models\Auth\User;
use App\Models\Wiki\Video\VideoScript;
use Illuminate\Foundation\Testing\WithoutEvents;
use Laravel\Sanctum\Sanctum;
use Tests\TestCase;
/**
* Class ScriptForceDeleteTest.
*/
class ScriptForceDeleteTest extends TestCase
{
use WithoutEvents;
/**
* The Script Force Destroy Endpoint shall be protected by sanctum.
*
* @return void
*/
public function testProtected(): void
{
$script = VideoScript::factory()->createOne();
$response = $this->delete(route('api.videoscript.forceDelete', ['videoscript' => $script]));
$response->assertUnauthorized();
}
/**
* The Script Force Destroy Endpoint shall force delete the script.
*
* @return void
*/
public function testDeleted(): void
{
$script = VideoScript::factory()->createOne();
$user = User::factory()->withPermission('force delete video script')->createOne();
Sanctum::actingAs($user);
$response = $this->delete(route('api.videoscript.forceDelete', ['videoscript' => $script]));
$response->assertOk();
static::assertModelMissing($script);
}
}