1
0
mirror of synced 2024-12-15 07:36:03 +03:00

test invalid class/method

This commit is contained in:
Fabio B. Silva 2012-08-04 18:02:32 -03:00 committed by fabio.silva
parent 7e54ae3702
commit 917aa70c97
2 changed files with 29 additions and 1 deletions

View File

@ -997,6 +997,34 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
$cm->setAttributeOverride('name', array('type'=>'date')); $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 class MyNamespacedNamingStrategy extends \Doctrine\ORM\Mapping\DefaultNamingStrategy