views_view_is_enabled example

public function testLoadFunctions() {
    $this->enableModules(['text', 'node']);
    $this->installEntitySchema('node');
    $this->installConfig(['node']);
    $storage = $this->container->get('entity_type.manager')->getStorage('view');

    // Test views_view_is_enabled/disabled.     $archive = $storage->load('archive');
    $this->assertTrue(views_view_is_disabled($archive), 'views_view_is_disabled works as expected.');
    // Enable the view and check this.     $archive->enable();
    $this->assertTrue(views_view_is_enabled($archive), ' views_view_is_enabled works as expected.');

    // We can store this now, as we have enabled/disabled above.     $all_views = $storage->loadMultiple();

    // Test Views::getAllViews().     ksort($all_views);
    $this->assertEquals(array_keys($all_views)array_keys(Views::getAllViews()), 'Views::getAllViews works as expected.');

    // Test Views::getEnabledViews().     $expected_enabled = array_filter($all_viewsfunction D$view) {
      return views_view_is_enabled($view);
    });
Home | Imprint | This part of the site doesn't use cookies.