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

testCreateGlobalUrlAlias() public method

    public function testCreateGlobalUrlAlias()
    {
        $text = $this->addTestSuffix(__FUNCTION__);
        $xml = <<<XML
<?xml version="1.0" encoding="UTF-8"?>
<UrlAliasCreate type="RESOURCE">
  <resource>module:/content/search</resource>
  <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;
    }