2021-11-19 00:15:20 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Tests\Feature\Settings;
|
|
|
|
|
|
|
|
use App\Setting\GeneralSettings;
|
|
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
|
|
use Illuminate\Foundation\Testing\WithFaker;
|
|
|
|
use Tests\TestCase;
|
|
|
|
|
|
|
|
class GlobalSettingTest extends TestCase
|
|
|
|
{
|
|
|
|
|
|
|
|
use RefreshDatabase;
|
|
|
|
|
|
|
|
public function testItLoadsGeneralSettings(): void
|
|
|
|
{
|
|
|
|
GeneralSettings::fake([
|
2021-11-23 01:02:18 +01:00
|
|
|
'modules' => ['bill'],
|
2021-11-19 00:15:20 +01:00
|
|
|
]);
|
|
|
|
$this->withoutExceptionHandling();
|
|
|
|
$this->login()->init();
|
|
|
|
|
|
|
|
$response = $this->get('/setting');
|
|
|
|
|
|
|
|
$response->assertInertiaComponent('setting/Index');
|
2021-11-19 00:39:34 +01:00
|
|
|
$this->assertEquals(['bill'], $response->inertia('general.modules'));
|
2021-11-19 00:15:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testItGetsOptionsForModels(): void
|
|
|
|
{
|
|
|
|
$this->withoutExceptionHandling();
|
|
|
|
$this->login()->init();
|
|
|
|
|
|
|
|
$response = $this->get('/setting');
|
|
|
|
|
2021-11-19 00:39:34 +01:00
|
|
|
$this->assertContains('bill', $response->inertia('options.modules'));
|
2021-11-19 00:15:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|