mirror of
https://github.com/koel/koel
synced 2024-11-12 23:47:09 +00:00
31 lines
770 B
PHP
31 lines
770 B
PHP
<?php
|
|
|
|
namespace Tests\Feature;
|
|
|
|
use App\Models\Setting;
|
|
use App\Models\User;
|
|
use App\Services\MediaSyncService;
|
|
use Mockery\MockInterface;
|
|
|
|
class SettingTest extends TestCase
|
|
{
|
|
/** @var MockInterface */
|
|
private $mediaSyncService;
|
|
|
|
public function setUp()
|
|
{
|
|
parent::setUp();
|
|
$this->mediaSyncService = $this->mockIocDependency(MediaSyncService::class);
|
|
}
|
|
|
|
public function testSaveSettings()
|
|
{
|
|
$this->mediaSyncService->shouldReceive('sync')->once();
|
|
|
|
$user = factory(User::class, 'admin')->create();
|
|
file_put_contents('log', $this->postAsUser('/api/settings', ['media_path' => __DIR__], $user)
|
|
->response->content());
|
|
|
|
self::assertEquals(__DIR__, Setting::get('media_path'));
|
|
}
|
|
}
|