public function testAddedOptions() { $this->metadata->expects($this->once())->method('getTableName')->will($this->returnValue(IndexText::TABLE_NAME)); $this->event->expects($this->once())->method('getClassMetadata')->will($this->returnValue($this->metadata)); $this->listener->loadClassMetadata($this->event); $this->assertEquals(['options' => ['engine' => PdoMysql::ENGINE_MYISAM], 'indexes' => ['value' => ['columns' => ['value']]]], $this->metadata->table); }
protected function setUp() { $this->classMetadata = $this->getMockBuilder('Doctrine\\ORM\\Mapping\\ClassMetadataInfo')->disableOriginalConstructor()->setMethods(array('getSingleIdentifierFieldName'))->getMock(); $this->classMetadata->expects($this->any())->method('getSingleIdentifierFieldName')->will($this->returnValue(self::TEST_IDENTIFIER)); $this->ormConfiguration = $this->getMockBuilder('Doctrine\\ORM\\Configuration')->disableOriginalConstructor()->setMethods(array('addCustomHydrationMode'))->getMock(); $this->entityManager = $this->getMockBuilder('Doctrine\\ORM\\EntityManager')->disableOriginalConstructor()->setMethods(array('getClassMetadata', 'getConfiguration'))->getMock(); $this->entityManager->expects($this->any())->method('getClassMetadata')->with(self::TEST_CLASS)->will($this->returnValue($this->classMetadata)); $this->entityManager->expects($this->any())->method('getConfiguration')->will($this->returnValue($this->ormConfiguration)); $this->registry = $this->getMockBuilder('Doctrine\\Common\\Persistence\\ManagerRegistry')->disableOriginalConstructor()->setMethods('getManager', 'getRepository')->getMockForAbstractClass(); $this->registry->expects($this->any())->method('getManager')->will($this->returnValue($this->entityManager)); $this->registry->expects($this->any())->method('getRepository')->with(self::TEST_CLASS)->will($this->returnValue($this->getEntityRepository())); $this->type = new TranslatableEntityType($this->registry); }
public function test_a_custom_strategy_with_the_implementation_can_be_set_afterwards() { $this->field->expects($this->once())->method('generatedValue')->with('CUSTOM'); $this->cm->expects($this->once())->method('setCustomGeneratorDefinition')->with(['class' => 'A\\Class\\Implementing\\AbstractIdGenerator']); $this->fluent->custom('A\\Class\\Implementing\\AbstractIdGenerator')->build(); }