mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 15:13:50 +00:00
fix validator for taking ancestors into account
This commit is contained in:
@@ -61,4 +61,20 @@ final class SocialIssueTest extends TestCase
|
||||
|
||||
$this->assertFalse($child->isDescendantOf($grandChild));
|
||||
}
|
||||
|
||||
public function testGetAncestors()
|
||||
{
|
||||
$parent = new SocialIssue();
|
||||
$child = (new SocialIssue())->setParent($parent);
|
||||
$grandChild = (new SocialIssue())->setParent($child);
|
||||
$grandGrandChild = (new SocialIssue())->setParent($grandChild);
|
||||
$unrelated = new SocialIssue();
|
||||
|
||||
$this->assertContains($parent, $grandGrandChild->getAncestors(true));
|
||||
$this->assertContains($child, $grandGrandChild->getAncestors(true));
|
||||
$this->assertContains($grandChild, $grandGrandChild->getAncestors(true));
|
||||
$this->assertContains($grandGrandChild, $grandGrandChild->getAncestors(true));
|
||||
$this->assertNotContains($grandGrandChild, $grandGrandChild->getAncestors(false));
|
||||
$this->assertCount(0, $unrelated->getAncestors(false));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user