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)); }
/** * @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; }