You are here

public function JsonApiExtrasFunctionalTest::testDisabledResourcesShowInAdminList in JSON:API Extras 8.3

Test disabled resource show in admin list.

File

tests/src/Functional/JsonApiExtrasFunctionalTest.php, line 660

Class

JsonApiExtrasFunctionalTest
The test class for the main functionality.

Namespace

Drupal\Tests\jsonapi_extras\Functional

Code

public function testDisabledResourcesShowInAdminList() {
  $vocabulary = Vocabulary::create([
    'name' => $this
      ->randomMachineName(),
    'vid' => mb_strtolower($this
      ->randomMachineName()),
  ]);
  $vocabulary
    ->save();
  $admin_user = $this
    ->createUser([], 'test_admin_user', TRUE);
  $this
    ->drupalLogin($admin_user);
  $this
    ->drupalGet('/admin/config/services/jsonapi/resource_types');
  $this
    ->assertSession()
    ->elementContains('css', '#jsonapi-enabled-resources-list', 'taxonomy_term--' . $vocabulary
    ->id());
  $this
    ->drupalGet('/admin/config/services/jsonapi/add/resource_types/taxonomy_term/' . $vocabulary
    ->id());
  $this
    ->getSession()
    ->getPage()
    ->checkField('edit-disabled');
  $this
    ->getSession()
    ->getPage()
    ->pressButton('edit-submit');
  $this
    ->assertSession()
    ->elementContains('css', '#jsonapi-disabled-resources-list', 'taxonomy_term--' . $vocabulary
    ->id());
}