2021-11-19 00:15:20 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Tests\Feature\Settings;
|
|
|
|
|
|
|
|
use App\Setting\GeneralSettings;
|
2022-02-12 01:08:56 +01:00
|
|
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
2021-11-19 00:15:20 +01:00
|
|
|
use Illuminate\Foundation\Testing\WithFaker;
|
|
|
|
use Tests\TestCase;
|
|
|
|
|
|
|
|
class GlobalSettingTest extends TestCase
|
|
|
|
{
|
|
|
|
|
2022-02-12 01:08:56 +01:00
|
|
|
use DatabaseTransactions;
|
2021-11-19 00:15:20 +01:00
|
|
|
|
|
|
|
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');
|
|
|
|
|
2022-02-12 00:41:52 +01:00
|
|
|
$this->assertComponent('setting/Index', $response);
|
|
|
|
$this->assertEquals(['bill'], $this->inertia($response, 'general.modules'));
|
2021-11-19 00:15:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testItGetsOptionsForModels(): void
|
|
|
|
{
|
|
|
|
$this->withoutExceptionHandling();
|
|
|
|
$this->login()->init();
|
|
|
|
|
|
|
|
$response = $this->get('/setting');
|
|
|
|
|
2022-02-12 00:41:52 +01:00
|
|
|
$this->assertContains('bill', $this->inertia($response, 'options.modules'));
|
2021-11-19 00:15:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|