public function testChangeFieldMode()
 {
     $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->changeFieldMode(self::TEST_ENTITY, self::TEST_FIELD, ConfigModelManager::MODE_HIDDEN);
     $this->assertTrue($result);
     $this->assertEquals(ConfigModelManager::MODE_HIDDEN, $this->configModelManager->getFieldModel(self::TEST_ENTITY, self::TEST_FIELD)->getMode());
 }
예제 #2
0
 /**
  * Changes a mode of a field
  *
  * @param string $className
  * @param string $fieldName
  * @param string $mode      Can be the value of one of ConfigModel::MODE_* constants
  *
  * @return bool TRUE if the mode was changed; otherwise, FALSE
  */
 public function changeFieldMode($className, $fieldName, $mode)
 {
     return $this->modelManager->changeFieldMode($className, $fieldName, $mode);
 }