mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-11 16:14:18 -08:00
72 lines
2.2 KiB
PHP
72 lines
2.2 KiB
PHP
<?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, [
|
|
'checkinEmail' => true,
|
|
'eulaText' => '',
|
|
'useDefaultEula' => false,
|
|
])->assertSet('checkinEmail', true);
|
|
}
|
|
|
|
public function testSendEmailCheckboxIsCheckedOnLoadWhenCategoryEulaSet()
|
|
{
|
|
Livewire::test(CategoryEditForm::class, [
|
|
'checkinEmail' => false,
|
|
'eulaText' => 'Some Content',
|
|
'useDefaultEula' => false,
|
|
])->assertSet('checkinEmail', true);
|
|
}
|
|
|
|
public function testSendEmailCheckboxIsCheckedOnLoadWhenUsingDefaultEula()
|
|
{
|
|
Livewire::test(CategoryEditForm::class, [
|
|
'checkinEmail' => false,
|
|
'eulaText' => '',
|
|
'useDefaultEula' => true,
|
|
])->assertSet('checkinEmail', true);
|
|
}
|
|
|
|
public function testSendEmailCheckBoxIsUncheckedOnLoadWhenSendEmailIsFalseNoCategoryEulaSetAndNotUsingDefaultEula()
|
|
{
|
|
Livewire::test(CategoryEditForm::class, [
|
|
'checkinEmail' => false,
|
|
'eulaText' => '',
|
|
'useDefaultEula' => false,
|
|
])->assertSet('checkinEmail', false);
|
|
}
|
|
|
|
public function testSendEmailCheckboxIsCheckedWhenCategoryEulaEntered()
|
|
{
|
|
Livewire::test(CategoryEditForm::class, [
|
|
'checkinEmail' => false,
|
|
'useDefaultEula' => false,
|
|
])->assertSet('checkinEmail', false)
|
|
->set('eulaText', 'Some Content')
|
|
->assertSet('checkinEmail', true);
|
|
}
|
|
|
|
public function testSendEmailCheckboxCheckedWhenUseDefaultEulaSelected()
|
|
{
|
|
Livewire::test(CategoryEditForm::class, [
|
|
'checkinEmail' => false,
|
|
'useDefaultEula' => false,
|
|
])->assertSet('checkinEmail', false)
|
|
->set('useDefaultEula', true)
|
|
->assertSet('checkinEmail', true);
|
|
}
|
|
}
|