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

testParse() public method

Tests the UserCreate parser.
public testParse ( )
    public function testParse()
    {
        $inputArray = array('ContentType' => array('_href' => '/content/types/4'), 'mainLanguageCode' => 'eng-US', 'Section' => array('_href' => '/content/sections/4'), 'remoteId' => 'remoteId12345678', 'login' => 'login', 'email' => '[email protected]', 'password' => 'password', 'enabled' => 'true', 'fields' => array('field' => array(array('fieldDefinitionIdentifier' => 'name', 'fieldValue' => array()))));
        $userCreate = $this->getParser();
        $result = $userCreate->parse($inputArray, $this->getParsingDispatcherMock());
        $this->assertInstanceOf('\\eZ\\Publish\\API\\Repository\\Values\\User\\UserCreateStruct', $result, 'UserCreateStruct not created correctly.');
        $this->assertInstanceOf('\\eZ\\Publish\\API\\Repository\\Values\\ContentType\\ContentType', $result->contentType, 'contentType not created correctly.');
        $this->assertEquals(4, $result->contentType->id, 'contentType not created correctly');
        $this->assertEquals('eng-US', $result->mainLanguageCode, 'mainLanguageCode not created correctly');
        $this->assertEquals(4, $result->sectionId, 'sectionId not created correctly');
        $this->assertEquals('remoteId12345678', $result->remoteId, 'remoteId not created correctly');
        foreach ($result->fields as $field) {
            $this->assertEquals('foo', $field->value, 'field value not created correctly');
        }
    }