eZ\Publish\Core\REST\Server\Tests\Input\Parser\ContentCreateTest::testParse PHP Method

testParse() public method

Tests the ContentCreate parser.
public testParse ( )
    public function testParse()
    {
        $inputArray = array('ContentType' => array('_href' => '/content/types/13'), 'mainLanguageCode' => 'eng-US', 'LocationCreate' => array(), 'Section' => array('_href' => '/content/sections/4'), 'alwaysAvailable' => 'true', 'remoteId' => 'remoteId12345678', 'User' => array('_href' => '/user/users/14'), 'fields' => array('field' => array(array('fieldDefinitionIdentifier' => 'subject', 'fieldValue' => array()), array('fieldDefinitionIdentifier' => 'author', 'fieldValue' => array()))));
        $contentCreate = $this->getParser();
        $result = $contentCreate->parse($inputArray, $this->getParsingDispatcherMock());
        $this->assertInstanceOf('\\eZ\\Publish\\Core\\REST\\Server\\Values\\RestContentCreateStruct', $result, 'ContentCreate not created correctly.');
        $this->assertInstanceOf('\\eZ\\Publish\\API\\Repository\\Values\\Content\\ContentCreateStruct', $result->contentCreateStruct, 'contentCreateStruct not created correctly.');
        $this->assertInstanceOf('\\eZ\\Publish\\API\\Repository\\Values\\ContentType\\ContentType', $result->contentCreateStruct->contentType, 'contentType not created correctly.');
        $this->assertEquals(13, $result->contentCreateStruct->contentType->id, 'contentType not created correctly');
        $this->assertEquals('eng-US', $result->contentCreateStruct->mainLanguageCode, 'mainLanguageCode not created correctly');
        $this->assertInstanceOf('\\eZ\\Publish\\API\\Repository\\Values\\Content\\LocationCreateStruct', $result->locationCreateStruct, 'locationCreateStruct not created correctly.');
        $this->assertEquals(4, $result->contentCreateStruct->sectionId, 'sectionId not created correctly');
        $this->assertEquals(true, $result->contentCreateStruct->alwaysAvailable, 'alwaysAvailable not created correctly');
        $this->assertEquals('remoteId12345678', $result->contentCreateStruct->remoteId, 'remoteId not created correctly');
        $this->assertEquals(14, $result->contentCreateStruct->ownerId, 'ownerId not created correctly');
        foreach ($result->contentCreateStruct->fields as $field) {
            $this->assertEquals('foo', $field->value, 'field value not created correctly');
        }
    }