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

testParse() public method

Tests the RoleAssignInput parser.
public testParse ( )
    public function testParse()
    {
        $limitation = ['_identifier' => 'Section', 'values' => ['ref' => [['_href' => '/content/sections/1']]]];
        $inputArray = ['Role' => ['_href' => '/user/roles/42'], 'limitation' => $limitation];
        $this->getParsingDispatcherMock()->expects($this->once())->method('parse')->with($limitation, 'application/vnd.ez.api.internal.limitation.Section')->will($this->returnValue(new SectionLimitation()));
        $roleAssignInput = $this->getParser();
        $result = $roleAssignInput->parse($inputArray, $this->getParsingDispatcherMock());
        $this->assertInstanceOf('\\eZ\\Publish\\Core\\REST\\Server\\Values\\RoleAssignment', $result, 'RoleAssignment not created correctly.');
        $this->assertEquals('42', $result->roleId, 'RoleAssignment roleId property not created correctly.');
        $this->assertInstanceOf('\\eZ\\Publish\\API\\Repository\\Values\\User\\Limitation\\RoleLimitation', $result->limitation, 'Limitation not created correctly.');
    }