コード例 #1
0
 public function testIsSupportedTargetEntityWrongEntity()
 {
     $correctTarget = new EntityConfigId('entity', 'Acme\\DemoBundle\\Entity\\CorrectEntity');
     $notCorrectTarget = new EntityConfigId('entity', 'Acme\\DemoBundle\\Entity\\NotCorrectEntity');
     $this->configManager->expects($this->once())->method('getIds')->will($this->returnValue([$correctTarget, $notCorrectTarget]));
     $testEntity = new \stdClass();
     $this->doctrineHelper->expects($this->once())->method('getEntityClass')->with($testEntity)->will($this->returnValue($notCorrectTarget->getClassName()));
     $this->assertFalse($this->provider->isSupportedTargetEntity($testEntity));
 }
コード例 #2
0
 /**
  * @param object $entity
  * @return bool
  */
 public function supportOwnerProvider($entity)
 {
     foreach ($this->emailOwnerStorage->getProviders() as $provider) {
         if ($this->activityListChainProvider->isSupportedTargetEntity($entity) && $provider->getEmailOwnerClass() === ClassUtils::getClass($entity)) {
             return true;
         }
     }
     return false;
 }