public function testChangeFieldType() { $entityModel = $this->createEntityModel(self::TEST_ENTITY); $fieldModel = $this->createFieldModel($entityModel, self::TEST_FIELD); $this->createRepositoryMock([$entityModel], [UnitOfWork::STATE_MANAGED, UnitOfWork::STATE_MANAGED, UnitOfWork::STATE_MANAGED]); $this->em->expects($this->once())->method('persist')->with($this->equalTo($fieldModel)); $this->em->expects($this->never())->method('flush'); $result = $this->configModelManager->changeFieldType(self::TEST_ENTITY, self::TEST_FIELD, 'int'); $this->assertTrue($result); $this->assertEquals('int', $this->configModelManager->getFieldModel(self::TEST_ENTITY, self::TEST_FIELD)->getType()); }
/** * Changes a type of a field * * @param string $className * @param string $fieldName * @param string $fieldType * * @return bool TRUE if the type was changed; otherwise, FALSE */ public function changeFieldType($className, $fieldName, $fieldType) { return $this->modelManager->changeFieldType($className, $fieldName, $fieldType); }