koel/tests/Feature/SettingTest.php
2020-12-23 00:01:49 +01:00

29 lines
647 B
PHP

<?php
namespace Tests\Feature;
use App\Models\Setting;
use App\Models\User;
use App\Services\MediaSyncService;
class SettingTest extends TestCase
{
private $mediaSyncService;
public function setUp(): void
{
parent::setUp();
$this->mediaSyncService = self::mock(MediaSyncService::class);
}
public function testSaveSettings(): void
{
$this->mediaSyncService->shouldReceive('sync')->once();
$user = User::factory()->admin()->create();
$this->postAsUser('/api/settings', ['media_path' => __DIR__], $user);
self::assertEquals(__DIR__, Setting::get('media_path'));
}
}