function ModuleTest::testStatusFunctions

Same name in other branches
  1. 8.9.x core/modules/views/tests/src/Kernel/ModuleTest.php \Drupal\Tests\views\Kernel\ModuleTest::testStatusFunctions()
  2. 10 core/modules/views/tests/src/Kernel/ModuleTest.php \Drupal\Tests\views\Kernel\ModuleTest::testStatusFunctions()
  3. 11.x core/modules/views/tests/src/Kernel/ModuleTest.php \Drupal\Tests\views\Kernel\ModuleTest::testStatusFunctions()

Tests view enable and disable procedural wrapper functions.

File

core/modules/views/tests/src/Kernel/ModuleTest.php, line 188

Class

ModuleTest
Tests basic functions from the Views module.

Namespace

Drupal\Tests\views\Kernel

Code

public function testStatusFunctions() {
    $view = Views::getView('test_view_status')->storage;
    $this->assertFalse($view->status(), 'The view status is disabled.');
    views_enable_view($view);
    $this->assertTrue($view->status(), 'A view has been enabled.');
    $this->assertEquals(views_view_is_enabled($view), $view->status(), 'views_view_is_enabled is correct.');
    views_disable_view($view);
    $this->assertFalse($view->status(), 'A view has been disabled.');
    $this->assertEquals(views_view_is_disabled($view), !$view->status(), 'views_view_is_disabled is correct.');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.