snipe-it/tests/Feature/Livewire/CategoryEditFormTest.php

73 lines
2.3 KiB
PHP
Raw Normal View History

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);
}
public function testSendEmailCheckboxIsCheckedOnLoadWhenSendEmailIsExistingSetting()
{
Livewire::test(CategoryEditForm::class, [
2023-08-02 16:06:59 -07:00
'sendCheckInEmail' => true,
'eulaText' => '',
'useDefaultEula' => false,
2023-08-02 16:06:59 -07:00
])->assertSet('sendCheckInEmail', true);
}
public function testSendEmailCheckboxIsCheckedOnLoadWhenCategoryEulaSet()
{
Livewire::test(CategoryEditForm::class, [
2023-08-02 16:06:59 -07:00
'sendCheckInEmail' => false,
'eulaText' => 'Some Content',
'useDefaultEula' => false,
2023-08-02 16:06:59 -07:00
])->assertSet('sendCheckInEmail', true);
}
public function testSendEmailCheckboxIsCheckedOnLoadWhenUsingDefaultEula()
{
Livewire::test(CategoryEditForm::class, [
2023-08-02 16:06:59 -07:00
'sendCheckInEmail' => false,
'eulaText' => '',
'useDefaultEula' => true,
2023-08-02 16:06:59 -07:00
])->assertSet('sendCheckInEmail', true);
}
public function testSendEmailCheckBoxIsUncheckedOnLoadWhenSendEmailIsFalseNoCategoryEulaSetAndNotUsingDefaultEula()
{
Livewire::test(CategoryEditForm::class, [
2023-08-02 16:06:59 -07:00
'sendCheckInEmail' => false,
'eulaText' => '',
'useDefaultEula' => false,
2023-08-02 16:06:59 -07:00
])->assertSet('sendCheckInEmail', false);
}
public function testSendEmailCheckboxIsCheckedWhenCategoryEulaEntered()
{
Livewire::test(CategoryEditForm::class, [
2023-08-02 16:06:59 -07:00
'sendCheckInEmail' => false,
'useDefaultEula' => false,
2023-08-02 16:06:59 -07:00
])->assertSet('sendCheckInEmail', false)
->set('eulaText', 'Some Content')
2023-08-02 16:06:59 -07:00
->assertSet('sendCheckInEmail', true);
}
public function testSendEmailCheckboxCheckedAndEulaTextDisabledWhenUseDefaultEulaSelected()
{
Livewire::test(CategoryEditForm::class, [
2023-08-02 16:06:59 -07:00
'sendCheckInEmail' => false,
'useDefaultEula' => false,
2023-08-02 16:06:59 -07:00
])->assertSet('sendCheckInEmail', false)
->set('useDefaultEula', true)
->assertSet('sendCheckInEmail', true)
->assertSet('eulaTextDisabled', true);
}
2023-08-02 12:58:07 -07:00
}