3
0
mirror of https://github.com/snipe/snipe-it.git synced 2026-02-07 03:25:45 +00:00
Files
snipe-it/tests/Unit/LocationTest.php
Marcus Moore 82e795b642 Revert "Add return types to test methods"
This reverts commit 83fb6826ee.
2024-08-06 13:30:34 -07:00

32 lines
783 B
PHP

<?php
namespace Tests\Unit;
use App\Models\Location;
use Tests\TestCase;
final class LocationTest extends TestCase
{
public function testPassesIfNotSelfParent()
{
$a = Location::factory()->make([
'name' => 'Test Location',
'id' => 1,
'parent_id' => Location::factory()->create(['id' => 10])->id,
]);
$this->assertTrue($a->isValid());
}
public function testFailsIfSelfParent()
{
$a = Location::factory()->make([
'name' => 'Test Location',
'id' => 1,
'parent_id' => 1,
]);
$this->assertFalse($a->isValid());
$this->assertStringContainsString(trans('validation.non_circular', ['attribute' => 'parent id']), $a->getErrors());
}
}