eZ\Publish\Core\REST\Server\Tests\Input\Parser\ContentUpdateTest::testParseFailureInvalidHref PHP Method

testParseFailureInvalidHref() public method

Tests that invalid _href attribute throw the appropriate exception.
public testParseFailureInvalidHref ( $element, $exceptionMessage )
    public function testParseFailureInvalidHref($element, $exceptionMessage)
    {
        $inputArray = $this->getValidInputData();
        $inputArray[$element]['_href'] = '/invalid/section/uri';
        $contentUpdateParser = $this->getParser();
        try {
            $contentUpdateParser->parse($inputArray, $this->getParsingDispatcherMock());
        } catch (Parser $e) {
            if ($e->getMessage() != $exceptionMessage) {
                self::fail("Failed asserting that exception message '" . $e->getMessage() . "' contains '{$exceptionMessage}'.");
            }
            $exceptionThrown = true;
        }
        if (!isset($exceptionThrown)) {
            self::fail('Failed asserting that exception of type "\\eZ\\Publish\\Core\\REST\\Common\\Exceptions\\Parser" is thrown.');
        }
    }