function ConfigEntityStatusUITest::testCRUD

Tests status operations.

File

drupal/core/modules/config/lib/Drupal/config/Tests/ConfigEntityStatusUITest.php, line 36
Contains \Drupal\config\Tests\ConfigEntityStatusUITest.

Class

ConfigEntityStatusUITest
Tests configuration entity status UI functionality.

Namespace

Drupal\config\Tests

Code

function testCRUD() {
  $id = strtolower($this
    ->randomName());
  $edit = array(
    'id' => $id,
    'label' => $this
      ->randomName(),
  );
  $this
    ->drupalPost('admin/structure/config_test/add', $edit, 'Save');
  $uri = entity_load('config_test', $id)
    ->uri();

  // Disable an entity.
  $disable_path = "{$uri['path']}/disable";
  $this
    ->assertLinkByHref($disable_path);
  $this
    ->drupalGet($disable_path);
  $this
    ->assertResponse(200);
  $this
    ->assertNoLinkByHref($disable_path);

  // Enable an entity.
  $enable_path = "{$uri['path']}/enable";
  $this
    ->assertLinkByHref($enable_path);
  $this
    ->drupalGet($enable_path);
  $this
    ->assertResponse(200);
  $this
    ->assertNoLinkByHref($enable_path);
}