eZ\Bundle\EzPublishRestBundle\Tests\Functional\UrlAliasTest::testCreateUrlAlias PHP Method

testCreateUrlAlias() public method

public testCreateUrlAlias ( $locationHref )
    public function testCreateUrlAlias($locationHref)
    {
        $text = $this->addTestSuffix(__FUNCTION__);
        $xml = <<<XML
<?xml version="1.0" encoding="UTF-8"?>
<UrlAliasCreate type="LOCATION">
  <location href="{$locationHref}" />
  <path>/{$text}</path>
  <languageCode>eng-GB</languageCode>
  <alwaysAvailable>false</alwaysAvailable>
  <forward>true</forward>
</UrlAliasCreate>
XML;
        $request = $this->createHttpRequest('POST', '/api/ezp/v2/content/urlaliases', 'UrlAliasCreate+xml', 'UrlAlias+json');
        $request->setContent($xml);
        $response = $this->sendHttpRequest($request);
        self::assertHttpResponseCodeEquals($response, 201);
        self::assertHttpResponseHasHeader($response, 'Location');
        $href = $response->getHeader('Location');
        $this->addCreatedElement($href);
        return $href;
    }