mirror of
				https://github.com/kevinveenbirkenbach/infinito.git
				synced 2025-11-04 11:17:58 +00:00 
			
		
		
		
	Implemented test draft for reciever
This commit is contained in:
		@@ -6,6 +6,10 @@ use PHPUnit\Framework\TestCase;
 | 
			
		||||
use App\Entity\Meta\Reciever;
 | 
			
		||||
use App\Entity\Meta\RecieverInterface;
 | 
			
		||||
use Doctrine\Common\Collections\Collection;
 | 
			
		||||
use App\Entity\Source\Data\UserSource;
 | 
			
		||||
use App\Entity\Source\Collection\TreeCollectionSource;
 | 
			
		||||
use App\Entity\Source\Collection\TreeCollectionSourceInterface;
 | 
			
		||||
use App\Entity\Source\Data\UserSourceInterface;
 | 
			
		||||
 | 
			
		||||
class RecieverTest extends TestCase
 | 
			
		||||
{
 | 
			
		||||
@@ -25,4 +29,38 @@ class RecieverTest extends TestCase
 | 
			
		||||
        $this->expectException(\TypeError::class);
 | 
			
		||||
        $this->reciever->getRight();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function testMembersIncludingChildren(): void
 | 
			
		||||
    {
 | 
			
		||||
        /**
 | 
			
		||||
         * @var \PHPUnit\Framework\MockObject\MockObject|UserSourceInterface
 | 
			
		||||
         */
 | 
			
		||||
        $user1 = $this->createMock(UserSource::class);
 | 
			
		||||
        /**
 | 
			
		||||
         * @var \PHPUnit\Framework\MockObject\MockObject|UserSourceInterface
 | 
			
		||||
         */
 | 
			
		||||
        $user2 = $this->createMock(UserSource::class);
 | 
			
		||||
        /**
 | 
			
		||||
         * @var \PHPUnit\Framework\MockObject\MockObject|UserSourceInterface
 | 
			
		||||
         */
 | 
			
		||||
        $user3 = $this->createMock(UserSource::class);
 | 
			
		||||
        /**
 | 
			
		||||
         * @var \PHPUnit\Framework\MockObject\MockObject|TreeCollectionSourceInterface
 | 
			
		||||
         */
 | 
			
		||||
        $group1 = $this->createMock(TreeCollectionSource::class);
 | 
			
		||||
        /**
 | 
			
		||||
         * @var \PHPUnit\Framework\MockObject\MockObject|TreeCollectionSourceInterface
 | 
			
		||||
         */
 | 
			
		||||
        $group2 = $this->createMock(TreeCollectionSource::class);
 | 
			
		||||
        /**
 | 
			
		||||
         * @var \PHPUnit\Framework\MockObject\MockObject|TreeCollectionSourceInterface
 | 
			
		||||
         */
 | 
			
		||||
        $group3 = $this->createMock(TreeCollectionSource::class);
 | 
			
		||||
        $group1->getCollection()->add($user1);
 | 
			
		||||
        $group2->getCollection()->add($group1);
 | 
			
		||||
        $group2->getCollection()->add($user2);
 | 
			
		||||
        $group2->getCollection()->add($user3);
 | 
			
		||||
        $group3->getCollection()->add($group2);
 | 
			
		||||
        $this->assertEquals(6, $this->reciever->getMembersIncludingChildren()->count());
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -27,7 +27,7 @@ class RightTest extends TestCase
 | 
			
		||||
 | 
			
		||||
    public function testConstructor(): void
 | 
			
		||||
    {
 | 
			
		||||
        $this->assertEquals($this->right,$this->right->getReciever()->getRight());
 | 
			
		||||
        $this->assertEquals($this->right, $this->right->getReciever()->getRight());
 | 
			
		||||
        $this->expectException(\TypeError::class);
 | 
			
		||||
        $this->assertNull($this->right->getLaw());
 | 
			
		||||
        $this->expectException(\TypeError::class);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user