* @link http://www.gediminasm.org * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ class LoggableMappingTest extends BaseTestCaseOM { /** * @var Doctrine\ORM\EntityManager */ private $em; /** * @var Gedmo\Loggable\LoggableListener */ private $loggable; public function setUp() { parent::setUp(); $reader = new AnnotationReader(); $annotationDriver = new AnnotationDriver($reader); $xmlDriver = new XmlDriver(__DIR__.'/../Driver/Xml'); $chain = new DriverChain; $chain->addDriver($annotationDriver, 'Gedmo\Loggable'); $chain->addDriver($xmlDriver, 'Mapping\Fixture\Xml'); $this->loggable = new LoggableListener; $this->evm = new EventManager; $this->evm->addEventSubscriber($this->loggable); $this->em = $this->getMockSqliteEntityManager(array( 'Gedmo\Loggable\Entity\LogEntry', 'Mapping\Fixture\Xml\Loggable', 'Mapping\Fixture\Xml\Status' ), $chain); } public function testLoggableMetadata() { $meta = $this->em->getClassMetadata('Mapping\Fixture\Xml\Loggable'); $config = $this->loggable->getConfiguration($this->em, $meta->name); $this->assertArrayHasKey('logEntryClass', $config); $this->assertEquals('Gedmo\Loggable\Entity\LogEntry', $config['logEntryClass']); $this->assertArrayHasKey('loggable', $config); $this->assertTrue($config['loggable']); $this->assertArrayHasKey('versioned', $config); $this->assertCount(2, $config['versioned']); $this->assertContains('title', $config['versioned']); $this->assertContains('status', $config['versioned']); } }