summaryrefslogtreecommitdiff
path: root/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_filter_equality.test
diff options
context:
space:
mode:
Diffstat (limited to 'kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_filter_equality.test')
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_filter_equality.test91
1 files changed, 91 insertions, 0 deletions
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_filter_equality.test b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_filter_equality.test
index 96e82aa..5bb48c8 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_filter_equality.test
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_filter_equality.test
@@ -1,5 +1,13 @@
<?php
+/**
+ * @file
+ * Definition of ViewsHandlerFilterEqualityTest.
+ */
+
+/**
+ * Tests the core views_handler_filter_equality handler.
+ */
class ViewsHandlerFilterEqualityTest extends ViewsSqlTest {
public static function getInfo() {
return array(
@@ -47,6 +55,24 @@ class ViewsHandlerFilterEqualityTest extends ViewsSqlTest {
$this->assertIdenticalResultset($view, $resultset, $this->column_map);
}
+ public function testEqualGroupedExposed() {
+ $filters = $this->getGroupedExposedFilters();
+ $view = $this->getBasicPageView();
+
+ // Filter: Name, Operator: =, Value: Ringo
+ $filters['name']['group_info']['default_group'] = 1;
+ $view->set_display('page_1');
+ $view->display['page_1']->handler->override_option('filters', $filters);
+
+ $this->executeView($view);
+ $resultset = array(
+ array(
+ 'name' => 'Ringo',
+ ),
+ );
+ $this->assertIdenticalResultset($view, $resultset, $this->column_map);
+ }
+
function testNotEqual() {
$view = $this->getBasicView();
@@ -79,4 +105,69 @@ class ViewsHandlerFilterEqualityTest extends ViewsSqlTest {
);
$this->assertIdenticalResultset($view, $resultset, $this->column_map);
}
+
+ public function testEqualGroupedNotExposed() {
+ $filters = $this->getGroupedExposedFilters();
+ $view = $this->getBasicPageView();
+
+ // Filter: Name, Operator: !=, Value: Ringo
+ $filters['name']['group_info']['default_group'] = 2;
+ $view->set_display('page_1');
+ $view->display['page_1']->handler->override_option('filters', $filters);
+
+ $this->executeView($view);
+ $resultset = array(
+ array(
+ 'name' => 'John',
+ ),
+ array(
+ 'name' => 'George',
+ ),
+ array(
+ 'name' => 'Paul',
+ ),
+ array(
+ 'name' => 'Meredith',
+ ),
+ );
+ $this->assertIdenticalResultset($view, $resultset, $this->column_map);
+ }
+
+
+ protected function getGroupedExposedFilters() {
+ $filters = array(
+ 'name' => array(
+ 'id' => 'name',
+ 'table' => 'views_test',
+ 'field' => 'name',
+ 'relationship' => 'none',
+ 'exposed' => TRUE,
+ 'expose' => array(
+ 'operator' => 'name_op',
+ 'label' => 'name',
+ 'identifier' => 'name',
+ ),
+ 'is_grouped' => TRUE,
+ 'group_info' => array(
+ 'label' => 'name',
+ 'identifier' => 'name',
+ 'default_group' => 'All',
+ 'group_items' => array(
+ 1 => array(
+ 'title' => 'Name is equal to Ringo',
+ 'operator' => '=',
+ 'value' => array('value' => 'Ringo'),
+ ),
+ 2 => array(
+ 'title' => 'Name is not equal to Ringo',
+ 'operator' => '!=',
+ 'value' => array('value' => 'Ringo'),
+ ),
+ ),
+ ),
+ ),
+ );
+ return $filters;
+ }
+
}