/** * Get handler with required custom field types registered. * * @return \eZ\Publish\SPI\Persistence\Handler */ public function getCustomHandler() { $contentService = $this->getMockBuilder('eZ\\Publish\\Core\\Repository\\ContentService')->disableOriginalConstructor()->getMock(); $pageService = new FieldType\Page\PageService($contentService); $hashConverter = new FieldType\Page\HashConverter(); $fieldType = new FieldType\Page\Type($pageService, $hashConverter); $fieldType->setTransformationProcessor($this->getTransformationProcessor()); return $this->getHandler('ezpage', $fieldType, new Legacy\Content\FieldValue\Converter\PageConverter(), new FieldType\NullStorage()); }
/** * Creates a value object to use as the field value when setting an ez page field type. * * @param array $fieldValueArray The definition of teh field value, structured in the yml file * @param array $context The context for execution of the current migrations. Contains f.e. the path to the migration * @return PageValue */ public function createValue($fieldValueArray, array $context = array()) { $layout = $fieldValueArray['layout']; $hashConverter = new HashConverter(); $pageType = new PageType($this->pageService, $hashConverter); /** @var PageValue $pageValue */ $pageValue = $pageType->getEmptyValue(); $pageValue->page = new Page(array('zones' => array(), 'zonesById' => array(), 'layout' => $layout)); return $pageValue; }
/** * Returns the field type under test. * * This method is used by all test cases to retrieve the field type under * test. Just create the FieldType instance using mocks from the provided * get*Mock() methods and/or custom get*Mock() implementations. You MUST * NOT take care for test case wide caching of the field type, just return * a new instance from this method! * * @return FieldType */ protected function createFieldTypeUnderTest() { $fieldType = new PageType($this->getPageServiceMock(), new HashConverter()); $fieldType->setTransformationProcessor($this->getTransformationProcessorMock()); return $fieldType; }