mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-05 14:25:00 +00:00
review: fix stuffs on socialAction and socialIssue filters:
* filters call static entity method * add renderString option to manage add_children * add tests on new entity method getDescendantsWithThisFor..() * rename function in repository * rename 'Select2..' classes by 'Pick..' and replace all occurences
This commit is contained in:
@@ -77,4 +77,33 @@ final class SocialIssueTest extends TestCase
|
||||
|
||||
$this->assertFalse($child->isDescendantOf($grandChild));
|
||||
}
|
||||
|
||||
public function testGetDescendantsWithThisForIssues()
|
||||
{
|
||||
$parentA = new SocialIssue();
|
||||
$childA = (new SocialIssue())->setParent($parentA);
|
||||
$grandChildA = (new SocialIssue())->setParent($childA);
|
||||
$grandGrandChildA = (new SocialIssue())->setParent($grandChildA);
|
||||
$unrelatedA = new SocialIssue();
|
||||
|
||||
$parentB = new SocialIssue();
|
||||
$childB = (new SocialIssue())->setParent($parentB);
|
||||
$grandChildB = (new SocialIssue())->setParent($childB);
|
||||
$grandGrandChildB = (new SocialIssue())->setParent($grandChildB);
|
||||
$unrelatedB = new SocialIssue();
|
||||
|
||||
$actual = SocialIssue::getDescendantsWithThisForIssues([$parentA, $parentB]);
|
||||
|
||||
$this->assertContains($parentA, $actual);
|
||||
$this->assertContains($parentB, $actual);
|
||||
$this->assertContains($childA, $actual);
|
||||
$this->assertContains($childB, $actual);
|
||||
$this->assertContains($grandChildA, $actual);
|
||||
$this->assertContains($grandChildB, $actual);
|
||||
$this->assertContains($grandGrandChildA, $actual);
|
||||
$this->assertContains($grandGrandChildB, $actual);
|
||||
$this->assertCount(8, $actual);
|
||||
$this->assertNotContains($unrelatedA, $actual);
|
||||
$this->assertNotContains($unrelatedB, $actual);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user