test invalid class/method
This commit is contained in:
parent
7e54ae3702
commit
917aa70c97
@ -2505,7 +2505,7 @@ class ClassMetadataInfo implements ClassMetadata
|
||||
throw MappingException::entityListenerClassNotFound($class, $this->name);
|
||||
}
|
||||
|
||||
if ( !method_exists($class, $method)) {
|
||||
if ( ! method_exists($class, $method)) {
|
||||
throw MappingException::entityListenerMethodNotFound($class, $method, $this->name);
|
||||
}
|
||||
|
||||
|
@ -997,6 +997,34 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
||||
|
||||
$cm->setAttributeOverride('name', array('type'=>'date'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @group DDC-1955
|
||||
*
|
||||
* @expectedException Doctrine\ORM\Mapping\MappingException
|
||||
* @expectedExceptionMessage Entity Listener "\InvalidClassName" declared on "Doctrine\Tests\Models\CMS\CmsUser" not found.
|
||||
*/
|
||||
public function testInvalidEntityListenerClassException()
|
||||
{
|
||||
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
||||
|
||||
$cm->addEntityListener(Events::postLoad, '\InvalidClassName', 'postLoadHandler');
|
||||
}
|
||||
|
||||
/**
|
||||
* @group DDC-1955
|
||||
*
|
||||
* @expectedException Doctrine\ORM\Mapping\MappingException
|
||||
* @expectedExceptionMessage Entity Listener "\Doctrine\Tests\Models\Company\ContractSubscriber" declared on "Doctrine\Tests\Models\CMS\CmsUser" has no method "invalidMethod".
|
||||
*/
|
||||
public function testInvalidEntityListenerMethodException()
|
||||
{
|
||||
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
||||
|
||||
$cm->addEntityListener(Events::postLoad, '\Doctrine\Tests\Models\Company\ContractSubscriber', 'invalidMethod');
|
||||
}
|
||||
}
|
||||
|
||||
class MyNamespacedNamingStrategy extends \Doctrine\ORM\Mapping\DefaultNamingStrategy
|
||||
|
Loading…
Reference in New Issue
Block a user