You are here

public function JsonApiFunctionalTest::testReferencingTwiceRead in Drupal 9

Same name and namespace in other branches
  1. 8 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 521

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');
}