mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
check for ancestors when validating the presence of accompanying
period's social issues
This commit is contained in:
@@ -39,6 +39,22 @@ final class SocialIssueTest extends TestCase
|
||||
$this->assertContains($grandChild, $ancestors);
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
public function testIsDescendantOf()
|
||||
{
|
||||
$parent = new SocialIssue();
|
||||
@@ -61,20 +77,4 @@ 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