You are here

protected function ApiDocsJsonApi::setUp in Apigee API Catalog 8.2

Same name and namespace in other branches
  1. 8 tests/src/Functional/ApiDocsJsonApi.php \Drupal\Tests\apigee_api_catalog\Functional\ApiDocsJsonApi::setUp()

Overrides BrowserTestBase::setUp

File

tests/src/Functional/ApiDocsJsonApi.php, line 69

Class

ApiDocsJsonApi
Tests listing API Docs using JSON:API.

Namespace

Drupal\Tests\apigee_api_catalog\Functional

Code

protected function setUp() {
  parent::setUp();
  $nodeStorage = $this->container
    ->get('entity_type.manager')
    ->getStorage('node');

  // Create published apidoc.
  $this->apidocPublished = $nodeStorage
    ->create([
    'type' => 'apidoc',
    'title' => 'Published',
    'body' => [
      'value' => 'Published API',
      'format' => 'basic_html',
    ],
    'field_apidoc_spec' => NULL,
    'status' => 1,
  ]);
  $this->apidocPublished
    ->save();

  // Create unpublished apidoc.
  $this->apidocUnpublished = $nodeStorage
    ->create([
    'type' => 'apidoc',
    'title' => 'Unpublished',
    'body' => [
      'value' => 'Unpublished API',
      'format' => 'basic_html',
    ],
    'field_apidoc_spec' => NULL,
    'status' => 0,
  ]);
  $this->apidocUnpublished
    ->save();
}