mirror of
https://github.com/AnimeThemes/animethemes-server.git
synced 2026-07-11 09:34:50 +02:00
8b6b196c99
* 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
56 lines
1.3 KiB
PHP
56 lines
1.3 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 ScriptUpdateTest.
|
|
*/
|
|
class ScriptUpdateTest extends TestCase
|
|
{
|
|
use WithoutEvents;
|
|
|
|
/**
|
|
* The Script Update Endpoint shall be protected by sanctum.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function testProtected(): void
|
|
{
|
|
$script = VideoScript::factory()->createOne();
|
|
|
|
$parameters = VideoScript::factory()->raw();
|
|
|
|
$response = $this->put(route('api.videoscript.update', ['videoscript' => $script] + $parameters));
|
|
|
|
$response->assertUnauthorized();
|
|
}
|
|
|
|
/**
|
|
* The Script Update Endpoint shall update a script.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function testUpdate(): void
|
|
{
|
|
$script = VideoScript::factory()->createOne();
|
|
|
|
$parameters = VideoScript::factory()->raw();
|
|
|
|
$user = User::factory()->withPermission('update video script')->createOne();
|
|
|
|
Sanctum::actingAs($user);
|
|
|
|
$response = $this->put(route('api.videoscript.update', ['videoscript' => $script] + $parameters));
|
|
|
|
$response->assertOk();
|
|
}
|
|
}
|