/**
  * @expectedException \Oro\Bundle\EntityBundle\Exception\InvalidEntityException
  */
 public function testGetOwnerNoGetOwnerAndNoOwnerField()
 {
     $metadataProvider = new OwnershipMetadataProviderStub($this);
     $accessor = new EntityOwnerAccessor(new EntityClassAccessor(), $metadataProvider);
     $obj = new \stdClass();
     $metadataProvider->setMetadata(get_class($obj), new OwnershipMetadata('ORGANIZATION', 'owner', 'owner_id'));
     $accessor->getOwner($obj);
 }
 public function testGetOrganization()
 {
     $metadataProvider = new OwnershipMetadataProviderStub($this);
     $accessor = new EntityOwnerAccessor($metadataProvider);
     $org = new \stdClass();
     $obj = new TestEntity(1, null, $org);
     $metadataProvider->setMetadata(get_class($obj), new OwnershipMetadata(null, null, null, 'organization'));
     $this->assertSame($org, $accessor->getOrganization($obj));
 }