2015-12-13 04:42:28 +00:00
|
|
|
<?php
|
|
|
|
|
2017-02-14 06:53:02 +00:00
|
|
|
namespace Tests\Feature;
|
|
|
|
|
2015-12-13 04:42:28 +00:00
|
|
|
use App\Models\Setting;
|
2016-05-30 05:52:02 +00:00
|
|
|
use App\Models\User;
|
2018-08-19 15:26:34 +00:00
|
|
|
use App\Services\MediaSyncService;
|
2015-12-13 04:42:28 +00:00
|
|
|
|
2017-08-05 16:56:11 +00:00
|
|
|
class SettingTest extends TestCase
|
2015-12-13 04:42:28 +00:00
|
|
|
{
|
2018-08-19 15:26:34 +00:00
|
|
|
private $mediaSyncService;
|
|
|
|
|
2019-07-22 07:03:23 +00:00
|
|
|
public function setUp(): void
|
2018-08-19 15:26:34 +00:00
|
|
|
{
|
|
|
|
parent::setUp();
|
2020-11-14 16:57:25 +00:00
|
|
|
|
2020-12-22 23:01:49 +00:00
|
|
|
$this->mediaSyncService = self::mock(MediaSyncService::class);
|
2018-08-19 15:26:34 +00:00
|
|
|
}
|
|
|
|
|
2019-07-22 07:03:23 +00:00
|
|
|
public function testSaveSettings(): void
|
2016-05-27 09:07:52 +00:00
|
|
|
{
|
2018-08-19 15:26:34 +00:00
|
|
|
$this->mediaSyncService->shouldReceive('sync')->once();
|
2016-05-27 09:07:52 +00:00
|
|
|
|
2020-11-14 16:57:25 +00:00
|
|
|
$user = User::factory()->admin()->create();
|
2020-09-06 18:21:39 +00:00
|
|
|
$this->postAsUser('/api/settings', ['media_path' => __DIR__], $user);
|
2016-05-27 09:07:52 +00:00
|
|
|
|
2018-08-24 15:27:19 +00:00
|
|
|
self::assertEquals(__DIR__, Setting::get('media_path'));
|
2016-05-27 09:07:52 +00:00
|
|
|
}
|
2015-12-13 04:42:28 +00:00
|
|
|
}
|