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

testParse() public method

Tests the ContentTypeCreate parser.
public testParse ( )
    public function testParse()
    {
        $inputArray = $this->getInputArray();
        $contentTypeCreate = $this->getParser();
        $result = $contentTypeCreate->parse($inputArray, $this->getParsingDispatcherMock());
        $this->assertInstanceOf('\\eZ\\Publish\\API\\Repository\\Values\\ContentType\\ContentTypeCreateStruct', $result, 'ContentTypeCreateStruct not created correctly.');
        $this->assertEquals('new_content_type', $result->identifier, 'identifier not created correctly');
        $this->assertEquals('eng-US', $result->mainLanguageCode, 'mainLanguageCode not created correctly');
        $this->assertEquals('remote123456', $result->remoteId, 'remoteId not created correctly');
        $this->assertEquals('<title>', $result->urlAliasSchema, 'urlAliasSchema not created correctly');
        $this->assertEquals('<title>', $result->nameSchema, 'nameSchema not created correctly');
        $this->assertEquals(true, $result->isContainer, 'isContainer not created correctly');
        $this->assertEquals(Location::SORT_FIELD_PATH, $result->defaultSortField, 'defaultSortField not created correctly');
        $this->assertEquals(Location::SORT_ORDER_ASC, $result->defaultSortOrder, 'defaultSortOrder not created correctly');
        $this->assertEquals(true, $result->defaultAlwaysAvailable, 'defaultAlwaysAvailable not created correctly');
        $this->assertEquals(array('eng-US' => 'New content type'), $result->names, 'names not created correctly');
        $this->assertEquals(array('eng-US' => 'New content type description'), $result->descriptions, 'descriptions not created correctly');
        $this->assertEquals(new \DateTime('2012-12-31T12:30:00'), $result->creationDate, 'creationDate not created correctly');
        $this->assertEquals(14, $result->creatorId, 'creatorId not created correctly');
        foreach ($result->fieldDefinitions as $fieldDefinition) {
            $this->assertInstanceOf('\\eZ\\Publish\\API\\Repository\\Values\\ContentType\\FieldDefinitionCreateStruct', $fieldDefinition, 'ContentTypeCreateStruct field definition not created correctly.');
        }
    }