mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 21:34:25 +00:00
Test added for activity-social action and social issue
This commit is contained in:
parent
68aa80269f
commit
16be28681a
98
src/Bundle/ChillActivityBundle/Tests/Entity/ActivityTest.php
Normal file
98
src/Bundle/ChillActivityBundle/Tests/Entity/ActivityTest.php
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Chill is a software for social workers
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\ActivityBundle\Tests\Entity;
|
||||||
|
|
||||||
|
use Chill\ActivityBundle\Entity\Activity;
|
||||||
|
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
|
||||||
|
use Chill\PersonBundle\Entity\SocialWork\SocialIssue;
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
|
final class ActivityTest extends TestCase
|
||||||
|
{
|
||||||
|
|
||||||
|
public function testHierarchySocialActions(): void
|
||||||
|
{
|
||||||
|
$parent = new SocialAction();
|
||||||
|
$child = new SocialAction();
|
||||||
|
|
||||||
|
$parent->addChild($child);
|
||||||
|
$grandChild = new SocialAction();
|
||||||
|
$child->addChild($grandChild);
|
||||||
|
|
||||||
|
$activity = new Activity();
|
||||||
|
|
||||||
|
$activity->addSocialAction($parent);
|
||||||
|
|
||||||
|
$this->assertCount(1, $activity->getSocialActions());
|
||||||
|
$this->assertContains($parent, $activity->getSocialActions());
|
||||||
|
|
||||||
|
$activity->addSocialAction($grandChild);
|
||||||
|
|
||||||
|
$this->assertCount(1, $activity->getSocialActions());
|
||||||
|
$this->assertContains($grandChild, $activity->getSocialActions());
|
||||||
|
$this->assertNotContains($parent, $activity->getSocialActions());
|
||||||
|
|
||||||
|
$activity->addSocialAction($child);
|
||||||
|
|
||||||
|
$this->assertCount(1, $activity->getSocialActions());
|
||||||
|
$this->assertContains($grandChild, $activity->getSocialActions());
|
||||||
|
$this->assertNotContains($parent, $activity->getSocialActions());
|
||||||
|
$this->assertNotContains($child, $activity->getSocialActions());
|
||||||
|
|
||||||
|
$activity->addSocialAction($another = new SocialAction());
|
||||||
|
|
||||||
|
$this->assertCount(2, $activity->getSocialActions());
|
||||||
|
$this->assertContains($grandChild, $activity->getSocialActions());
|
||||||
|
$this->assertContains($another, $activity->getSocialActions());
|
||||||
|
$this->assertNotContains($parent, $activity->getSocialActions());
|
||||||
|
$this->assertNotContains($child, $activity->getSocialActions());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testHierarchySocialIssues(): void
|
||||||
|
{
|
||||||
|
$parent = new SocialIssue();
|
||||||
|
$child = new SocialIssue();
|
||||||
|
|
||||||
|
$parent->addChild($child);
|
||||||
|
$grandChild = new SocialIssue();
|
||||||
|
$child->addChild($grandChild);
|
||||||
|
|
||||||
|
$activity = new Activity();
|
||||||
|
|
||||||
|
$activity->addSocialIssue($parent);
|
||||||
|
|
||||||
|
$this->assertCount(1, $activity->getSocialIssues());
|
||||||
|
$this->assertContains($parent, $activity->getSocialIssues());
|
||||||
|
|
||||||
|
$activity->addSocialIssue($grandChild);
|
||||||
|
|
||||||
|
$this->assertCount(1, $activity->getSocialIssues());
|
||||||
|
$this->assertContains($grandChild, $activity->getSocialIssues());
|
||||||
|
$this->assertNotContains($parent, $activity->getSocialIssues());
|
||||||
|
|
||||||
|
$activity->addSocialIssue($child);
|
||||||
|
|
||||||
|
$this->assertCount(1, $activity->getSocialIssues());
|
||||||
|
$this->assertContains($grandChild, $activity->getSocialIssues());
|
||||||
|
$this->assertNotContains($parent, $activity->getSocialIssues());
|
||||||
|
$this->assertNotContains($child, $activity->getSocialIssues());
|
||||||
|
|
||||||
|
$activity->addSocialIssue($another = new SocialIssue());
|
||||||
|
|
||||||
|
$this->assertCount(2, $activity->getSocialIssues());
|
||||||
|
$this->assertContains($grandChild, $activity->getSocialIssues());
|
||||||
|
$this->assertContains($another, $activity->getSocialIssues());
|
||||||
|
$this->assertNotContains($parent, $activity->getSocialIssues());
|
||||||
|
$this->assertNotContains($child, $activity->getSocialIssues());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user