You are here

protected function ViewsExposedGroupsTestBase::makeDefaultView in Views exposed groups 3.0.x

Creates a default view.

Return value

\Drupal\Core\Entity\EntityInterface A page displaying content in a table.

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

\Drupal\Component\Plugin\Exception\PluginNotFoundException

\Drupal\Core\Entity\EntityStorageException

1 call to ViewsExposedGroupsTestBase::makeDefaultView()
ViewsExposedGroupsTestBase::setUp in tests/src/Functional/ViewsExposedGroupsTestBase.php

File

tests/src/Functional/ViewsExposedGroupsTestBase.php, line 147

Class

ViewsExposedGroupsTestBase
Base test class for views_exposed_groups module tests.

Namespace

Drupal\Tests\views_exposed_groups\Functional

Code

protected function makeDefaultView() {
  $storage = \Drupal::entityTypeManager()
    ->getStorage('view');
  $file_storage = new FileStorage(drupal_get_path('module', 'views_exposed_groups') . '/tests/fixtures');
  $storage
    ->create($file_storage
    ->read('views.view.exposed_groups_test'))
    ->save();

  // Rebuild the router once.
  \Drupal::service('router.builder')
    ->rebuild();
  return $storage
    ->load('exposed_groups_test');
}