コード例 #1
0
 public function testIsAssociatedWithOrganizationForUserOwnedObject()
 {
     $this->buildTestTree();
     $this->metadataProvider->setMetadata('Oro\\Bundle\\SecurityBundle\\Tests\\Unit\\Acl\\Domain\\Fixtures\\Entity\\TestEntity', new OwnershipMetadata('USER', 'owner', 'owner_id', 'organization'));
     $obj = new TestEntity(1, null, $this->org1);
     $obj1 = new TestEntity(1, $this->user1, $this->org1);
     $obj2 = new TestEntity(1, $this->user2, $this->org2);
     $obj3 = new TestEntity(1, $this->user3, $this->org3);
     $obj31 = new TestEntity(1, $this->user31, $this->org3);
     $obj4 = new TestEntity(1, $this->user4, $this->org4);
     $obj411 = new TestEntity(1, $this->user411, $this->org4);
     $this->assertTrue($this->decisionMaker->isAssociatedWithOrganization($this->user1, $obj));
     $this->assertTrue($this->decisionMaker->isAssociatedWithOrganization($this->user1, $obj1));
     $this->assertFalse($this->decisionMaker->isAssociatedWithOrganization($this->user2, $obj));
     $this->assertTrue($this->decisionMaker->isAssociatedWithOrganization($this->user2, $obj2));
     $this->assertFalse($this->decisionMaker->isAssociatedWithOrganization($this->user3, $obj));
     $this->assertTrue($this->decisionMaker->isAssociatedWithOrganization($this->user3, $obj3));
     $this->assertTrue($this->decisionMaker->isAssociatedWithOrganization($this->user3, $obj31));
     $this->assertFalse($this->decisionMaker->isAssociatedWithOrganization($this->user4, $obj));
     $this->assertFalse($this->decisionMaker->isAssociatedWithOrganization($this->user4, $obj3));
     $this->assertFalse($this->decisionMaker->isAssociatedWithOrganization($this->user4, $obj31));
     $this->assertTrue($this->decisionMaker->isAssociatedWithOrganization($this->user4, $obj4));
     $this->assertTrue($this->decisionMaker->isAssociatedWithOrganization($this->user4, $obj411));
 }