function JsonApiFunctionalTest::testReferencingTwiceRead

Same name in other branches
  1. 8.9.x core/modules/jsonapi/tests/src/Functional/JsonApiFunctionalTest.php \Drupal\Tests\jsonapi\Functional\JsonApiFunctionalTest::testReferencingTwiceRead()
  2. 10 core/modules/jsonapi/tests/src/Functional/JsonApiFunctionalTest.php \Drupal\Tests\jsonapi\Functional\JsonApiFunctionalTest::testReferencingTwiceRead()
  3. 11.x core/modules/jsonapi/tests/src/Functional/JsonApiFunctionalTest.php \Drupal\Tests\jsonapi\Functional\JsonApiFunctionalTest::testReferencingTwiceRead()

Tests the GET method on articles referencing the same tag twice.

File

core/modules/jsonapi/tests/src/Functional/JsonApiFunctionalTest.php, line 554

Class

JsonApiFunctionalTest
General functional test class.

Namespace

Drupal\Tests\jsonapi\Functional

Code

public function testReferencingTwiceRead() {
    $this->createDefaultContent(1, 1, FALSE, FALSE, static::IS_NOT_MULTILINGUAL, TRUE);
    // 1. Load all articles (1st page).
    $collection_output = Json::decode($this->drupalGet('/jsonapi/node/article'));
    $this->assertSession()
        ->statusCodeEquals(200);
    $this->assertCount(1, $collection_output['data']);
    $this->assertSession()
        ->responseHeaderEquals('Content-Type', 'application/vnd.api+json');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.