eZ\Bundle\EzPublishRestBundle\Tests\Functional\LocationTest::testCreateLocation PHP Method

testCreateLocation() public method

public testCreateLocation ( )
    public function testCreateLocation()
    {
        $content = $this->createFolder('testCreateLocation', '/api/ezp/v2/content/locations/1/2');
        $contentHref = $content['_href'];
        $remoteId = $this->addTestSuffix('testCreatelocation');
        $body = <<<XML
<?xml version="1.0" encoding="UTF-8"?>
<LocationCreate>
  <ParentLocation href="/api/ezp/v2/content/locations/1/43" />
  <remoteId>{$remoteId}</remoteId>
  <priority>0</priority>
  <hidden>false</hidden>
  <sortField>PATH</sortField>
  <sortOrder>ASC</sortOrder>
</LocationCreate>
XML;
        $request = $this->createHttpRequest('POST', "{$contentHref}/locations", 'LocationCreate+xml', 'Location+json');
        $request->setContent($body);
        $response = $this->sendHttpRequest($request);
        self::assertHttpResponseCodeEquals($response, 201);
        self::assertHttpResponseHasHeader($response, 'Location');
        $href = $response->getHeader('Location');
        return $href;
    }