You are here

protected function ViewStorageTest::statusTests in Views (for Drupal 7) 8.3

Tests statuses of configuration entities.

1 call to ViewStorageTest::statusTests()
ViewStorageTest::testConfigurationEntityCRUD in lib/Drupal/views/Tests/ViewStorageTest.php
Tests CRUD operations.

File

lib/Drupal/views/Tests/ViewStorageTest.php, line 266
Definition of Drupal\views\Tests\ViewStorageTest.

Class

ViewStorageTest
Tests the functionality of ViewStorage and ViewStorageController.

Namespace

Drupal\views\Tests

Code

protected function statusTests() {

  // Test a View can be enabled and disabled again (with a new view).
  $view = $this
    ->loadView('backlinks');

  // The view should already be disabled.
  $view
    ->enable();
  $this
    ->assertTrue($view
    ->isEnabled(), 'A view has been enabled.');

  // Check the saved values.
  $view
    ->save();
  $config = config('views.view.backlinks')
    ->get();
  $this
    ->assertFalse($config['disabled'], 'The changed disabled property was saved.');

  // Disable the view.
  $view
    ->disable();
  $this
    ->assertFalse($view
    ->isEnabled(), 'A view has been disabled.');

  // Check the saved values.
  $view
    ->save();
  $config = config('views.view.backlinks')
    ->get();
  $this
    ->assertTrue($config['disabled'], 'The changed disabled property was saved.');
}