Commit 581f9592 authored by alexpott's avatar alexpott

Issue #2871400 by dagmar: Make ViewsListingTest more readable

parent 3cd528fd
......@@ -34,6 +34,10 @@ protected function setUp() {
* Tests the filtering on the Views listing page.
*/
public function testFilterViewsListing() {
$enabled_views_count = 6;
$disabled_views_count = 2;
$content_views_count = 3;
$this->drupalGet('admin/structure/views');
$session = $this->assertSession();
......@@ -47,8 +51,8 @@ public function testFilterViewsListing() {
$disabled_rows = $this->filterVisibleElements($disabled_rows);
// Test that we see some rows of views in both tables.
$this->assertCount(6, $enabled_rows);
$this->assertCount(2, $disabled_rows);
$this->assertCount($enabled_views_count, $enabled_rows);
$this->assertCount($disabled_views_count, $disabled_rows);
// Filter on the string 'people'. This should only show the people view.
$search_input = $page->find('css', '.views-filter-text.form-search');
......@@ -70,8 +74,8 @@ public function testFilterViewsListing() {
$disabled_rows = $page->findAll('css', 'tr.views-ui-list-disabled');
$disabled_rows = $this->filterVisibleElements($disabled_rows);
$this->assertCount(3, $enabled_rows);
$this->assertCount(2, $disabled_rows);
$this->assertCount($content_views_count, $enabled_rows);
$this->assertCount($disabled_views_count, $disabled_rows);
// Reset the search string and check that we are back to the initial stage.
$search_input->setValue('');
......@@ -83,8 +87,8 @@ public function testFilterViewsListing() {
$disabled_rows = $page->findAll('css', 'tr.views-ui-list-disabled');
$disabled_rows = $this->filterVisibleElements($disabled_rows);
$this->assertCount(6, $enabled_rows);
$this->assertCount(2, $disabled_rows);
$this->assertCount($enabled_views_count, $enabled_rows);
$this->assertCount($disabled_views_count, $disabled_rows);
// Disable a View and see if it moves to the disabled listing.
$enabled_view = $page->find('css', 'tr.views-ui-list-enabled');
......@@ -103,8 +107,8 @@ public function testFilterViewsListing() {
$disabled_rows = $this->filterVisibleElements($disabled_rows);
// Test that one enabled View has been moved to the disabled list.
$this->assertCount(5, $enabled_rows);
$this->assertCount(3, $disabled_rows);
$this->assertCount($enabled_views_count - 1, $enabled_rows);
$this->assertCount($disabled_views_count + 1, $disabled_rows);
}
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment