You are here

public function ViewsListTest::testViewsListLimit in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views_ui/src/Tests/ViewsListTest.php \Drupal\views_ui\Tests\ViewsListTest::testViewsListLimit()

Tests that the views list does not use a pager.

File

core/modules/views_ui/src/Tests/ViewsListTest.php, line 50
Contains \Drupal\views_ui\Tests\ViewsListTest.

Class

ViewsListTest
Tests the views list.

Namespace

Drupal\views_ui\Tests

Code

public function testViewsListLimit() {

  // Check if we can access the main views admin page.
  $this
    ->drupalGet('admin/structure/views');
  $this
    ->assertResponse(200);
  $this
    ->assertLink(t('Add new view'));

  // Count default views to be subtracted from the limit.
  $views = count(Views::getEnabledViews());

  // Create multiples views.
  $limit = 51;
  $values = $this
    ->config('views.view.test_view_storage')
    ->get();
  for ($i = 1; $i <= $limit - $views; $i++) {
    $values['id'] = 'test_view_storage_new' . $i;
    unset($values['uuid']);
    $created = View::create($values);
    $created
      ->save();
  }
  $this
    ->drupalGet('admin/structure/views');

  // Check that all the rows are listed.
  $this
    ->assertEqual(count($this
    ->xpath('//tbody/tr[contains(@class,"views-ui-list-enabled")]')), $limit);
}