eZ\Publish\Core\REST\Common\Tests\Input\FieldTypeParserTest::testParseFieldValue PHP Method

testParseFieldValue() public method

public testParseFieldValue ( )
    public function testParseFieldValue()
    {
        $fieldTypeParser = $this->getFieldTypeParser();
        $this->contentServiceMock->expects($this->once())->method('loadContentInfo')->with('23')->will($this->returnValue(new ContentInfo(array('contentTypeId' => '42'))));
        $contentTypeMock = $this->contentTypeMock;
        $this->contentTypeServiceMock->expects($this->once())->method('loadContentType')->with('42')->will($this->returnCallback(function () use($contentTypeMock) {
            return $contentTypeMock;
        }));
        $contentTypeMock->expects($this->once())->method('getFieldDefinition')->with($this->equalTo('my-field-definition'))->will($this->returnValue(new FieldDefinition(array('fieldTypeIdentifier' => 'some-fancy-field-type'))));
        $this->fieldTypeProcessorRegistryMock->expects($this->once())->method('hasProcessor')->with($this->equalTo('some-fancy-field-type'))->will($this->returnValue(false));
        $fieldTypeMock = $this->fieldTypeMock;
        $this->fieldTypeServiceMock->expects($this->once())->method('getFieldType')->with($this->equalTo('some-fancy-field-type'))->will($this->returnCallback(function () use($fieldTypeMock) {
            return $fieldTypeMock;
        }));
        $fieldTypeMock->expects($this->once())->method('fromHash')->with($this->equalTo(array(1, 2, 3)))->will($this->returnValue(array('foo', 'bar')));
        $this->assertEquals(array('foo', 'bar'), $fieldTypeParser->parseFieldValue('23', 'my-field-definition', array(1, 2, 3)));
    }