* @author Gediminas Morkevicius * @link http://www.gediminasm.org * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ class SoftDeleteableMappingTest extends BaseTestCaseOM { /** * @var Doctrine\ORM\EntityManager */ private $em; /** * @var Gedmo\SoftDeleteable\SoftDeleteableListener */ private $softDeleteable; public function setUp() { parent::setUp(); $reader = new AnnotationReader(); $annotationDriver = new AnnotationDriver($reader); $yamlDriver = new YamlDriver(__DIR__.'/Driver/Yaml'); $chain = new DriverChain; $chain->addDriver($yamlDriver, 'Mapping\Fixture\Yaml'); $chain->addDriver($annotationDriver, 'Mapping\Fixture'); $this->softDeleteable = new SoftDeleteableListener(); $this->evm = new EventManager; $this->evm->addEventSubscriber($this->softDeleteable); $this->em = $this->getMockSqliteEntityManager(array( 'Mapping\Fixture\Yaml\SoftDeleteable', 'Mapping\Fixture\SoftDeleteable' ), $chain); } public function testYamlMapping() { $meta = $this->em->getClassMetadata('Mapping\Fixture\Yaml\SoftDeleteable'); $config = $this->softDeleteable->getConfiguration($this->em, $meta->name); $this->assertArrayHasKey('softDeleteable', $config); $this->assertTrue($config['softDeleteable']); $this->assertArrayHasKey('timeAware', $config); $this->assertFalse($config['timeAware']); $this->assertArrayHasKey('fieldName', $config); $this->assertEquals('deletedAt', $config['fieldName']); } }