You are here

public function FieldCounterTest::testExcludedTitleTokenDisplay in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/rest/tests/src/Functional/Views/FieldCounterTest.php \Drupal\Tests\rest\Functional\Views\FieldCounterTest::testExcludedTitleTokenDisplay()

Tests the display of an excluded title field when used as a token.

File

core/modules/rest/tests/src/Functional/Views/FieldCounterTest.php, line 73

Class

FieldCounterTest
Tests the display of counter field.

Namespace

Drupal\Tests\rest\Functional\Views

Code

public function testExcludedTitleTokenDisplay() {
  $actual_json = $this
    ->drupalGet($this->view
    ->getPath(), [
    'query' => [
      '_format' => 'json',
    ],
  ]);
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $expected = [
    [
      'counter' => '1',
    ],
    [
      'counter' => '2',
    ],
    [
      'counter' => '3',
    ],
    [
      'counter' => '4',
    ],
    [
      'counter' => '5',
    ],
    [
      'counter' => '6',
    ],
    [
      'counter' => '7',
    ],
    [
      'counter' => '8',
    ],
    [
      'counter' => '9',
    ],
    [
      'counter' => '10',
    ],
  ];
  $this
    ->assertSame(json_encode($expected), $actual_json);
}