2023-08-02 12:58:07 -07:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Tests\Feature\Livewire;
|
|
|
|
|
|
|
|
use App\Http\Livewire\CategoryEditForm;
|
|
|
|
use Livewire\Livewire;
|
|
|
|
use Tests\TestCase;
|
|
|
|
|
|
|
|
class CategoryEditFormTest extends TestCase
|
|
|
|
{
|
|
|
|
public function testTheComponentCanRender()
|
|
|
|
{
|
|
|
|
Livewire::test(CategoryEditForm::class)->assertStatus(200);
|
|
|
|
}
|
2023-08-02 16:04:01 -07:00
|
|
|
|
|
|
|
public function testSendEmailCheckboxIsCheckedOnLoadWhenSendEmailIsExistingSetting()
|
|
|
|
{
|
|
|
|
Livewire::test(CategoryEditForm::class, [
|
2023-08-02 16:06:59 -07:00
|
|
|
'sendCheckInEmail' => true,
|
2023-08-02 16:04:01 -07:00
|
|
|
'eulaText' => '',
|
|
|
|
'useDefaultEula' => false,
|
2023-08-02 16:06:59 -07:00
|
|
|
])->assertSet('sendCheckInEmail', true);
|
2023-08-02 16:04:01 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testSendEmailCheckboxIsCheckedOnLoadWhenCategoryEulaSet()
|
|
|
|
{
|
|
|
|
Livewire::test(CategoryEditForm::class, [
|
2023-08-02 16:06:59 -07:00
|
|
|
'sendCheckInEmail' => false,
|
2023-08-02 16:04:01 -07:00
|
|
|
'eulaText' => 'Some Content',
|
|
|
|
'useDefaultEula' => false,
|
2023-08-02 16:06:59 -07:00
|
|
|
])->assertSet('sendCheckInEmail', true);
|
2023-08-02 16:04:01 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testSendEmailCheckboxIsCheckedOnLoadWhenUsingDefaultEula()
|
|
|
|
{
|
|
|
|
Livewire::test(CategoryEditForm::class, [
|
2023-08-02 16:06:59 -07:00
|
|
|
'sendCheckInEmail' => false,
|
2023-08-02 16:04:01 -07:00
|
|
|
'eulaText' => '',
|
|
|
|
'useDefaultEula' => true,
|
2023-08-02 16:06:59 -07:00
|
|
|
])->assertSet('sendCheckInEmail', true);
|
2023-08-02 16:04:01 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testSendEmailCheckBoxIsUncheckedOnLoadWhenSendEmailIsFalseNoCategoryEulaSetAndNotUsingDefaultEula()
|
|
|
|
{
|
|
|
|
Livewire::test(CategoryEditForm::class, [
|
2023-08-02 16:06:59 -07:00
|
|
|
'sendCheckInEmail' => false,
|
2023-08-02 16:04:01 -07:00
|
|
|
'eulaText' => '',
|
|
|
|
'useDefaultEula' => false,
|
2023-08-02 16:06:59 -07:00
|
|
|
])->assertSet('sendCheckInEmail', false);
|
2023-08-02 16:04:01 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testSendEmailCheckboxIsCheckedWhenCategoryEulaEntered()
|
|
|
|
{
|
|
|
|
Livewire::test(CategoryEditForm::class, [
|
2023-08-02 16:06:59 -07:00
|
|
|
'sendCheckInEmail' => false,
|
2023-08-02 16:04:01 -07:00
|
|
|
'useDefaultEula' => false,
|
2023-08-02 16:06:59 -07:00
|
|
|
])->assertSet('sendCheckInEmail', false)
|
2023-08-02 16:04:01 -07:00
|
|
|
->set('eulaText', 'Some Content')
|
2023-08-02 16:06:59 -07:00
|
|
|
->assertSet('sendCheckInEmail', true);
|
2023-08-02 16:04:01 -07:00
|
|
|
}
|
|
|
|
|
2023-08-02 16:18:57 -07:00
|
|
|
public function testSendEmailCheckboxCheckedAndEulaTextDisabledWhenUseDefaultEulaSelected()
|
2023-08-02 16:04:01 -07:00
|
|
|
{
|
|
|
|
Livewire::test(CategoryEditForm::class, [
|
2023-08-02 16:06:59 -07:00
|
|
|
'sendCheckInEmail' => false,
|
2023-08-02 16:04:01 -07:00
|
|
|
'useDefaultEula' => false,
|
2023-08-02 16:06:59 -07:00
|
|
|
])->assertSet('sendCheckInEmail', false)
|
2023-08-02 16:04:01 -07:00
|
|
|
->set('useDefaultEula', true)
|
2023-08-02 16:18:57 -07:00
|
|
|
->assertSet('sendCheckInEmail', true)
|
|
|
|
->assertSet('eulaTextDisabled', true);
|
2023-08-02 16:04:01 -07:00
|
|
|
}
|
2023-08-02 12:58:07 -07:00
|
|
|
}
|