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:
2022-10-17 09:52:29 +02:00
parent 71f989f00e
commit 32ddc5465c
22 changed files with 244 additions and 151 deletions

View File

@@ -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);
}
}