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

testParse() public method

Tests the UserUpdate parser.
public testParse ( )
    public function testParse()
    {
        $inputArray = array('mainLanguageCode' => 'eng-US', 'Section' => array('_href' => '/content/sections/1'), 'remoteId' => 'remoteId123456', 'fields' => array('field' => array(array('fieldDefinitionIdentifier' => 'first_name', 'fieldValue' => array()))), 'email' => '[email protected]', 'password' => 'somePassword', 'enabled' => 'true', '__url' => '/user/users/14');
        $userUpdate = $this->getParser();
        $result = $userUpdate->parse($inputArray, $this->getParsingDispatcherMock());
        $this->assertInstanceOf('\\eZ\\Publish\\Core\\REST\\Server\\Values\\RestUserUpdateStruct', $result, 'UserUpdate not created correctly.');
        $this->assertInstanceOf('\\eZ\\Publish\\API\\Repository\\Values\\Content\\ContentUpdateStruct', $result->userUpdateStruct->contentUpdateStruct, 'UserUpdate not created correctly.');
        $this->assertInstanceOf('\\eZ\\Publish\\API\\Repository\\Values\\Content\\ContentMetadataUpdateStruct', $result->userUpdateStruct->contentMetadataUpdateStruct, 'UserUpdate not created correctly.');
        $this->assertEquals(1, $result->sectionId, 'sectionId not created correctly');
        $this->assertEquals('eng-US', $result->userUpdateStruct->contentMetadataUpdateStruct->mainLanguageCode, 'mainLanguageCode not created correctly');
        $this->assertEquals('remoteId123456', $result->userUpdateStruct->contentMetadataUpdateStruct->remoteId, 'remoteId not created correctly');
        $this->assertEquals('[email protected]', $result->userUpdateStruct->email, 'email not created correctly');
        $this->assertEquals('somePassword', $result->userUpdateStruct->password, 'password not created correctly');
        $this->assertEquals(true, $result->userUpdateStruct->enabled, 'enabled not created correctly');
        foreach ($result->userUpdateStruct->contentUpdateStruct->fields as $field) {
            $this->assertEquals('foo', $field->value, 'field value not created correctly');
        }
    }