eZ\Bundle\EzPublishRestBundle\Tests\Functional\ContentTypeTest::testAddContentTypeDraftFieldDefinition PHP Метод

testAddContentTypeDraftFieldDefinition() публичный Метод

public testAddContentTypeDraftFieldDefinition ( $contentTypeDraftHref ) : string
Результат string The content type draft field definition href
    public function testAddContentTypeDraftFieldDefinition($contentTypeDraftHref)
    {
        $body = <<<XML
<?xml version="1.0" encoding="UTF-8"?>
<FieldDefinition>
      <identifier>secondtext</identifier>
      <fieldType>ezstring</fieldType>
      <fieldGroup>content</fieldGroup>
      <position>1</position>
      <isTranslatable>true</isTranslatable>
      <isRequired>true</isRequired>
      <isInfoCollector>false</isInfoCollector>
      <defaultValue>Second text</defaultValue>
      <isSearchable>true</isSearchable>
      <names>
        <value languageCode="eng-GB">Second text</value>
      </names>
    </FieldDefinition>
XML;
        $request = $this->createHttpRequest('POST', "{$contentTypeDraftHref}/fieldDefinitions", 'FieldDefinitionCreate+xml', 'FieldDefinition+json');
        $request->setContent($body);
        $response = $this->sendHttpRequest($request);
        self::assertHttpResponseCodeEquals($response, 201);
        self::assertHttpResponseHasHeader($response, 'Location');
        return $response->getHeader('Location');
    }