createValidLocation(['id' => 10]); $a = Location::factory()->make([ 'name' => 'Test Location', 'id' => 1, 'parent_id' => 10, ]); $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('The parent id and id must be different', $a->getErrors()); } }