summaryrefslogtreecommitdiff
path: root/kolab.org/www/drupal-7.15/sites/all/modules/views/tests
diff options
context:
space:
mode:
Diffstat (limited to 'kolab.org/www/drupal-7.15/sites/all/modules/views/tests')
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/comment/views_handler_argument_comment_user_uid.test7
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/comment/views_handler_filter_comment_user_uid.test8
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/field/views_fieldapi.test498
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_area_text.test5
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_argument_null.test8
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_argument_string.test96
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_field.test227
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_field_boolean.test8
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_field_counter.test10
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_field_custom.test8
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_field_date.test55
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_field_file_size.test7
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_field_math.test8
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_field_url.test8
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_field_xss.test7
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_filter_combine.test105
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_filter_date.test11
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_filter_equality.test91
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_filter_in_operator.test107
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_filter_numeric.test196
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_filter_string.test403
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_sort.test11
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_sort_date.test9
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_sort_random.test11
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/plugins/views_plugin_display.test194
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/styles/views_plugin_style.test48
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/styles/views_plugin_style_jump_menu.test8
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/styles/views_plugin_style_unformatted.test73
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/taxonomy/views_handler_relationship_node_term_data.test122
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/templates/views-view--frontpage.tpl.php5
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/test_plugins/views_test_plugin_access_test_dynamic.inc10
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/test_plugins/views_test_plugin_access_test_static.inc10
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/user/views_handler_field_user_name.test8
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/user/views_user.test5
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/user/views_user_argument_default.test5
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/user/views_user_argument_validate.test6
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_access.test15
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_analyze.test5
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_argument_default.test32
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_argument_validator.test8
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_basic.test19
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_cache.test119
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_cache.test.css5
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_cache.test.js5
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_exposed_form.test83
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_glossary.test7
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_groupby.test13
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_handlers.test44
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_module.test11
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_pager.test112
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_plugin_localization_test.inc5
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_query.test19
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_test.info6
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_test.install8
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_test.module20
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_test.views_default.inc79
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_translatable.test25
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_ui.test46
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_upgrade.test9
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_view.test9
60 files changed, 2956 insertions, 146 deletions
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/comment/views_handler_argument_comment_user_uid.test b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/comment/views_handler_argument_comment_user_uid.test
index 8de9777..353d929 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/comment/views_handler_argument_comment_user_uid.test
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/comment/views_handler_argument_comment_user_uid.test
@@ -1,7 +1,12 @@
<?php
+
/**
* @file
- * Test the argument_comment_user_uid handler.
+ * Definition of viewsHandlerArgumentCommentUserUidTest.
+ */
+
+/**
+ * Tests the argument_comment_user_uid handler.
*/
class viewsHandlerArgumentCommentUserUidTest extends ViewsSqlTest {
public static function getInfo() {
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/comment/views_handler_filter_comment_user_uid.test b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/comment/views_handler_filter_comment_user_uid.test
index c504088..1f3f75c 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/comment/views_handler_filter_comment_user_uid.test
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/comment/views_handler_filter_comment_user_uid.test
@@ -1,7 +1,13 @@
<?php
+
/**
* @file
- * Test the filter_comment_user_uid handler.
+ * Definition of viewsHandlerFilterCommentUserUidTest.
+ */
+
+/**
+ * Tests the filter_comment_user_uid handler.
+ *
* The actual stuff is done in the parent class.
*/
class viewsHandlerFilterCommentUserUidTest extends viewsHandlerArgumentCommentUserUidTest {
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/field/views_fieldapi.test b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/field/views_fieldapi.test
new file mode 100644
index 0000000..c5393b5
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/field/views_fieldapi.test
@@ -0,0 +1,498 @@
+<?php
+
+/**
+ * @file
+ * Tests the fieldapi integration of viewsdata.
+ */
+
+/**
+ * @TODO
+ * - Test on a generic entity not on a node.
+ *
+ * What has to be tested:
+ * - Take sure that every wanted field is added to the according entity type.
+ * - Take sure the joins are done correct.
+ * - Use basic fields and take sure that the full wanted object is build.
+ * - Use relationships between different entity types, for example node and the node author(user).
+ */
+
+/**
+ * Provides some helper methods for testing fieldapi integration into views.
+ */
+class ViewsFieldApiTestHelper extends ViewsSqlTest {
+ /**
+ * Stores the field definitions used by the test.
+ * @var array
+ */
+ public $fields;
+ /**
+ * Stores the instances of the fields. They have
+ * the same keys as the fields.
+ * @var array
+ */
+ public $instances;
+
+ protected function CreateUser($extra_edit = array()) {
+ $permissions = array('access comments', 'access content', 'post comments', 'skip comment approval');
+ // Create a role with the given permission set.
+ if (!($rid = $this->drupalCreateRole($permissions))) {
+ return FALSE;
+ }
+
+ // Create a user assigned to that role.
+ $edit = array();
+ $edit['name'] = $this->randomName();
+ $edit['mail'] = $edit['name'] . '@example.com';
+ $edit['roles'] = array($rid => $rid);
+ $edit['pass'] = user_password();
+ $edit['status'] = 1;
+ $edit += $extra_edit;
+
+ $account = user_save(drupal_anonymous_user(), $edit);
+
+ $this->assertTrue(!empty($account->uid), t('User created with name %name and pass %pass', array('%name' => $edit['name'], '%pass' => $edit['pass'])), t('User login'));
+ if (empty($account->uid)) {
+ return FALSE;
+ }
+
+ // Add the raw password so that we can log in as this user.
+ $account->pass_raw = $edit['pass'];
+ return $account;
+ }
+
+ function setUpFields($amount = 3) {
+ // Create three fields.
+ $field_names = array();
+ for ($i = 0; $i < $amount; $i++) {
+ $field_names[$i] = 'field_name_' . $i;
+ $field = array('field_name' => $field_names[$i], 'type' => 'text');
+
+ $this->fields[$i] = $field = field_create_field($field);
+ }
+ return $field_names;
+ }
+
+ function setUpInstances($bundle = 'page') {
+ foreach ($this->fields as $key => $field) {
+ $instance = array(
+ 'field_name' => $field['field_name'],
+ 'entity_type' => 'node',
+ 'bundle' => 'page',
+ );
+ $this->instances[$key] = field_create_instance($instance);
+ }
+ }
+
+ /**
+ * Clear all views caches and static caches which are required for the patch.
+ */
+ function clearViewsCaches() {
+ // Reset views data cache.
+ $cache = &drupal_static('_views_fetch_data' . '_cache');
+ $recursion_protection = &drupal_static('_views_fetch_data' . '_recursion_protected');
+ $cache = NULL;
+ $recursion_protection = NULL;
+ }
+}
+
+/**
+ * Test the produced views_data.
+ */
+class viewsFieldApiDataTest extends ViewsFieldApiTestHelper {
+ /**
+ * Stores the fields for this test case.
+ */
+ var $fields;
+
+ public static function getInfo() {
+ return array(
+ 'name' => 'Fieldapi: Views Data',
+ 'description' => 'Tests the fieldapi views data.',
+ 'group' => 'Views Modules',
+ );
+ }
+
+ function setUp() {
+ parent::setUp();
+
+ $langcode = LANGUAGE_NONE;
+
+
+ $field_names = $this->setUpFields();
+
+ // The first one will be attached to nodes only.
+ $instance = array(
+ 'field_name' => $field_names[0],
+ 'entity_type' => 'node',
+ 'bundle' => 'page',
+ );
+ field_create_instance($instance);
+
+ // The second one will be attached to users only.
+ $instance = array(
+ 'field_name' => $field_names[1],
+ 'entity_type' => 'user',
+ 'bundle' => 'user',
+ );
+ field_create_instance($instance);
+
+ // The third will be attached to both nodes and users.
+ $instance = array(
+ 'field_name' => $field_names[2],
+ 'entity_type' => 'node',
+ 'bundle' => 'page',
+ );
+ field_create_instance($instance);
+ $instance = array(
+ 'field_name' => $field_names[2],
+ 'entity_type' => 'user',
+ 'bundle' => 'user',
+ );
+ field_create_instance($instance);
+
+ // Now create some example nodes/users for the view result.
+ for ($i = 0; $i < 5; $i++) {
+ $edit = array(
+ // @TODO Write a helper method to create such values.
+ 'field_name_0' => array($langcode => array((array('value' => $this->randomName())))),
+ 'field_name_2' => array($langcode => array((array('value' => $this->randomName())))),
+ );
+ $this->nodes[] = $this->drupalCreateNode($edit);
+ }
+
+ for ($i = 0; $i < 5; $i++) {
+ $edit = array(
+ 'field_name_1' => array($langcode => array((array('value' => $this->randomName())))),
+ 'field_name_2' => array($langcode => array((array('value' => $this->randomName())))),
+ );
+ $this->users[] = $this->CreateUser($edit);
+ }
+
+ // Reset views data cache.
+ $cache = &drupal_static('_views_fetch_data' . '_cache');
+ $recursion_protection = &drupal_static('_views_fetch_data' . '_recursion_protected');
+ $cache = NULL;
+ $recursion_protection = NULL;
+ }
+
+ /**
+ * Unit testing the views data structure.
+ *
+ * We check data structure for both node and node revision tables.
+ */
+ function testViewsData() {
+ $data = views_fetch_data();
+
+ // Check the table and the joins of the first field.
+ // Attached to node only.
+ $field = $this->fields[0];
+ $current_table = _field_sql_storage_tablename($field);
+ $revision_table = _field_sql_storage_revision_tablename($field);
+
+ $this->assertTrue(isset($data[$current_table]));
+ $this->assertTrue(isset($data[$revision_table]));
+ // The node field should join against node.
+ $this->assertTrue(isset($data[$current_table]['table']['join']['node']));
+ $this->assertTrue(isset($data[$revision_table]['table']['join']['node_revision']));
+
+ $expected_join = array(
+ 'left_field' => 'nid',
+ 'field' => 'entity_id',
+ 'extra' => array(
+ array('field' => 'entity_type', 'value' => 'node'),
+ array('field' => 'deleted', 'value' => 0, 'numeric' => TRUE),
+ ),
+ );
+ $this->assertEqual($expected_join, $data[$current_table]['table']['join']['node']);
+ $expected_join = array(
+ 'left_field' => 'vid',
+ 'field' => 'revision_id',
+ 'extra' => array(
+ array('field' => 'entity_type', 'value' => 'node'),
+ array('field' => 'deleted', 'value' => 0, 'numeric' => TRUE),
+ ),
+ );
+ $this->assertEqual($expected_join, $data[$revision_table]['table']['join']['node_revision']);
+
+
+ // Check the table and the joins of the second field.
+ // Attached to both node and user.
+ $field_2 = $this->fields[2];
+ $current_table_2 = _field_sql_storage_tablename($field_2);
+ $revision_table_2 = _field_sql_storage_revision_tablename($field_2);
+
+ $this->assertTrue(isset($data[$current_table_2]));
+ $this->assertTrue(isset($data[$revision_table_2]));
+ // The second field should join against both node and users.
+ $this->assertTrue(isset($data[$current_table_2]['table']['join']['node']));
+ $this->assertTrue(isset($data[$revision_table_2]['table']['join']['node_revision']));
+ $this->assertTrue(isset($data[$current_table_2]['table']['join']['users']));
+
+ $expected_join = array(
+ 'left_field' => 'nid',
+ 'field' => 'entity_id',
+ 'extra' => array(
+ array('field' => 'entity_type', 'value' => 'node'),
+ array('field' => 'deleted', 'value' => 0, 'numeric' => TRUE),
+ )
+ );
+ $this->assertEqual($expected_join, $data[$current_table_2]['table']['join']['node']);
+ $expected_join = array(
+ 'left_field' => 'vid',
+ 'field' => 'revision_id',
+ 'extra' => array(
+ array('field' => 'entity_type', 'value' => 'node'),
+ array('field' => 'deleted', 'value' => 0, 'numeric' => TRUE),
+ )
+ );
+ $this->assertEqual($expected_join, $data[$revision_table_2]['table']['join']['node_revision']);
+ $expected_join = array(
+ 'left_field' => 'uid',
+ 'field' => 'entity_id',
+ 'extra' => array(
+ array('field' => 'entity_type', 'value' => 'user'),
+ array('field' => 'deleted', 'value' => 0, 'numeric' => TRUE),
+ )
+ );
+ $this->assertEqual($expected_join, $data[$current_table_2]['table']['join']['users']);
+
+ // Check the fields
+ // @todo
+
+ // Check the arguments
+ // @todo
+
+ // Check the sort criterias
+ // @todo
+
+ // Check the relationships
+ // @todo
+
+ }
+}
+
+/**
+ * Tests the field_field handler.
+ * @TODO
+ * Check a entity-type with bundles
+ * Check a entity-type without bundles
+ * Check locale:disabled, locale:enabled and locale:enabled with another language
+ * Check revisions
+ */
+class viewsHandlerFieldFieldTest extends ViewsFieldApiTestHelper {
+ public $nodes;
+
+ public static function getInfo() {
+ return array(
+ 'name' => 'Fieldapi: Field handler',
+ 'description' => 'Tests the field itself of the fieldapi integration',
+ 'group' => 'Views Modules'
+ );
+ }
+
+ protected function setUp() {
+ parent::setUp();
+
+ // Setup basic fields.
+ $this->setUpFields(3);
+
+ // Setup a field with cardinality > 1.
+ $this->fields[3] = $field = field_create_field(array('field_name' => 'field_name_3', 'type' => 'text', 'cardinality' => FIELD_CARDINALITY_UNLIMITED));
+ // Setup a field that will have no value.
+ $this->fields[4] = $field = field_create_field(array('field_name' => 'field_name_4', 'type' => 'text', 'cardinality' => FIELD_CARDINALITY_UNLIMITED));
+
+ $this->setUpInstances();
+
+ $this->clearViewsCaches();
+
+ // Create some nodes.
+ $this->nodes = array();
+ for ($i = 0; $i < 3; $i++) {
+ $edit = array('type' => 'page');
+
+ for ($key = 0; $key < 3; $key++) {
+ $field = $this->fields[$key];
+ $edit[$field['field_name']][LANGUAGE_NONE][0]['value'] = $this->randomName(8);
+ }
+ for ($j = 0; $j < 5; $j++) {
+ $edit[$this->fields[3]['field_name']][LANGUAGE_NONE][$j]['value'] = $this->randomName(8);
+ }
+ // Set this field to be empty.
+ $edit[$this->fields[4]['field_name']] = array();
+
+ $this->nodes[$i] = $this->drupalCreateNode($edit);
+ }
+ }
+
+ public function testFieldRender() {
+ $this->_testSimpleFieldRender();
+ $this->_testFormatterSimpleFieldRender();
+ $this->_testMultipleFieldRender();
+ }
+
+ public function _testSimpleFieldRender() {
+ $view = $this->getFieldView();
+ $this->executeView($view);
+
+ // Tests that the rendered fields match the actual value of the fields.
+ for ($i = 0; $i < 3; $i++) {
+ for ($key = 0; $key < 2; $key++) {
+ $field = $this->fields[$key];
+ $rendered_field = $view->style_plugin->get_field($i, $field['field_name']);
+ $expected_field = $this->nodes[$i]->{$field['field_name']}[LANGUAGE_NONE][0]['value'];
+ $this->assertEqual($rendered_field, $expected_field);
+ }
+ }
+ }
+
+ /**
+ * Tests that fields with formatters runs as expected.
+ */
+ public function _testFormatterSimpleFieldRender() {
+ $view = $this->getFieldView();
+ $view->display['default']->display_options['fields'][$this->fields[0]['field_name']]['type'] = 'text_trimmed';
+ $view->display['default']->display_options['fields'][$this->fields[0]['field_name']]['settings'] = array(
+ 'trim_length' => 3,
+ );
+ $this->executeView($view);
+
+ // Take sure that the formatter works as expected.
+ // @TODO: actually there should be a specific formatter.
+ for ($i = 0; $i < 2; $i++) {
+ $rendered_field = $view->style_plugin->get_field($i, $this->fields[0]['field_name']);
+ $this->assertEqual(strlen($rendered_field), 3);
+ }
+ }
+
+ public function _testMultipleFieldRender() {
+ $view = $this->getFieldView();
+
+ // Test delta limit.
+ $view->display['default']->display_options['fields'][$this->fields[3]['field_name']]['group_rows'] = TRUE;
+ $view->display['default']->display_options['fields'][$this->fields[3]['field_name']]['delta_limit'] = 3;
+ $this->executeView($view);
+
+ for ($i = 0; $i < 3; $i++) {
+ $rendered_field = $view->style_plugin->get_field($i, $this->fields[3]['field_name']);
+ $items = array();
+ $pure_items = $this->nodes[$i]->{$this->fields[3]['field_name']}[LANGUAGE_NONE];
+ $pure_items = array_splice($pure_items, 0, 3);
+ foreach ($pure_items as $j => $item) {
+ $items[] = $pure_items[$j]['value'];
+ }
+ $this->assertEqual($rendered_field, implode(', ', $items), 'Take sure that the amount of items are limited.');
+ }
+
+ // Test that an empty field is rendered without error.
+ $rendered_field = $view->style_plugin->get_field(4, $this->fields[4]['field_name']);
+
+ $view->destroy();
+
+ // Test delta limit + offset
+ $view->display['default']->display_options['fields'][$this->fields[3]['field_name']]['group_rows'] = TRUE;
+ $view->display['default']->display_options['fields'][$this->fields[3]['field_name']]['delta_limit'] = 3;
+ $view->display['default']->display_options['fields'][$this->fields[3]['field_name']]['delta_offset'] = 1;
+ $this->executeView($view);
+
+ for ($i = 0; $i < 3; $i++) {
+ $rendered_field = $view->style_plugin->get_field($i, $this->fields[3]['field_name']);
+ $items = array();
+ $pure_items = $this->nodes[$i]->{$this->fields[3]['field_name']}[LANGUAGE_NONE];
+ $pure_items = array_splice($pure_items, 1, 3);
+ foreach ($pure_items as $j => $item) {
+ $items[] = $pure_items[$j]['value'];
+ }
+ $this->assertEqual($rendered_field, implode(', ', $items), 'Take sure that the amount of items are limited.');
+ }
+ $view->destroy();
+
+ // Test delta limit + reverse.
+ $view->display['default']->display_options['fields'][$this->fields[3]['field_name']]['delta_offset'] = 0;
+ $view->display['default']->display_options['fields'][$this->fields[3]['field_name']]['group_rows'] = TRUE;
+ $view->display['default']->display_options['fields'][$this->fields[3]['field_name']]['delta_limit'] = 3;
+ $view->display['default']->display_options['fields'][$this->fields[3]['field_name']]['delta_reversed'] = TRUE;
+ $this->executeView($view);
+
+ for ($i = 0; $i < 3; $i++) {
+ $rendered_field = $view->style_plugin->get_field($i, $this->fields[3]['field_name']);
+ $items = array();
+ $pure_items = $this->nodes[$i]->{$this->fields[3]['field_name']}[LANGUAGE_NONE];
+ array_splice($pure_items, 0, -3);
+ $pure_items = array_reverse($pure_items);
+ foreach ($pure_items as $j => $item) {
+ $items[] = $pure_items[$j]['value'];
+ }
+ $this->assertEqual($rendered_field, implode(', ', $items), 'Take sure that the amount of items are limited.');
+ }
+ $view->destroy();
+
+ // Test delta first last.
+ $view->display['default']->display_options['fields'][$this->fields[3]['field_name']]['group_rows'] = TRUE;
+ $view->display['default']->display_options['fields'][$this->fields[3]['field_name']]['delta_limit'] = 0;
+ $view->display['default']->display_options['fields'][$this->fields[3]['field_name']]['delta_first_last'] = TRUE;
+ $view->display['default']->display_options['fields'][$this->fields[3]['field_name']]['delta_reversed'] = FALSE;
+ $this->executeView($view);
+
+ for ($i = 0; $i < 3; $i++) {
+ $rendered_field = $view->style_plugin->get_field($i, $this->fields[3]['field_name']);
+ $items = array();
+ $pure_items = $this->nodes[$i]->{$this->fields[3]['field_name']}[LANGUAGE_NONE];
+ $items[] = $pure_items[0]['value'];
+ $items[] = $pure_items[4]['value'];
+ $this->assertEqual($rendered_field, implode(', ', $items), 'Take sure that the amount of items are limited.');
+ }
+ $view->destroy();
+
+ // Test delta limit + custom seperator.
+ $view->display['default']->display_options['fields'][$this->fields[3]['field_name']]['delta_first_last'] = FALSE;
+ $view->display['default']->display_options['fields'][$this->fields[3]['field_name']]['delta_limit'] = 3;
+ $view->display['default']->display_options['fields'][$this->fields[3]['field_name']]['group_rows'] = TRUE;
+ $view->display['default']->display_options['fields'][$this->fields[3]['field_name']]['separator'] = ':';
+ $this->executeView($view);
+
+ for ($i = 0; $i < 3; $i++) {
+ $rendered_field = $view->style_plugin->get_field($i, $this->fields[3]['field_name']);
+ $items = array();
+ $pure_items = $this->nodes[$i]->{$this->fields[3]['field_name']}[LANGUAGE_NONE];
+ $pure_items = array_splice($pure_items, 0, 3);
+ foreach ($pure_items as $j => $item) {
+ $items[] = $pure_items[$j]['value'];
+ }
+ $this->assertEqual($rendered_field, implode(':', $items), 'Take sure that the amount of items are limited.');
+ }
+ }
+
+ protected function getFieldView() {
+ $view = new view;
+ $view->name = 'view_fieldapi';
+ $view->description = '';
+ $view->tag = 'default';
+ $view->base_table = 'node';
+ $view->human_name = 'view_fieldapi';
+ $view->core = 7;
+ $view->api_version = '3.0';
+ $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
+
+ /* Display: Master */
+ $handler = $view->new_display('default', 'Master', 'default');
+ $handler->display->display_options['access']['type'] = 'perm';
+ $handler->display->display_options['cache']['type'] = 'none';
+ $handler->display->display_options['query']['type'] = 'views_query';
+ $handler->display->display_options['exposed_form']['type'] = 'basic';
+ $handler->display->display_options['pager']['type'] = 'full';
+ $handler->display->display_options['style_plugin'] = 'default';
+ $handler->display->display_options['row_plugin'] = 'fields';
+
+ $handler->display->display_options['fields']['nid']['id'] = 'nid';
+ $handler->display->display_options['fields']['nid']['table'] = 'node';
+ $handler->display->display_options['fields']['nid']['field'] = 'nid';
+ foreach ($this->fields as $key => $field) {
+ $handler->display->display_options['fields'][$field['field_name']]['id'] = $field['field_name'];
+ $handler->display->display_options['fields'][$field['field_name']]['table'] = 'field_data_' . $field['field_name'];
+ $handler->display->display_options['fields'][$field['field_name']]['field'] = $field['field_name'];
+ }
+ return $view;
+ }
+
+}
+
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_area_text.test b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_area_text.test
index d9724a4..9f30e0c 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_area_text.test
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_area_text.test
@@ -1,6 +1,11 @@
<?php
/**
+ * @file
+ * Definition of ViewsHandlerAreaTextTest.
+ */
+
+/**
* Tests the text area handler.
*
* @see views_handler_area_text
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_argument_null.test b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_argument_null.test
index da01136..e8650a3 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_argument_null.test
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_argument_null.test
@@ -1,5 +1,13 @@
<?php
+/**
+ * @file
+ * Definition of ViewsHandlerArgumentNullTest.
+ */
+
+/**
+ * Tests the core views_handler_argument_null handler.
+ */
class ViewsHandlerArgumentNullTest extends ViewsSqlTest {
public static function getInfo() {
return array(
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_argument_string.test b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_argument_string.test
new file mode 100644
index 0000000..d078abf
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_argument_string.test
@@ -0,0 +1,96 @@
+<?php
+/**
+ * @file
+ * Definition of ViewsHandlerArgumentNullTest.
+ */
+
+/**
+ * Tests the core views_handler_argument_string handler.
+ */
+class ViewsHandlerArgumentStringTest extends ViewsSqlTest {
+ public static function getInfo() {
+ return array(
+ 'name' => 'Argument: String',
+ 'description' => 'Test the core views_handler_argument_string handler.',
+ 'group' => 'Views Handlers',
+ );
+ }
+
+ /**
+ * Tests the glossary feature.
+ */
+ function testGlossary() {
+ // Setup some nodes, one with a, two with b and three with c.
+ $counter = 1;
+ foreach (array('a', 'b', 'c') as $char) {
+ for ($i = 0; $i < $counter; $i++) {
+ $edit = array(
+ 'title' => $char . $this->randomName(),
+ );
+ $this->drupalCreateNode($edit);
+ }
+ }
+
+ $view = $this->viewGlossary();
+ $view->init_display();
+ $this->executeView($view);
+
+ $count_field = 'nid';
+ foreach ($view->result as &$row) {
+ if (strpos($row->node_title, 'a') === 0) {
+ $this->assertEqual(1, $row->{$count_field});
+ }
+ if (strpos($row->node_title, 'b') === 0) {
+ $this->assertEqual(2, $row->{$count_field});
+ }
+ if (strpos($row->node_title, 'c') === 0) {
+ $this->assertEqual(3, $row->{$count_field});
+ }
+ }
+ }
+
+ /**
+ * Provide a test view for testGlossary.
+ *
+ * @see testGlossary
+ * @return view
+ */
+ function viewGlossary() {
+ $view = new view();
+ $view->name = 'test_glossary';
+ $view->description = '';
+ $view->tag = 'default';
+ $view->base_table = 'node';
+ $view->human_name = 'test_glossary';
+ $view->core = 7;
+ $view->api_version = '3.0';
+ $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
+
+ /* Display: Master */
+ $handler = $view->new_display('default', 'Master', 'default');
+ $handler->display->display_options['access']['type'] = 'perm';
+ $handler->display->display_options['cache']['type'] = 'none';
+ $handler->display->display_options['query']['type'] = 'views_query';
+ $handler->display->display_options['exposed_form']['type'] = 'basic';
+ $handler->display->display_options['pager']['type'] = 'full';
+ $handler->display->display_options['style_plugin'] = 'default';
+ $handler->display->display_options['row_plugin'] = 'fields';
+ /* Field: Content: Title */
+ $handler->display->display_options['fields']['title']['id'] = 'title';
+ $handler->display->display_options['fields']['title']['table'] = 'node';
+ $handler->display->display_options['fields']['title']['field'] = 'title';
+ $handler->display->display_options['fields']['title']['label'] = '';
+ /* Contextual filter: Content: Title */
+ $handler->display->display_options['arguments']['title']['id'] = 'title';
+ $handler->display->display_options['arguments']['title']['table'] = 'node';
+ $handler->display->display_options['arguments']['title']['field'] = 'title';
+ $handler->display->display_options['arguments']['title']['default_argument_type'] = 'fixed';
+ $handler->display->display_options['arguments']['title']['summary']['number_of_records'] = '0';
+ $handler->display->display_options['arguments']['title']['summary']['format'] = 'default_summary';
+ $handler->display->display_options['arguments']['title']['summary_options']['items_per_page'] = '25';
+ $handler->display->display_options['arguments']['title']['glossary'] = TRUE;
+ $handler->display->display_options['arguments']['title']['limit'] = '1';
+
+ return $view;
+ }
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_field.test b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_field.test
index 726857e..9e6dfca 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_field.test
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_field.test
@@ -2,7 +2,7 @@
/**
* @file
- * Contains tests for views_handler_field.
+ * Definition of ViewsHandlerFieldTest.
*/
/**
@@ -39,39 +39,216 @@ class ViewsHandlerFieldTest extends ViewsSqlTest {
function _testHideIfEmpty() {
$view = $this->getBasicView();
$view->init_display();
- $view->pre_execute();
- $view->execute();
+ $this->executeView($view);
$column_map_reversed = array_flip($this->column_map);
$view->row_index = 0;
+ $random_name = $this->randomName();
+ $random_value = $this->randomName();
+
+ // Test when results are not rewritten and empty values are not hidden.
+ $view->field['name']->options['hide_alter_empty'] = FALSE;
+ $view->field['name']->options['hide_empty'] = FALSE;
+ $view->field['name']->options['empty_zero'] = FALSE;
+
+ // Test a valid string.
+ $view->result[0]->{$column_map_reversed['name']} = $random_name;
+ $render = $view->field['name']->advanced_render($view->result[0]);
+ $this->assertIdentical($render, $random_name, 'By default, a string should not be treated as empty.');
+
+ // Test an empty string.
+ $view->result[0]->{$column_map_reversed['name']} = "";
+ $render = $view->field['name']->advanced_render($view->result[0]);
+ $this->assertIdentical($render, "", 'By default, "" should not be treated as empty.');
+
+ // Test zero as an integer.
+ $view->result[0]->{$column_map_reversed['name']} = 0;
+ $render = $view->field['name']->advanced_render($view->result[0]);
+ $this->assertIdentical($render, '0', 'By default, 0 should not be treated as empty.');
+
+ // Test zero as a string.
+ $view->result[0]->{$column_map_reversed['name']} = "0";
+ $render = $view->field['name']->advanced_render($view->result[0]);
+ $this->assertIdentical($render, "0", 'By default, "0" should not be treated as empty.');
+ // Test when results are not rewritten and non-zero empty values are hidden.
+ $view->field['name']->options['hide_alter_empty'] = TRUE;
$view->field['name']->options['hide_empty'] = TRUE;
+ $view->field['name']->options['empty_zero'] = FALSE;
+
+ // Test a valid string.
+ $view->result[0]->{$column_map_reversed['name']} = $random_name;
+ $render = $view->field['name']->advanced_render($view->result[0]);
+ $this->assertIdentical($render, $random_name, 'If hide_empty is checked, a string should not be treated as empty.');
+
+ // Test an empty string.
$view->result[0]->{$column_map_reversed['name']} = "";
$render = $view->field['name']->advanced_render($view->result[0]);
$this->assertIdentical($render, "", 'If hide_empty is checked, "" should be treated as empty.');
- $view->field['name']->options['empty_zero'] = FALSE;
+ // Test zero as an integer.
+ $view->result[0]->{$column_map_reversed['name']} = 0;
+ $render = $view->field['name']->advanced_render($view->result[0]);
+ $this->assertIdentical($render, '0', 'If hide_empty is checked, but not empty_zero, 0 should not be treated as empty.');
+
+ // Test zero as a string.
$view->result[0]->{$column_map_reversed['name']} = "0";
$render = $view->field['name']->advanced_render($view->result[0]);
- $this->assertIdentical($render, "0", 'If hide_empty is checked, but not empty_zero, "0" should be treated as not empty.');
+ $this->assertIdentical($render, "0", 'If hide_empty is checked, but not empty_zero, "0" should not be treated as empty.');
+ // Test when results are not rewritten and all empty values are hidden.
+ $view->field['name']->options['hide_alter_empty'] = TRUE;
+ $view->field['name']->options['hide_empty'] = TRUE;
$view->field['name']->options['empty_zero'] = TRUE;
+
+ // Test zero as an integer.
+ $view->result[0]->{$column_map_reversed['name']} = 0;
+ $render = $view->field['name']->advanced_render($view->result[0]);
+ $this->assertIdentical($render, "", 'If hide_empty and empty_zero are checked, 0 should be treated as empty.');
+
+ // Test zero as a string.
+ $view->result[0]->{$column_map_reversed['name']} = "0";
$render = $view->field['name']->advanced_render($view->result[0]);
$this->assertIdentical($render, "", 'If hide_empty and empty_zero are checked, "0" should be treated as empty.');
+ // Test when results are rewritten to a valid string and non-zero empty
+ // results are hidden.
$view->field['name']->options['hide_alter_empty'] = FALSE;
+ $view->field['name']->options['hide_empty'] = TRUE;
+ $view->field['name']->options['empty_zero'] = FALSE;
$view->field['name']->options['alter']['alter_text'] = TRUE;
- $view->result[0]->{$column_map_reversed['name']} = "";
- $random_name = $this->randomName();
$view->field['name']->options['alter']['text'] = $random_name;
+
+ // Test a valid string.
+ $view->result[0]->{$column_map_reversed['name']} = $random_value;
+ $render = $view->field['name']->advanced_render($view->result[0]);
+ $this->assertIdentical($render, $random_name, 'If the rewritten string is not empty, it should not be treated as empty.');
+
+ // Test an empty string.
+ $view->result[0]->{$column_map_reversed['name']} = "";
+ $render = $view->field['name']->advanced_render($view->result[0]);
+ $this->assertIdentical($render, $random_name, 'If the rewritten string is not empty, "" should not be treated as empty.');
+
+ // Test zero as an integer.
+ $view->result[0]->{$column_map_reversed['name']} = 0;
$render = $view->field['name']->advanced_render($view->result[0]);
- $this->assertIdentical($render, $random_name, 'If hide_empty but not hide_alter_empty is checked, some rewrite should appear even if the value is empty.');
+ $this->assertIdentical($render, $random_name, 'If the rewritten string is not empty, 0 should not be treated as empty.');
+ // Test zero as a string.
+ $view->result[0]->{$column_map_reversed['name']} = "0";
+ $render = $view->field['name']->advanced_render($view->result[0]);
+ $this->assertIdentical($render, $random_name, 'If the rewritten string is not empty, "0" should not be treated as empty.');
+
+ // Test when results are rewritten to an empty string and non-zero empty results are hidden.
$view->field['name']->options['hide_alter_empty'] = TRUE;
- $random_name = $this->randomName();
- $view->field['name']->options['alter']['text'] = $random_name;
+ $view->field['name']->options['hide_empty'] = TRUE;
+ $view->field['name']->options['empty_zero'] = FALSE;
+ $view->field['name']->options['alter']['alter_text'] = TRUE;
+ $view->field['name']->options['alter']['text'] = "";
+
+ // Test a valid string.
+ $view->result[0]->{$column_map_reversed['name']} = $random_name;
+ $render = $view->field['name']->advanced_render($view->result[0]);
+ $this->assertIdentical($render, $random_name, 'If the rewritten string is empty, it should not be treated as empty.');
+
+ // Test an empty string.
+ $view->result[0]->{$column_map_reversed['name']} = "";
+ $render = $view->field['name']->advanced_render($view->result[0]);
+ $this->assertIdentical($render, "", 'If the rewritten string is empty, "" should be treated as empty.');
+
+ // Test zero as an integer.
+ $view->result[0]->{$column_map_reversed['name']} = 0;
+ $render = $view->field['name']->advanced_render($view->result[0]);
+ $this->assertIdentical($render, '0', 'If the rewritten string is empty, 0 should not be treated as empty.');
+
+ // Test zero as a string.
+ $view->result[0]->{$column_map_reversed['name']} = "0";
$render = $view->field['name']->advanced_render($view->result[0]);
- $this->assertIdentical($render, "", 'If hide_empty and hide_alter_empty are checked, rewrite should be empty all the time.');
+ $this->assertIdentical($render, "0", 'If the rewritten string is empty, "0" should not be treated as empty.');
+
+ // Test when results are rewritten to zero as a string and non-zero empty
+ // results are hidden.
+ $view->field['name']->options['hide_alter_empty'] = FALSE;
+ $view->field['name']->options['hide_empty'] = TRUE;
+ $view->field['name']->options['empty_zero'] = FALSE;
+ $view->field['name']->options['alter']['alter_text'] = TRUE;
+ $view->field['name']->options['alter']['text'] = "0";
+
+ // Test a valid string.
+ $view->result[0]->{$column_map_reversed['name']} = $random_name;
+ $render = $view->field['name']->advanced_render($view->result[0]);
+ $this->assertIdentical($render, "0", 'If the rewritten string is zero and empty_zero is not checked, the string rewritten as 0 should not be treated as empty.');
+
+ // Test an empty string.
+ $view->result[0]->{$column_map_reversed['name']} = "";
+ $render = $view->field['name']->advanced_render($view->result[0]);
+ $this->assertIdentical($render, "0", 'If the rewritten string is zero and empty_zero is not checked, "" rewritten as 0 should not be treated as empty.');
+
+ // Test zero as an integer.
+ $view->result[0]->{$column_map_reversed['name']} = 0;
+ $render = $view->field['name']->advanced_render($view->result[0]);
+ $this->assertIdentical($render, "0", 'If the rewritten string is zero and empty_zero is not checked, 0 should not be treated as empty.');
+
+ // Test zero as a string.
+ $view->result[0]->{$column_map_reversed['name']} = "0";
+ $render = $view->field['name']->advanced_render($view->result[0]);
+ $this->assertIdentical($render, "0", 'If the rewritten string is zero and empty_zero is not checked, "0" should not be treated as empty.');
+
+ // Test when results are rewritten to a valid string and non-zero empty
+ // results are hidden.
+ $view->field['name']->options['hide_alter_empty'] = TRUE;
+ $view->field['name']->options['hide_empty'] = TRUE;
+ $view->field['name']->options['empty_zero'] = FALSE;
+ $view->field['name']->options['alter']['alter_text'] = TRUE;
+ $view->field['name']->options['alter']['text'] = $random_value;
+
+ // Test a valid string.
+ $view->result[0]->{$column_map_reversed['name']} = $random_name;
+ $render = $view->field['name']->advanced_render($view->result[0]);
+ $this->assertIdentical($render, $random_value, 'If the original and rewritten strings are valid, it should not be treated as empty.');
+
+ // Test an empty string.
+ $view->result[0]->{$column_map_reversed['name']} = "";
+ $render = $view->field['name']->advanced_render($view->result[0]);
+ $this->assertIdentical($render, "", 'If either the original or rewritten string is invalid, "" should be treated as empty.');
+
+ // Test zero as an integer.
+ $view->result[0]->{$column_map_reversed['name']} = 0;
+ $render = $view->field['name']->advanced_render($view->result[0]);
+ $this->assertIdentical($render, $random_value, 'If the original and rewritten strings are valid, 0 should not be treated as empty.');
+
+ // Test zero as a string.
+ $view->result[0]->{$column_map_reversed['name']} = "0";
+ $render = $view->field['name']->advanced_render($view->result[0]);
+ $this->assertIdentical($render, $random_value, 'If the original and rewritten strings are valid, "0" should not be treated as empty.');
+
+ // Test when results are rewritten to zero as a string and all empty
+ // original values and results are hidden.
+ $view->field['name']->options['hide_alter_empty'] = TRUE;
+ $view->field['name']->options['hide_empty'] = TRUE;
+ $view->field['name']->options['empty_zero'] = TRUE;
+ $view->field['name']->options['alter']['alter_text'] = TRUE;
+ $view->field['name']->options['alter']['text'] = "0";
+
+ // Test a valid string.
+ $view->result[0]->{$column_map_reversed['name']} = $random_name;
+ $render = $view->field['name']->advanced_render($view->result[0]);
+ $this->assertIdentical($render, "", 'If the rewritten string is zero, it should be treated as empty.');
+
+ // Test an empty string.
+ $view->result[0]->{$column_map_reversed['name']} = "";
+ $render = $view->field['name']->advanced_render($view->result[0]);
+ $this->assertIdentical($render, "", 'If the rewritten string is zero, "" should be treated as empty.');
+
+ // Test zero as an integer.
+ $view->result[0]->{$column_map_reversed['name']} = 0;
+ $render = $view->field['name']->advanced_render($view->result[0]);
+ $this->assertIdentical($render, "", 'If the rewritten string is zero, 0 should not be treated as empty.');
+
+ // Test zero as a string.
+ $view->result[0]->{$column_map_reversed['name']} = "0";
+ $render = $view->field['name']->advanced_render($view->result[0]);
+ $this->assertIdentical($render, "", 'If the rewritten string is zero, "0" should not be treated as empty.');
}
/**
@@ -80,8 +257,7 @@ class ViewsHandlerFieldTest extends ViewsSqlTest {
function _testEmptyText() {
$view = $this->getBasicView();
$view->init_display();
- $view->pre_execute();
- $view->execute();
+ $this->executeView($view);
$column_map_reversed = array_flip($this->column_map);
$view->row_index = 0;
@@ -112,4 +288,27 @@ class ViewsHandlerFieldTest extends ViewsSqlTest {
$this->assertIdentical($render, $empty_text, 'If a field is empty, some rewrite text exists, and hide_alter_empty is checked, use the empty text.');
}
-} \ No newline at end of file
+ /**
+ * Tests views_handler_field::is_value_empty().
+ */
+ function testIsValueEmpty() {
+ $view = $this->getBasicView();
+ $view->init_display();
+ $view->init_handlers();
+ $field = $view->field['name'];
+
+ $this->assertFalse($field->is_value_empty("not empty", TRUE), 'A normal string is not empty.');
+ $this->assertTrue($field->is_value_empty("not empty", TRUE, FALSE), 'A normal string which skips empty() can be seen as empty.');
+
+ $this->assertTrue($field->is_value_empty("", TRUE), '"" is considered as empty.');
+
+ $this->assertTrue($field->is_value_empty('0', TRUE), '"0" is considered as empty if empty_zero is TRUE.');
+ $this->assertTrue($field->is_value_empty(0, TRUE), '0 is considered as empty if empty_zero is TRUE.');
+ $this->assertFalse($field->is_value_empty('0', FALSE), '"0" is considered not as empty if empty_zero is FALSE.');
+ $this->assertFalse($field->is_value_empty(0, FALSE), '0 is considered not as empty if empty_zero is FALSE.');
+
+ $this->assertTrue($field->is_value_empty(NULL, TRUE, TRUE), 'Null should be always seen as empty, regardless of no_skip_empty.');
+ $this->assertTrue($field->is_value_empty(NULL, TRUE, FALSE), 'Null should be always seen as empty, regardless of no_skip_empty.');
+ }
+
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_field_boolean.test b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_field_boolean.test
index 54b4287..92ec7a5 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_field_boolean.test
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_field_boolean.test
@@ -1,5 +1,13 @@
<?php
+/**
+ * @file
+ * Definition of ViewsHandlerFieldBooleanTest.
+ */
+
+/**
+ * Tests the core views_handler_field_boolean handler.
+ */
class ViewsHandlerFieldBooleanTest extends ViewsSqlTest {
public static function getInfo() {
return array(
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_field_counter.test b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_field_counter.test
index c628a79..2ddcb6f 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_field_counter.test
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_field_counter.test
@@ -1,10 +1,18 @@
<?php
+/**
+ * @file
+ * Definition of ViewsHandlerFilterCounterTest.
+ */
+
+/**
+ * Tests the views_handler_field_counter handler.
+ */
class ViewsHandlerFilterCounterTest extends ViewsSqlTest {
public static function getInfo() {
return array(
'name' => 'Field: Counter',
- 'description' => 'Tests the views_handler_field_counter handler',
+ 'description' => 'Tests the views_handler_field_counter handler.',
'group' => 'Views Handlers',
);
}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_field_custom.test b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_field_custom.test
index 787cdbd..b45fd17 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_field_custom.test
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_field_custom.test
@@ -1,5 +1,13 @@
<?php
+/**
+ * @file
+ * Definition of ViewsHandlerFieldCustomTest.
+ */
+
+/**
+ * Tests the core views_handler_field_custom handler.
+ */
class ViewsHandlerFieldCustomTest extends ViewsSqlTest {
public static function getInfo() {
return array(
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_field_date.test b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_field_date.test
index 0b9bde5..028b687 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_field_date.test
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_field_date.test
@@ -1,5 +1,13 @@
<?php
+/**
+ * @file
+ * Definition of ViewsHandlerFieldDateTest.
+ */
+
+/**
+ * Tests the core views_handler_field_date handler.
+ */
class ViewsHandlerFieldDateTest extends ViewsSqlTest {
public static function getInfo() {
return array(
@@ -30,25 +38,50 @@ class ViewsHandlerFieldDateTest extends ViewsSqlTest {
));
$time = gmmktime(0, 0, 0, 1, 1, 2000);
- $maps = array(
- 'small' => format_date($time, 'small'),
- 'medium' => format_date($time, 'medium'),
- 'large' => format_date($time, 'large'),
- 'custom' => format_date($time, 'custom', 'c'),
+ $this->executeView($view);
+
+ $timezones = array(
+ NULL,
+ 'UTC',
+ 'America/New_York',
+ );
+ foreach ($timezones as $timezone) {
+ $dates = array(
+ 'small' => format_date($time, 'small', '', $timezone),
+ 'medium' => format_date($time, 'medium', '', $timezone),
+ 'large' => format_date($time, 'large', '', $timezone),
+ 'custom' => format_date($time, 'custom', 'c', $timezone),
+ );
+ $this->assertRenderedDatesEqual($view, $dates, $timezone);
+ }
+
+ $intervals = array(
'raw time ago' => format_interval(REQUEST_TIME - $time, 2),
'time ago' => t('%time ago', array('%time' => format_interval(REQUEST_TIME - $time, 2))),
// TODO write tests for them
// 'raw time span' => format_interval(REQUEST_TIME - $time, 2),
// 'time span' => t('%time hence', array('%time' => format_interval(REQUEST_TIME - $time, 2))),
);
+ $this->assertRenderedDatesEqual($view, $intervals);
+ }
- $this->executeView($view);
-
- foreach ($maps as $date_format => $expected_result) {
+ protected function assertRenderedDatesEqual($view, $map, $timezone = NULL) {
+ foreach ($map as $date_format => $expected_result) {
$view->field['created']->options['date_format'] = $date_format;
- $this->assertEqual($expected_result, $view->field['created']->advanced_render($view->result[0]));
- debug($view->field['created']->advanced_render($view->result[0]));
+ $t_args = array(
+ '%value' => $expected_result,
+ '%format' => $date_format,
+ );
+ if (isset($timezone)) {
+ $t_args['%timezone'] = $timezone;
+ $message = t('Value %value in %format format for timezone %timezone matches.', $t_args);
+ $view->field['created']->options['timezone'] = $timezone;
+ }
+ else {
+ $message = t('Value %value in %format format matches.', $t_args);
+ }
+ $actual_result = $view->field['created']->advanced_render($view->result[0]);
+ $this->assertEqual($expected_result, $actual_result, $message);
}
- debug($view->result);
}
}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_field_file_size.test b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_field_file_size.test
index ae2569e..8652754 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_field_file_size.test
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_field_file_size.test
@@ -1,6 +1,13 @@
<?php
/**
+ * @file
+ * Definition of ViewsHandlerTestFileSize.
+ */
+
+/**
+ * Tests the core views_handler_field_file_size handler.
+ *
* @see CommonXssUnitTest
*/
class ViewsHandlerTestFileSize extends ViewsSqlTest {
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_field_math.test b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_field_math.test
index 2d222e6..ac33ac4 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_field_math.test
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_field_math.test
@@ -1,5 +1,13 @@
<?php
+/**
+ * @file
+ * Definition of ViewsHandlerFieldMath.
+ */
+
+/**
+ * Tests the core views_handler_field_math handler.
+ */
class ViewsHandlerFieldMath extends ViewsSqlTest {
public static function getInfo() {
return array(
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_field_url.test b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_field_url.test
index 35bffa7..527e94f 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_field_url.test
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_field_url.test
@@ -1,5 +1,13 @@
<?php
+/**
+ * @file
+ * Definition of ViewsHandlerFieldUrlTest.
+ */
+
+/**
+ * Tests the core views_handler_field_url handler.
+ */
class ViewsHandlerFieldUrlTest extends ViewsSqlTest {
public static function getInfo() {
return array(
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_field_xss.test b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_field_xss.test
index c76d188..65a1ce2 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_field_xss.test
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_field_xss.test
@@ -1,6 +1,13 @@
<?php
/**
+ * @file
+ * Definition of ViewsHandlerTestXss.
+ */
+
+/**
+ * Tests the core views_handler_field_css handler.
+ *
* @see CommonXssUnitTest
*/
class ViewsHandlerTestXss extends ViewsSqlTest {
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_filter_combine.test b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_filter_combine.test
new file mode 100644
index 0000000..99bf1eb
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_filter_combine.test
@@ -0,0 +1,105 @@
+<?php
+
+/**
+ * @file
+ * Definition of ViewsHandlerFilterCombineTest.
+ */
+
+/**
+ * Tests the combine filter handler.
+ */
+class ViewsHandlerFilterCombineTest extends ViewsSqlTest {
+ var $column_map = array();
+
+ public static function getInfo() {
+ return array(
+ 'name' => 'Filter: Combine',
+ 'description' => 'Tests the combine filter handler.',
+ 'group' => 'Views Handlers',
+ );
+ }
+
+ function setUp() {
+ parent::setUp();
+ $this->column_map = array(
+ 'views_test_name' => 'name',
+ 'views_test_job' => 'job',
+ );
+ }
+
+ protected function getBasicView() {
+ $view = parent::getBasicView();
+ $fields = $view->display['default']->handler->options['fields'];
+ $view->display['default']->display_options['fields']['job'] = array(
+ 'id' => 'job',
+ 'table' => 'views_test',
+ 'field' => 'job',
+ 'relationship' => 'none',
+ );
+ return $view;
+ }
+
+ public function testFilterCombineContains() {
+ $view = $this->getBasicView();
+
+ // Change the filtering.
+ $view->display['default']->handler->override_option('filters', array(
+ 'age' => array(
+ 'id' => 'combine',
+ 'table' => 'views',
+ 'field' => 'combine',
+ 'relationship' => 'none',
+ 'operator' => 'contains',
+ 'fields' => array(
+ 'name',
+ 'job',
+ ),
+ 'value' => 'ing',
+ ),
+ ));
+
+ $this->executeView($view);
+ $resultset = array(
+ array(
+ 'name' => 'John',
+ 'job' => 'Singer',
+ ),
+ array(
+ 'name' => 'George',
+ 'job' => 'Singer',
+ ),
+ array(
+ 'name' => 'Ringo',
+ 'job' => 'Drummer',
+ ),
+ array(
+ 'name' => 'Ginger',
+ 'job' => NULL,
+ ),
+ );
+ $this->assertIdenticalResultset($view, $resultset, $this->column_map);
+ }
+
+ /**
+ * Additional data to test the NULL issue.
+ */
+ protected function dataSet() {
+ $data_set = parent::dataSet();
+ $data_set[] = array(
+ 'name' => 'Ginger',
+ 'age' => 25,
+ 'job' => NULL,
+ 'created' => gmmktime(0, 0, 0, 1, 2, 2000),
+ );
+ return $data_set;
+ }
+
+ /**
+ * Allow {views_test}.job to be NULL.
+ */
+ protected function schemaDefinition() {
+ $schema = parent::schemaDefinition();
+ unset($schema['views_test']['fields']['job']['not null']);
+ return $schema;
+ }
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_filter_date.test b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_filter_date.test
index 135ce4f..34ccba6 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_filter_date.test
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_filter_date.test
@@ -1,7 +1,12 @@
<?php
/**
- * Tests the handler filter_date.
+ * @file
+ * Definition of ViewsHandlerFilterDateTest.
+ */
+
+/**
+ * Tests the core views_handler_filter_date handler.
*/
class ViewsHandlerFilterDateTest extends ViewsSqlTest {
public static function getInfo() {
@@ -28,7 +33,7 @@ class ViewsHandlerFilterDateTest extends ViewsSqlTest {
}
/**
- /* Test the general offset functionality.
+ * Test the general offset functionality.
*/
function testOffset() {
$view = $this->views_test_offset();
@@ -62,7 +67,7 @@ class ViewsHandlerFilterDateTest extends ViewsSqlTest {
/**
- * Test the filter operator between/not between.
+ * Tests the filter operator between/not between.
*/
function testBetween() {
// Test between with min and max.
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;
+ }
+
}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_filter_in_operator.test b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_filter_in_operator.test
index 04ac5de..3a20f8c 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_filter_in_operator.test
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_filter_in_operator.test
@@ -1,5 +1,13 @@
<?php
+/**
+ * @file
+ * Definition of ViewsHandlerFilterInOperator.
+ */
+
+/**
+ * Tests the core views_handler_filter_in_operator handler.
+ */
class ViewsHandlerFilterInOperator extends ViewsSqlTest {
public static function getInfo() {
return array(
@@ -86,4 +94,103 @@ class ViewsHandlerFilterInOperator extends ViewsSqlTest {
'views_test_age' => 'age',
));
}
+
+ public function testFilterInOperatorGroupedExposedSimple() {
+ $filters = $this->getGroupedExposedFilters();
+ $view = $this->getBasicPageView();
+
+ // Filter: Age, Operator: in, Value: 26, 30
+ $filters['age']['group_info']['default_group'] = 1;
+ $view->set_display('page_1');
+ $view->display['page_1']->handler->override_option('filters', $filters);
+
+ $this->executeView($view);
+
+ $expected_result = array(
+ array(
+ 'name' => 'Paul',
+ 'age' => 26,
+ ),
+ array(
+ 'name' => 'Meredith',
+ 'age' => 30,
+ ),
+ );
+
+ $this->assertEqual(2, count($view->result));
+ $this->assertIdenticalResultset($view, $expected_result, array(
+ 'views_test_name' => 'name',
+ 'views_test_age' => 'age',
+ ));
+ }
+
+ public function testFilterNotInOperatorGroupedExposedSimple() {
+ $filters = $this->getGroupedExposedFilters();
+ $view = $this->getBasicPageView();
+
+ // Filter: Age, Operator: in, Value: 26, 30
+ $filters['age']['group_info']['default_group'] = 2;
+ $view->set_display('page_1');
+ $view->display['page_1']->handler->override_option('filters', $filters);
+
+ $this->executeView($view);
+
+ $expected_result = array(
+ array(
+ 'name' => 'John',
+ 'age' => 25,
+ ),
+ array(
+ 'name' => 'George',
+ 'age' => 27,
+ ),
+ array(
+ 'name' => 'Ringo',
+ 'age' => 28,
+ ),
+ );
+
+ $this->assertEqual(3, count($view->result));
+ $this->assertIdenticalResultset($view, $expected_result, array(
+ 'views_test_name' => 'name',
+ 'views_test_age' => 'age',
+ ));
+ }
+
+ protected function getGroupedExposedFilters() {
+ $filters = array(
+ 'age' => array(
+ 'id' => 'age',
+ 'table' => 'views_test',
+ 'field' => 'age',
+ 'relationship' => 'none',
+ 'exposed' => TRUE,
+ 'expose' => array(
+ 'operator' => 'age_op',
+ 'label' => 'age',
+ 'identifier' => 'age',
+ ),
+ 'is_grouped' => TRUE,
+ 'group_info' => array(
+ 'label' => 'age',
+ 'identifier' => 'age',
+ 'default_group' => 'All',
+ 'group_items' => array(
+ 1 => array(
+ 'title' => 'Age is one of 26, 30',
+ 'operator' => 'in',
+ 'value' => array(26, 30),
+ ),
+ 2 => array(
+ 'title' => 'Age is not one of 26, 30',
+ 'operator' => 'not in',
+ 'value' => array(26, 30),
+ ),
+ ),
+ ),
+ ),
+ );
+ return $filters;
+ }
+
}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_filter_numeric.test b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_filter_numeric.test
index 0112118..2ab1aea 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_filter_numeric.test
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_filter_numeric.test
@@ -1,11 +1,19 @@
<?php
+/**
+ * @file
+ * Definition of ViewsHandlerFilterNumericTest.
+ */
+
+/**
+ * Tests the numeric filter handler.
+ */
class ViewsHandlerFilterNumericTest extends ViewsSqlTest {
var $column_map = array();
public static function getInfo() {
return array(
- 'name' => 'Handlers: filter_numeric',
+ 'name' => 'Filter: Numeric',
'description' => 'Tests the numeric filter handler',
'group' => 'Views Handlers',
);
@@ -52,6 +60,25 @@ class ViewsHandlerFilterNumericTest extends ViewsSqlTest {
$this->assertIdenticalResultset($view, $resultset, $this->column_map);
}
+ public function testFilterNumericExposedGroupedSimple() {
+ $filters = $this->getGroupedExposedFilters();
+ $view = $this->getBasicPageView();
+
+ // Filter: Age, Operator: =, Value: 28
+ $filters['age']['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',
+ 'age' => 28,
+ ),
+ );
+ $this->assertIdenticalResultset($view, $resultset, $this->column_map);
+ }
+
public function testFilterNumericBetween() {
$view = $this->getBasicView();
@@ -124,6 +151,63 @@ class ViewsHandlerFilterNumericTest extends ViewsSqlTest {
$this->assertIdenticalResultset($view, $resultset, $this->column_map);
}
+ public function testFilterNumericExposedGroupedBetween() {
+ $filters = $this->getGroupedExposedFilters();
+ $view = $this->getBasicPageView();
+
+ // Filter: Age, Operator: between, Value: 26 and 29
+ $filters['age']['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' => 'George',
+ 'age' => 27,
+ ),
+ array(
+ 'name' => 'Ringo',
+ 'age' => 28,
+ ),
+ array(
+ 'name' => 'Paul',
+ 'age' => 26,
+ ),
+ );
+ $this->assertIdenticalResultset($view, $resultset, $this->column_map);
+ }
+
+ public function testFilterNumericExposedGroupedNotBetween() {
+ $filters = $this->getGroupedExposedFilters();
+ $view = $this->getBasicPageView();
+
+ // Filter: Age, Operator: between, Value: 26 and 29
+ $filters['age']['group_info']['default_group'] = 3;
+ $view->set_display('page_1');
+ $view->display['page_1']->handler->override_option('filters', $filters);
+
+
+ $this->executeView($view);
+ $resultset = array(
+ array(
+ 'name' => 'John',
+ 'age' => 25,
+ ),
+ array(
+ 'name' => 'Paul',
+ 'age' => 26,
+ ),
+ array(
+ 'name' => 'Meredith',
+ 'age' => 30,
+ ),
+ );
+ $this->assertIdenticalResultset($view, $resultset, $this->column_map);
+ }
+
+
public function testFilterNumericEmpty() {
$view = $this->getBasicView();
@@ -183,6 +267,60 @@ class ViewsHandlerFilterNumericTest extends ViewsSqlTest {
$this->assertIdenticalResultset($view, $resultset, $this->column_map);
}
+
+ public function testFilterNumericExposedGroupedEmpty() {
+ $filters = $this->getGroupedExposedFilters();
+ $view = $this->getBasicPageView();
+
+ // Filter: Age, Operator: empty, Value:
+ $filters['age']['group_info']['default_group'] = 4;
+ $view->set_display('page_1');
+ $view->display['page_1']->handler->override_option('filters', $filters);
+
+
+ $this->executeView($view);
+ $resultset = array(
+ );
+ $this->assertIdenticalResultset($view, $resultset, $this->column_map);
+ }
+
+ public function testFilterNumericExposedGroupedNotEmpty() {
+ $filters = $this->getGroupedExposedFilters();
+ $view = $this->getBasicPageView();
+
+ // Filter: Age, Operator: empty, Value:
+ $filters['age']['group_info']['default_group'] = 5;
+ $view->set_display('page_1');
+ $view->display['page_1']->handler->override_option('filters', $filters);
+
+
+ $this->executeView($view);
+ $resultset = array(
+ array(
+ 'name' => 'John',
+ 'age' => 25,
+ ),
+ array(
+ 'name' => 'George',
+ 'age' => 27,
+ ),
+ array(
+ 'name' => 'Ringo',
+ 'age' => 28,
+ ),
+ array(
+ 'name' => 'Paul',
+ 'age' => 26,
+ ),
+ array(
+ 'name' => 'Meredith',
+ 'age' => 30,
+ ),
+ );
+ $this->assertIdenticalResultset($view, $resultset, $this->column_map);
+ }
+
+
public function testAllowEmpty() {
$view = $this->getBasicView();
@@ -212,4 +350,60 @@ class ViewsHandlerFilterNumericTest extends ViewsSqlTest {
$this->assertTrue(isset($age_operators['empty']));
$this->assertTrue(isset($age_operators['not empty']));
}
+
+ protected function getGroupedExposedFilters() {
+ $filters = array(
+ 'age' => array(
+ 'id' => 'age',
+ 'table' => 'views_test',
+ 'field' => 'age',
+ 'relationship' => 'none',
+ 'exposed' => TRUE,
+ 'expose' => array(
+ 'operator' => 'age_op',
+ 'label' => 'age',
+ 'identifier' => 'age',
+ ),
+ 'is_grouped' => TRUE,
+ 'group_info' => array(
+ 'label' => 'age',
+ 'identifier' => 'age',
+ 'default_group' => 'All',
+ 'group_items' => array(
+ 1 => array(
+ 'title' => 'Age is 28',
+ 'operator' => '=',
+ 'value' => array('value' => 28),
+ ),
+ 2 => array(
+ 'title' => 'Age is between 26 and 29',
+ 'operator' => 'between',
+ 'value' => array(
+ 'min' => 26,
+ 'max' => 29,
+ ),
+ ),
+ 3 => array(
+ 'title' => 'Age is not between 26 and 29',
+ 'operator' => 'not between',
+ 'value' => array(
+ 'min' => 26,
+ 'max' => 29,
+ ),
+ ),
+ 4 => array(
+ 'title' => 'Age is empty',
+ 'operator' => 'empty',
+ ),
+ 5 => array(
+ 'title' => 'Age is not empty',
+ 'operator' => 'not empty',
+ ),
+ ),
+ ),
+ ),
+ );
+ return $filters;
+ }
+
}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_filter_string.test b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_filter_string.test
index cd78311..ee74a28 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_filter_string.test
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_filter_string.test
@@ -1,5 +1,13 @@
<?php
+/**
+ * @file
+ * Definition of ViewsHandlerFilterStringTest.
+ */
+
+/**
+ * Tests the core views_handler_filter_string handler.
+ */
class ViewsHandlerFilterStringTest extends ViewsSqlTest {
var $column_map = array();
@@ -86,9 +94,29 @@ class ViewsHandlerFilterStringTest extends ViewsSqlTest {
),
);
$this->assertIdenticalResultset($view, $resultset, $this->column_map);
- $view->destroy();
+ }
+
+ function testFilterStringGroupedExposedEqual() {
+ $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 testFilterStringNotEqual() {
$view = $this->getBasicView();
// Change the filtering
@@ -121,6 +149,36 @@ class ViewsHandlerFilterStringTest extends ViewsSqlTest {
$this->assertIdenticalResultset($view, $resultset, $this->column_map);
}
+ function testFilterStringGroupedExposedNotEqual() {
+ $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);
+ }
+
function testFilterStringContains() {
$view = $this->getBasicView();
@@ -145,6 +203,28 @@ class ViewsHandlerFilterStringTest extends ViewsSqlTest {
$this->assertIdenticalResultset($view, $resultset, $this->column_map);
}
+
+ function testFilterStringGroupedExposedContains() {
+ $filters = $this->getGroupedExposedFilters();
+ $view = $this->getBasicPageView();
+
+ // Filter: Name, Operator: contains, Value: ing
+ $filters['name']['group_info']['default_group'] = '3';
+ $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 testFilterStringWord() {
$view = $this->getBasicView();
@@ -195,6 +275,47 @@ class ViewsHandlerFilterStringTest extends ViewsSqlTest {
$this->assertIdenticalResultset($view, $resultset, $this->column_map);
}
+
+ function testFilterStringGroupedExposedWord() {
+ $filters = $this->getGroupedExposedFilters();
+ $view = $this->getBasicPageView();
+
+ // Filter: Name, Operator: contains, Value: ing
+ $filters['name']['group_info']['default_group'] = '3';
+ $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);
+ $view->destroy();
+
+ $filters = $this->getGroupedExposedFilters();
+ $view = $this->getBasicPageView();
+
+ // Filter: Description, Operator: contains, Value: actor
+ $filters['description']['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' => 'George',
+ ),
+ array(
+ 'name' => 'Ringo',
+ ),
+ );
+ $this->assertIdenticalResultset($view, $resultset, $this->column_map);
+ }
+
function testFilterStringStarts() {
$view = $this->getBasicView();
@@ -219,6 +340,25 @@ class ViewsHandlerFilterStringTest extends ViewsSqlTest {
$this->assertIdenticalResultset($view, $resultset, $this->column_map);
}
+ function testFilterStringGroupedExposedStarts() {
+ $filters = $this->getGroupedExposedFilters();
+ $view = $this->getBasicPageView();
+
+ // Filter: Name, Operator: starts, Value: George
+ $filters['description']['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' => 'George',
+ ),
+ );
+ $this->assertIdenticalResultset($view, $resultset, $this->column_map);
+ }
+
function testFilterStringNotStarts() {
$view = $this->getBasicView();
@@ -250,6 +390,32 @@ class ViewsHandlerFilterStringTest extends ViewsSqlTest {
$this->assertIdenticalResultset($view, $resultset, $this->column_map);
}
+ function testFilterStringGroupedExposedNotStarts() {
+ $filters = $this->getGroupedExposedFilters();
+ $view = $this->getBasicPageView();
+
+ // Filter: Name, Operator: not_starts, Value: George
+ $filters['description']['group_info']['default_group'] = 3;
+ $view->set_display('page_1');
+ $view->display['page_1']->handler->override_option('filters', $filters);
+
+ $this->executeView($view);
+
+ $resultset = array(
+ array(
+ 'name' => 'John',
+ ),
+ array(
+ 'name' => 'Ringo',
+ ),
+ array(
+ 'name' => 'Paul',
+ ),
+ // There is no Meredith returned because his description is empty
+ );
+ $this->assertIdenticalResultset($view, $resultset, $this->column_map);
+ }
+
function testFilterStringEnds() {
$view = $this->getBasicView();
@@ -277,6 +443,28 @@ class ViewsHandlerFilterStringTest extends ViewsSqlTest {
$this->assertIdenticalResultset($view, $resultset, $this->column_map);
}
+ function testFilterStringGroupedExposedEnds() {
+ $filters = $this->getGroupedExposedFilters();
+ $view = $this->getBasicPageView();
+
+ // Filter: Descriptino, Operator: ends, Value: Beatles
+ $filters['description']['group_info']['default_group'] = 4;
+ $view->set_display('page_1');
+ $view->display['page_1']->handler->override_option('filters', $filters);
+
+ $this->executeView($view);
+
+ $resultset = array(
+ array(
+ 'name' => 'George',
+ ),
+ array(
+ 'name' => 'Ringo',
+ ),
+ );
+ $this->assertIdenticalResultset($view, $resultset, $this->column_map);
+ }
+
function testFilterStringNotEnds() {
$view = $this->getBasicView();
@@ -305,6 +493,29 @@ class ViewsHandlerFilterStringTest extends ViewsSqlTest {
$this->assertIdenticalResultset($view, $resultset, $this->column_map);
}
+ function testFilterStringGroupedExposedNotEnds() {
+ $filters = $this->getGroupedExposedFilters();
+ $view = $this->getBasicPageView();
+
+ // Filter: Description, Operator: not_ends, Value: Beatles
+ $filters['description']['group_info']['default_group'] = 5;
+ $view->set_display('page_1');
+ $view->display['page_1']->handler->override_option('filters', $filters);
+
+ $this->executeView($view);
+
+ $resultset = array(
+ array(
+ 'name' => 'John',
+ ),
+ array(
+ 'name' => 'Paul',
+ ),
+ // There is no Meredith returned because his description is empty
+ );
+ $this->assertIdenticalResultset($view, $resultset, $this->column_map);
+ }
+
function testFilterStringNot() {
$view = $this->getBasicView();
@@ -333,6 +544,31 @@ class ViewsHandlerFilterStringTest extends ViewsSqlTest {
$this->assertIdenticalResultset($view, $resultset, $this->column_map);
}
+
+ function testFilterStringGroupedExposedNot() {
+ $filters = $this->getGroupedExposedFilters();
+ $view = $this->getBasicPageView();
+
+ // Filter: Description, Operator: not (does not contains), Value: Beatles
+ $filters['description']['group_info']['default_group'] = 6;
+ $view->set_display('page_1');
+ $view->display['page_1']->handler->override_option('filters', $filters);
+
+ $this->executeView($view);
+
+ $resultset = array(
+ array(
+ 'name' => 'John',
+ ),
+ array(
+ 'name' => 'Paul',
+ ),
+ // There is no Meredith returned because his description is empty
+ );
+ $this->assertIdenticalResultset($view, $resultset, $this->column_map);
+
+ }
+
function testFilterStringShorter() {
$view = $this->getBasicView();
@@ -360,6 +596,27 @@ class ViewsHandlerFilterStringTest extends ViewsSqlTest {
$this->assertIdenticalResultset($view, $resultset, $this->column_map);
}
+ function testFilterStringGroupedExposedShorter() {
+ $filters = $this->getGroupedExposedFilters();
+ $view = $this->getBasicPageView();
+
+ // Filter: Name, Operator: shorterthan, Value: 5
+ $filters['name']['group_info']['default_group'] = 4;
+ $view->set_display('page_1');
+ $view->display['page_1']->handler->override_option('filters', $filters);
+
+ $this->executeView($view);
+ $resultset = array(
+ array(
+ 'name' => 'John',
+ ),
+ array(
+ 'name' => 'Paul',
+ ),
+ );
+ $this->assertIdenticalResultset($view, $resultset, $this->column_map);
+ }
+
function testFilterStringLonger() {
$view = $this->getBasicView();
@@ -384,6 +641,25 @@ class ViewsHandlerFilterStringTest extends ViewsSqlTest {
$this->assertIdenticalResultset($view, $resultset, $this->column_map);
}
+ function testFilterStringGroupedExposedLonger() {
+ $filters = $this->getGroupedExposedFilters();
+ $view = $this->getBasicPageView();
+
+ // Filter: Name, Operator: longerthan, Value: 4
+ $filters['name']['group_info']['default_group'] = 5;
+ $view->set_display('page_1');
+ $view->display['page_1']->handler->override_option('filters', $filters);
+
+ $this->executeView($view);
+ $resultset = array(
+ array(
+ 'name' => 'Meredith',
+ ),
+ );
+ $this->assertIdenticalResultset($view, $resultset, $this->column_map);
+ }
+
+
function testFilterStringEmpty() {
$view = $this->getBasicView();
@@ -406,4 +682,129 @@ class ViewsHandlerFilterStringTest extends ViewsSqlTest {
);
$this->assertIdenticalResultset($view, $resultset, $this->column_map);
}
+
+ function testFilterStringGroupedExposedEmpty() {
+ $filters = $this->getGroupedExposedFilters();
+ $view = $this->getBasicPageView();
+
+ // Filter: Description, Operator: empty, Value:
+ $filters['description']['group_info']['default_group'] = 7;
+ $view->set_display('page_1');
+ $view->display['page_1']->handler->override_option('filters', $filters);
+
+ $this->executeView($view);
+ $resultset = array(
+ 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' => 'Is Ringo',
+ 'operator' => '=',
+ 'value' => 'Ringo',
+ ),
+ 2 => array(
+ 'title' => 'Is not Ringo',
+ 'operator' => '!=',
+ 'value' => array('value' => 'Ringo'),
+ ),
+ 3 => array(
+ 'title' => 'Contains ing',
+ 'operator' => 'contains',
+ 'value' => 'ing',
+ ),
+ 4 => array(
+ 'title' => 'Shorter than 5 letters',
+ 'operator' => 'shorterthan',
+ 'value' => 5,
+ ),
+ 5 => array(
+ 'title' => 'Longer than 7 letters',
+ 'operator' => 'longerthan',
+ 'value' => 7,
+ ),
+ ),
+ ),
+ ),
+ 'description' => array(
+ 'id' => 'description',
+ 'table' => 'views_test',
+ 'field' => 'description',
+ 'relationship' => 'none',
+ 'exposed' => TRUE,
+ 'expose' => array(
+ 'operator' => 'description_op',
+ 'label' => 'description',
+ 'identifier' => 'description',
+ ),
+ 'is_grouped' => TRUE,
+ 'group_info' => array(
+ 'label' => 'description',
+ 'identifier' => 'description',
+ 'default_group' => 'All',
+ 'group_items' => array(
+ 1 => array(
+ 'title' => 'Contains the word: Actor',
+ 'operator' => 'word',
+ 'value' => 'actor',
+ ),
+ 2 => array(
+ 'title' => 'Starts with George',
+ 'operator' => 'starts',
+ 'value' => 'George',
+ ),
+ 3 => array(
+ 'title' => 'Not Starts with: George',
+ 'operator' => 'not_starts',
+ 'value' => 'George',
+ ),
+ 4 => array(
+ 'title' => 'Ends with: Beatles',
+ 'operator' => 'ends',
+ 'value' => 'Beatles.',
+ ),
+ 5 => array(
+ 'title' => 'Not Ends with: Beatles',
+ 'operator' => 'not_ends',
+ 'value' => 'Beatles.',
+ ),
+ 6 => array(
+ 'title' => 'Does not contain: Beatles',
+ 'operator' => 'not',
+ 'value' => 'Beatles.',
+ ),
+ 7 => array(
+ 'title' => 'Empty description',
+ 'operator' => 'empty',
+ 'value' => '',
+ ),
+ ),
+ ),
+ ),
+ );
+ return $filters;
+ }
+
}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_sort.test b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_sort.test
index aa63a9a..70f2aac 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_sort.test
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_sort.test
@@ -1,7 +1,12 @@
<?php
/**
- * Test for core views_handler_sort handler.
+ * @file
+ * Definition of ViewsHandlerSortTest.
+ */
+
+/**
+ * Tests for core views_handler_sort handler.
*/
class ViewsHandlerSortTest extends ViewsSqlTest {
public static function getInfo() {
@@ -13,7 +18,7 @@ class ViewsHandlerSortTest extends ViewsSqlTest {
}
/**
- * Test numeric ordering of the result set.
+ * Tests numeric ordering of the result set.
*/
public function testNumericOrdering() {
$view = $this->getBasicView();
@@ -64,7 +69,7 @@ class ViewsHandlerSortTest extends ViewsSqlTest {
}
/**
- * Test string ordering of the result set.
+ * Tests string ordering of the result set.
*/
public function testStringOrdering() {
$view = $this->getBasicView();
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_sort_date.test b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_sort_date.test
index 528c85a..65a94e8 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_sort_date.test
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_sort_date.test
@@ -1,7 +1,12 @@
<?php
/**
- * Test for core views_handler_sort_date handler.
+ * @file
+ * Definition of ViewsHandlerSortDateTest.
+ */
+
+/**
+ * Tests for core views_handler_sort_date handler.
*/
class ViewsHandlerSortDateTest extends ViewsSqlTest {
public static function getInfo() {
@@ -135,7 +140,7 @@ class ViewsHandlerSortDateTest extends ViewsSqlTest {
}
/**
- * Test numeric ordering of the result set.
+ * Tests numeric ordering of the result set.
*/
public function testDateOrdering() {
foreach (array('second', 'minute', 'hour', 'day', 'month', 'year') as $granularity) {
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_sort_random.test b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_sort_random.test
index 18677a0..19db8a9 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_sort_random.test
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/handlers/views_handler_sort_random.test
@@ -1,7 +1,12 @@
<?php
/**
- * Test for core views_handler_sort_random handler.
+ * @file
+ * Definition of ViewsHandlerSortRandomTest.
+ */
+
+/**
+ * Tests for core views_handler_sort_random handler.
*/
class ViewsHandlerSortRandomTest extends ViewsSqlTest {
public static function getInfo() {
@@ -47,9 +52,9 @@ class ViewsHandlerSortRandomTest extends ViewsSqlTest {
}
/**
- * Test random ordering of the result set.
+ * Tests random ordering of the result set.
*
- * @see DatabaseSelectTestCase::testRandomOrder().
+ * @see DatabaseSelectTestCase::testRandomOrder()
*/
public function testRandomOrdering() {
// Execute a basic view first.
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/plugins/views_plugin_display.test b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/plugins/views_plugin_display.test
new file mode 100644
index 0000000..df33a34
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/plugins/views_plugin_display.test
@@ -0,0 +1,194 @@
+<?php
+
+/**
+ * @file
+ * Definition of ViewsPluginDisplayTestCase.
+ */
+
+/**
+ *
+ */
+class ViewsPluginDisplayTestCase extends ViewsSqlTest {
+
+ public static function getInfo() {
+ return array(
+ 'name' => 'Display plugin',
+ 'description' => 'Tests the basic display plugin.',
+ 'group' => 'Views Plugins',
+ );
+ }
+
+ /**
+ * Tests the overriding of filter_groups.
+ */
+ function testFilterGroupsOverriding() {
+ $view = $this->viewFilterGroupsUpdating();
+ $view->init_display();
+
+ // mark is as overridden, yes FALSE, means overridden.
+ $view->display['page']->handler->set_override('filter_groups', FALSE);
+ $this->assertFalse($view->display['page']->handler->is_defaulted('filter_groups'), "Take sure that 'filter_groups' is marked as overridden.");
+ $this->assertFalse($view->display['page']->handler->is_defaulted('filters'), "Take sure that 'filters'' is marked as overridden.");
+ }
+
+ /**
+ * Returns a test view for testFilterGroupsOverriding.
+ *
+ * @see testFilterGroupsOverriding
+ * @return view
+ */
+ function viewFilterGroupsOverriding() {
+ $view = new view();
+ $view->name = 'test_filter_group_override';
+ $view->description = '';
+ $view->tag = 'default';
+ $view->base_table = 'node';
+ $view->human_name = 'test_filter_group_override';
+ $view->core = 7;
+ $view->api_version = '3.0';
+ $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
+
+ /* Display: Master */
+ $handler = $view->new_display('default', 'Master', 'default');
+ $handler->display->display_options['access']['type'] = 'perm';
+ $handler->display->display_options['cache']['type'] = 'none';
+ $handler->display->display_options['query']['type'] = 'views_query';
+ $handler->display->display_options['exposed_form']['type'] = 'basic';
+ $handler->display->display_options['pager']['type'] = 'full';
+ $handler->display->display_options['style_plugin'] = 'default';
+ $handler->display->display_options['row_plugin'] = 'fields';
+ /* Field: Content: Title */
+ $handler->display->display_options['fields']['title']['id'] = 'title';
+ $handler->display->display_options['fields']['title']['table'] = 'node';
+ $handler->display->display_options['fields']['title']['field'] = 'title';
+ $handler->display->display_options['fields']['title']['label'] = '';
+ $handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
+ $handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
+ /* Filter criterion: Content: Published */
+ $handler->display->display_options['filters']['status']['id'] = 'status';
+ $handler->display->display_options['filters']['status']['table'] = 'node';
+ $handler->display->display_options['filters']['status']['field'] = 'status';
+ $handler->display->display_options['filters']['status']['value'] = 1;
+ $handler->display->display_options['filters']['status']['group'] = 1;
+ $handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
+
+ /* Display: Page */
+ $handler = $view->new_display('page', 'Page', 'page_1');
+ $handler->display->display_options['path'] = 'test';
+
+ return $view;
+ }
+
+ /**
+ * Based on a bug some filter_groups landed in the overridden display, even the filters weren't overridden.
+ * This caused multiple issues.
+ * Take sure that the value from the default display are used.
+ *
+ * @see http://drupal.org/node/1259608
+ * @see views_plugin_display::init()
+ */
+ function testFilterGroupsUpdating() {
+ $view = $this->viewFilterGroupsUpdating();
+ $view->init_display();
+
+ $this->assertFalse($view->display['page']->handler->options['defaults']['filter_groups']);
+ $this->assertEqual($view->display['default']->handler->options['filter_groups'], $view->display['page']->handler->options['filter_groups'], 'Take sure the default options are used for the filter_groups');
+ }
+
+ /**
+ * Returns a test view for testFilterGroupUpdating.
+ *
+ * @see testFilterGroupUpdating
+ *
+ * @return view
+ */
+ function viewFilterGroupsUpdating() {
+ $view = new view();
+ $view->name = 'test_filter_groups';
+ $view->description = '';
+ $view->tag = 'default';
+ $view->base_table = 'node';
+ $view->human_name = 'test_filter_groups';
+ $view->core = 7;
+ $view->api_version = '3.0';
+ $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
+
+ /* Display: Master */
+ $handler = $view->new_display('default', 'Master', 'default');
+ $handler->display->display_options['title'] = 'test_filter_groups';
+ $handler->display->display_options['access']['type'] = 'perm';
+ $handler->display->display_options['cache']['type'] = 'none';
+ $handler->display->display_options['query']['type'] = 'views_query';
+ $handler->display->display_options['exposed_form']['type'] = 'basic';
+ $handler->display->display_options['pager']['type'] = 'full';
+ $handler->display->display_options['pager']['options']['items_per_page'] = '10';
+ $handler->display->display_options['style_plugin'] = 'default';
+ $handler->display->display_options['row_plugin'] = 'node';
+ /* Field: Content: Title */
+ $handler->display->display_options['fields']['title']['id'] = 'title';
+ $handler->display->display_options['fields']['title']['table'] = 'node';
+ $handler->display->display_options['fields']['title']['field'] = 'title';
+ $handler->display->display_options['fields']['title']['label'] = '';
+ $handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
+ $handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
+ /* Sort criterion: Content: Post date */
+ $handler->display->display_options['sorts']['created']['id'] = 'created';
+ $handler->display->display_options['sorts']['created']['table'] = 'node';
+ $handler->display->display_options['sorts']['created']['field'] = 'created';
+ $handler->display->display_options['sorts']['created']['order'] = 'DESC';
+ $handler->display->display_options['filter_groups']['groups'] = array(
+ 1 => 'AND',
+ 2 => 'AND',
+ );
+ /* Filter criterion: Content: Published */
+ $handler->display->display_options['filters']['status']['id'] = 'status';
+ $handler->display->display_options['filters']['status']['table'] = 'node';
+ $handler->display->display_options['filters']['status']['field'] = 'status';
+ $handler->display->display_options['filters']['status']['value'] = 1;
+ $handler->display->display_options['filters']['status']['group'] = 1;
+ $handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
+ /* Filter criterion: Content: Nid */
+ $handler->display->display_options['filters']['nid']['id'] = 'nid';
+ $handler->display->display_options['filters']['nid']['table'] = 'node';
+ $handler->display->display_options['filters']['nid']['field'] = 'nid';
+ $handler->display->display_options['filters']['nid']['value']['value'] = '1';
+ $handler->display->display_options['filters']['nid']['group'] = 2;
+ /* Filter criterion: Content: Nid */
+ $handler->display->display_options['filters']['nid_1']['id'] = 'nid_1';
+ $handler->display->display_options['filters']['nid_1']['table'] = 'node';
+ $handler->display->display_options['filters']['nid_1']['field'] = 'nid';
+ $handler->display->display_options['filters']['nid_1']['value']['value'] = '2';
+ $handler->display->display_options['filters']['nid_1']['group'] = 2;
+
+ /* Display: Page */
+ $handler = $view->new_display('page', 'Page', 'page');
+ $handler->display->display_options['filter_groups']['operator'] = 'OR';
+ $handler->display->display_options['filter_groups']['groups'] = array(
+ 1 => 'OR',
+ 2 => 'OR',
+ );
+ $handler->display->display_options['defaults']['filters'] = FALSE;
+ /* Filter criterion: Content: Published */
+ $handler->display->display_options['filters']['status']['id'] = 'status';
+ $handler->display->display_options['filters']['status']['table'] = 'node';
+ $handler->display->display_options['filters']['status']['field'] = 'status';
+ $handler->display->display_options['filters']['status']['value'] = 1;
+ $handler->display->display_options['filters']['status']['group'] = 1;
+ $handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
+ /* Filter criterion: Content: Nid */
+ $handler->display->display_options['filters']['nid']['id'] = 'nid';
+ $handler->display->display_options['filters']['nid']['table'] = 'node';
+ $handler->display->display_options['filters']['nid']['field'] = 'nid';
+ $handler->display->display_options['filters']['nid']['value']['value'] = '1';
+ $handler->display->display_options['filters']['nid']['group'] = 2;
+ /* Filter criterion: Content: Nid */
+ $handler->display->display_options['filters']['nid_1']['id'] = 'nid_1';
+ $handler->display->display_options['filters']['nid_1']['table'] = 'node';
+ $handler->display->display_options['filters']['nid_1']['field'] = 'nid';
+ $handler->display->display_options['filters']['nid_1']['value']['value'] = '2';
+ $handler->display->display_options['filters']['nid_1']['group'] = 2;
+ $handler->display->display_options['path'] = 'test-filter-groups';
+
+ return $view;
+ }
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/styles/views_plugin_style.test b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/styles/views_plugin_style.test
index 875fcf1..87f5b7d 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/styles/views_plugin_style.test
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/styles/views_plugin_style.test
@@ -2,6 +2,10 @@
/**
* @file
+ * Definition of ViewsPluginStyleTestCase.
+ */
+
+/**
* Tests some general style plugin related functionality.
*/
class ViewsPluginStyleTestCase extends ViewsSqlTest {
@@ -227,4 +231,48 @@ class ViewsPluginStyleTestCase extends ViewsSqlTest {
$this->assertEqual($sets_new_value, $expected, t('The style plugins should proper group the results with grouping by the value.'));
}
}
+
+
+ /**
+ * Stores a view output in the elements.
+ */
+ function storeViewPreview($output) {
+ $htmlDom = new DOMDocument();
+ @$htmlDom->loadHTML($output);
+ if ($htmlDom) {
+ // It's much easier to work with simplexml than DOM, luckily enough
+ // we can just simply import our DOM tree.
+ $this->elements = simplexml_import_dom($htmlDom);
+ }
+ }
+
+ /**
+ * Tests custom css classes.
+ */
+ function testCustomRowClasses() {
+ $view = $this->getBasicView();
+
+ // Setup some random css class.
+ $view->init_display();
+ $view->init_style();
+ $random_name = $this->randomName();
+ $view->style_plugin->options['row_class'] = $random_name . " test-token-[name]";
+
+ $rendered_output = $view->preview();
+ $this->storeViewPreview($rendered_output);
+
+ $rows = $this->elements->body->div->div->div;
+ $count = 0;
+ foreach ($rows as $row) {
+ $attributes = $row->attributes();
+ $class = (string) $attributes['class'][0];
+ $this->assertTrue(strpos($class, $random_name) !== FALSE, 'Take sure that a custom css class is added to the output.');
+
+ // Check token replacement.
+ $name = $view->field['name']->get_value($view->result[$count]);
+ $this->assertTrue(strpos($class, "test-token-$name") !== FALSE, 'Take sure that a token in custom css class is replaced.');
+
+ $count++;
+ }
+ }
}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/styles/views_plugin_style_jump_menu.test b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/styles/views_plugin_style_jump_menu.test
index 03495c3..9a53bfc 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/styles/views_plugin_style_jump_menu.test
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/styles/views_plugin_style_jump_menu.test
@@ -1,5 +1,13 @@
<?php
+/**
+ * @file
+ * Definition of viewsPluginStyleJumpMenuTest.
+ */
+
+/**
+ * Tests jump menu style functionality.
+ */
class viewsPluginStyleJumpMenuTest extends ViewsSqlTest {
public static function getInfo() {
return array(
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/styles/views_plugin_style_unformatted.test b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/styles/views_plugin_style_unformatted.test
new file mode 100644
index 0000000..20b7b4d
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/styles/views_plugin_style_unformatted.test
@@ -0,0 +1,73 @@
+<?php
+
+/**
+ * @file
+ * Definition of ViewsPluginStyleUnformattedTestCase.
+ */
+
+/**
+ * Tests the default/unformatted row style.
+ */
+class ViewsPluginStyleUnformattedTestCase extends ViewsSqlTest {
+
+ /**
+ * Stores all created nodes.
+ *
+ * @var array
+ */
+ var $nodes;
+
+ public static function getInfo() {
+ return array(
+ 'name' => 'Style: unformatted',
+ 'description' => 'Test unformatted style functionality.',
+ 'group' => 'Views Plugins',
+ );
+ }
+
+ /**
+ * Stores a view output in the elements.
+ */
+ function storeViewPreview($output) {
+ $htmlDom = new DOMDocument();
+ @$htmlDom->loadHTML($output);
+ if ($htmlDom) {
+ // It's much easier to work with simplexml than DOM, luckily enough
+ // we can just simply import our DOM tree.
+ $this->elements = simplexml_import_dom($htmlDom);
+ }
+ }
+
+ /**
+ * Take sure that the default css classes works as expected.
+ */
+ function testDefaultRowClasses() {
+ $view = $this->getBasicView();
+ $rendered_output = $view->preview();
+ $this->storeViewPreview($rendered_output);
+
+ $rows = $this->elements->body->div->div->div;
+ $count = 0;
+ $count_result = count($view->result);
+ foreach ($rows as $row) {
+ $count++;
+ $attributes = $row->attributes();
+ $class = (string) $attributes['class'][0];
+ // Take sure that each row has a row css class.
+ $this->assertTrue(strpos($class, "views-row-$count") !== FALSE, 'Take sure that each row has a row css class.');
+ // Take sure that the odd/even classes are set right.
+ $odd_even = $count % 2 == 0 ? 'even' : 'odd';
+ $this->assertTrue(strpos($class, "views-row-$odd_even") !== FALSE, 'Take sure that the odd/even classes are set right.');
+
+ if ($count == 1) {
+ $this->assertTrue(strpos($class, "views-row-first") !== FALSE, 'Take sure that the first class is set right.');
+ }
+ else if ($count == $count_result) {
+ $this->assertTrue(strpos($class, "views-row-last") !== FALSE, 'Take sure that the last class is set right.');
+
+ }
+ $this->assertTrue(strpos($class, 'views-row') !== FALSE, 'Take sure that the views row class is set right.');
+ }
+ }
+
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/taxonomy/views_handler_relationship_node_term_data.test b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/taxonomy/views_handler_relationship_node_term_data.test
new file mode 100644
index 0000000..37e8aa6
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/taxonomy/views_handler_relationship_node_term_data.test
@@ -0,0 +1,122 @@
+<?php
+
+/**
+ * @file
+ * Definition of ViewsHandlerRelationshipNodeTermDataTest.
+ */
+
+/**
+ * Tests the relationship_node_term_data handler.
+ */
+class ViewsHandlerRelationshipNodeTermDataTest extends ViewsSqlTest {
+ public static function getInfo() {
+ return array(
+ 'name' => 'Tests handler relationship_node_term_data',
+ 'description' => 'Tests the taxonomy term on node relationship handler',
+ 'group' => 'Views Modules',
+ );
+ }
+
+ /**
+ * Returns a new term with random properties in vocabulary $vid.
+ */
+ function createTerm($vocabulary) {
+ $term = new stdClass();
+ $term->name = $this->randomName();
+ $term->description = $this->randomName();
+ // Use the first available text format.
+ $term->format = db_query_range('SELECT format FROM {filter_format}', 0, 1)->fetchField();
+ $term->vid = $vocabulary->vid;
+ taxonomy_term_save($term);
+ return $term;
+ }
+
+ function setUp() {
+ parent::setUp();
+
+ //$web_user = $this->drupalCreateUser(array('create article content'));
+ //$this->drupalLogin($web_user);
+
+ $vocabulary = taxonomy_vocabulary_machine_name_load('tags');
+ $this->term_1 = $this->createTerm($vocabulary);
+ $this->term_2 = $this->createTerm($vocabulary);
+
+ $node = array();
+ $node['type'] = 'article';
+ $node['field_tags'][LANGUAGE_NONE][]['tid'] = $this->term_1->tid;
+ $node['field_tags'][LANGUAGE_NONE][]['tid'] = $this->term_2->tid;
+ $this->node = $this->drupalCreateNode($node);
+ }
+
+ function testViewsHandlerRelationshipNodeTermData() {
+ $view = $this->view_taxonomy_node_term_data();
+
+ $this->executeView($view, array($this->term_1->tid, $this->term_2->tid));
+ $resultset = array(
+ array(
+ 'nid' => $this->node->nid,
+ ),
+ );
+ $this->column_map = array('nid' => 'nid');
+ debug($view->result);
+ $this->assertIdenticalResultset($view, $resultset, $this->column_map);
+ }
+
+ function view_taxonomy_node_term_data() {
+ $view = new view();
+ $view->name = 'test_taxonomy_node_term_data';
+ $view->description = '';
+ $view->tag = '';
+ $view->base_table = 'node';
+ $view->human_name = 'test_taxonomy_node_term_data';
+ $view->core = 7;
+ $view->api_version = '3.0';
+ $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
+
+ /* Display: Master */
+ $handler = $view->new_display('default', 'Master', 'default');
+ $handler->display->display_options['access']['type'] = 'perm';
+ $handler->display->display_options['cache']['type'] = 'none';
+ $handler->display->display_options['query']['type'] = 'views_query';
+ $handler->display->display_options['exposed_form']['type'] = 'basic';
+ $handler->display->display_options['pager']['type'] = 'full';
+ $handler->display->display_options['style_plugin'] = 'default';
+ $handler->display->display_options['row_plugin'] = 'node';
+ /* Relationship: Content: Taxonomy terms on node */
+ $handler->display->display_options['relationships']['term_node_tid']['id'] = 'term_node_tid';
+ $handler->display->display_options['relationships']['term_node_tid']['table'] = 'node';
+ $handler->display->display_options['relationships']['term_node_tid']['field'] = 'term_node_tid';
+ $handler->display->display_options['relationships']['term_node_tid']['label'] = 'Term #1';
+ $handler->display->display_options['relationships']['term_node_tid']['vocabularies'] = array(
+ 'tags' => 0,
+ );
+ /* Relationship: Content: Taxonomy terms on node */
+ $handler->display->display_options['relationships']['term_node_tid_1']['id'] = 'term_node_tid_1';
+ $handler->display->display_options['relationships']['term_node_tid_1']['table'] = 'node';
+ $handler->display->display_options['relationships']['term_node_tid_1']['field'] = 'term_node_tid';
+ $handler->display->display_options['relationships']['term_node_tid_1']['label'] = 'Term #2';
+ $handler->display->display_options['relationships']['term_node_tid_1']['vocabularies'] = array(
+ 'tags' => 0,
+ );
+ /* Contextual filter: Taxonomy term: Term ID */
+ $handler->display->display_options['arguments']['tid']['id'] = 'tid';
+ $handler->display->display_options['arguments']['tid']['table'] = 'taxonomy_term_data';
+ $handler->display->display_options['arguments']['tid']['field'] = 'tid';
+ $handler->display->display_options['arguments']['tid']['relationship'] = 'term_node_tid';
+ $handler->display->display_options['arguments']['tid']['default_argument_type'] = 'fixed';
+ $handler->display->display_options['arguments']['tid']['summary']['number_of_records'] = '0';
+ $handler->display->display_options['arguments']['tid']['summary']['format'] = 'default_summary';
+ $handler->display->display_options['arguments']['tid']['summary_options']['items_per_page'] = '25';
+ /* Contextual filter: Taxonomy term: Term ID */
+ $handler->display->display_options['arguments']['tid_1']['id'] = 'tid_1';
+ $handler->display->display_options['arguments']['tid_1']['table'] = 'taxonomy_term_data';
+ $handler->display->display_options['arguments']['tid_1']['field'] = 'tid';
+ $handler->display->display_options['arguments']['tid_1']['relationship'] = 'term_node_tid_1';
+ $handler->display->display_options['arguments']['tid_1']['default_argument_type'] = 'fixed';
+ $handler->display->display_options['arguments']['tid_1']['summary']['number_of_records'] = '0';
+ $handler->display->display_options['arguments']['tid_1']['summary']['format'] = 'default_summary';
+ $handler->display->display_options['arguments']['tid_1']['summary_options']['items_per_page'] = '25';
+
+ return $view;
+ }
+} \ No newline at end of file
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/templates/views-view--frontpage.tpl.php b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/templates/views-view--frontpage.tpl.php
index 00d5f64..eb4f58b 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/templates/views-view--frontpage.tpl.php
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/templates/views-view--frontpage.tpl.php
@@ -1,7 +1,8 @@
<?php
+
/**
- * @file views-view.tpl.php
- * Main view template
+ * @file
+ * Main view template.
*
* Variables available:
* - $classes_array: An array of classes determined in
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/test_plugins/views_test_plugin_access_test_dynamic.inc b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/test_plugins/views_test_plugin_access_test_dynamic.inc
index 82b4548..cecec2f 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/test_plugins/views_test_plugin_access_test_dynamic.inc
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/test_plugins/views_test_plugin_access_test_dynamic.inc
@@ -1,9 +1,17 @@
<?php
+/**
+ * @file
+ * Definition of views_test_plugin_access_test_dynamic.
+ */
+
+/**
+ * Tests a dynamic access plugin.
+ */
class views_test_plugin_access_test_dynamic extends views_plugin_access {
function option_definition() {
$options = parent::option_definition();
- $options['access'] = array('default' => FALSE);
+ $options['access'] = array('default' => FALSE, 'bool' => TRUE);
return $options;
}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/test_plugins/views_test_plugin_access_test_static.inc b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/test_plugins/views_test_plugin_access_test_static.inc
index 5d99731..187d6ea 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/test_plugins/views_test_plugin_access_test_static.inc
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/test_plugins/views_test_plugin_access_test_static.inc
@@ -1,9 +1,17 @@
<?php
+/**
+ * @file
+ * Definition of views_test_plugin_access_test_static.
+ */
+
+/**
+ * Tests a static access plugin.
+ */
class views_test_plugin_access_test_static extends views_plugin_access {
function option_definition() {
$options = parent::option_definition();
- $options['access'] = array('default' => FALSE);
+ $options['access'] = array('default' => FALSE, 'bool' => TRUE);
return $options;
}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/user/views_handler_field_user_name.test b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/user/views_handler_field_user_name.test
index f627ea2..6ace471 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/user/views_handler_field_user_name.test
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/user/views_handler_field_user_name.test
@@ -1,6 +1,11 @@
<?php
/**
+ * @file
+ * Definition of viewsHandlerFieldUserNameTest.
+ */
+
+/**
* Tests the field username handler.
*
* @see views_handler_field_user_name
@@ -17,8 +22,7 @@ class viewsHandlerFieldUserNameTest extends ViewsSqlTest {
function testUserName() {
$view = $this->view_user_name();
$view->init_display();
- $view->pre_execute();
- $view->execute();
+ $this->executeView($view);
$view->row_index = 0;
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/user/views_user.test b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/user/views_user.test
index 286e2df..52c5026 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/user/views_user.test
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/user/views_user.test
@@ -2,9 +2,12 @@
/**
* @file
- * Tests basic user module integration into views.
+ * Definition of ViewsUserTestCase.
*/
+/**
+ * Tests basic user module integration into views.
+ */
class ViewsUserTestCase extends ViewsSqlTest {
var $users = array();
var $nodes = array();
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/user/views_user_argument_default.test b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/user/views_user_argument_default.test
index 4159b59..afb24d1 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/user/views_user_argument_default.test
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/user/views_user_argument_default.test
@@ -2,9 +2,12 @@
/**
* @file
- * Tests views user argument default plugin.
+ * Definition of ViewsUserArgumentDefault.
*/
+/**
+ * Tests views user argument default plugin.
+ */
class ViewsUserArgumentDefault extends ViewsSqlTest {
public static function getInfo() {
return array(
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/user/views_user_argument_validate.test b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/user/views_user_argument_validate.test
index 3c36b3a..6e157bf 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/user/views_user_argument_validate.test
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/user/views_user_argument_validate.test
@@ -2,10 +2,12 @@
/**
* @file
- * Tests views user argument argument handler.
+ * Definition of ViewsUserArgumentValidate.
*/
-
+/**
+ * Tests views user argument argument handler.
+ */
class ViewsUserArgumentValidate extends ViewsSqlTest {
public static function getInfo() {
return array(
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_access.test b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_access.test
index 14bc532..f02eca9 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_access.test
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_access.test
@@ -1,6 +1,11 @@
<?php
/**
+ * @file
+ * Definition of ViewsAccessTest.
+ */
+
+/**
* Basic test for pluggable access.
*/
class ViewsAccessTest extends ViewsSqlTest {
@@ -48,7 +53,7 @@ class ViewsAccessTest extends ViewsSqlTest {
}
/**
- * Test none access plugin.
+ * Tests none access plugin.
*/
function testAccessNone() {
$view = $this->view_access_none();
@@ -61,7 +66,7 @@ class ViewsAccessTest extends ViewsSqlTest {
}
/**
- * Test perm access plugin.
+ * Tests perm access plugin.
*/
function testAccessPerm() {
$view = $this->view_access_perm();
@@ -75,7 +80,7 @@ class ViewsAccessTest extends ViewsSqlTest {
}
/**
- * Test role access plugin.
+ * Tests role access plugin.
*/
function testAccessRole() {
$view = $this->view_access_role();
@@ -93,7 +98,7 @@ class ViewsAccessTest extends ViewsSqlTest {
*/
/**
- * Test static access check.
+ * Tests static access check.
*/
function testStaticAccessPlugin() {
$view = $this->view_access_static();
@@ -120,7 +125,7 @@ class ViewsAccessTest extends ViewsSqlTest {
}
/**
- * Test dynamic access plugin.
+ * Tests dynamic access plugin.
*/
function testDynamicAccessPlugin() {
$view = $this->view_access_dynamic();
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_analyze.test b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_analyze.test
index 9bd7922..c21a4bb 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_analyze.test
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_analyze.test
@@ -2,9 +2,12 @@
/**
* @file
- * Tests the views analyze system.
+ * Definition of ViewsAnalyzeTest.
*/
+/**
+ * Tests the views analyze system.
+ */
class ViewsAnalyzeTest extends ViewsSqlTest {
public static function getInfo() {
return array(
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_argument_default.test b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_argument_default.test
index 39e54e7..9c0a7eb 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_argument_default.test
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_argument_default.test
@@ -1,6 +1,11 @@
<?php
/**
+ * @file
+ * Definition of ViewsArgumentDefaultTest.
+ */
+
+/**
* Basic test for pluggable argument default.
*/
class ViewsArgumentDefaultTest extends ViewsSqlTest {
@@ -19,7 +24,32 @@ class ViewsArgumentDefaultTest extends ViewsSqlTest {
}
/**
- * Test fixed default argument.
+ * Tests the use of a default argument plugin that provides no options.
+ */
+ function testArgumentDefaultNoOptions() {
+ module_enable(array('views_ui', 'views_test'));
+ $admin_user = $this->drupalCreateUser(array('administer views', 'administer site configuration'));
+ $this->drupalLogin($admin_user);
+
+ // The current_user plugin has no options form, and should pass validation.
+ $argument_type = 'current_user';
+ $edit = array(
+ 'options[default_argument_type]' => $argument_type,
+ );
+ $this->drupalPost('admin/structure/views/nojs/config-item/test_argument_default_current_user/default/argument/uid', $edit, t('Apply'));
+
+ // Note, the undefined index error has two spaces after it.
+ $error = array(
+ '%type' => 'Notice',
+ '!message' => 'Undefined index: ' . $argument_type,
+ '%function' => 'views_handler_argument->options_validate()',
+ );
+ $message = t('%type: !message in %function', $error);
+ $this->assertNoRaw($message, t('Did not find error message: !message.', array('!message' => $message)));
+ }
+
+ /**
+ * Tests fixed default argument.
*/
function testArgumentDefaultFixed() {
$view = $this->view_argument_default_fixed();
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_argument_validator.test b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_argument_validator.test
index cbbb7b8..fb2e4f2 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_argument_validator.test
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_argument_validator.test
@@ -1,5 +1,13 @@
<?php
+/**
+ * @file
+ * Definition of ViewsArgumentValidatorTest.
+ */
+
+/**
+ * Tests Views argument validators.
+ */
class ViewsArgumentValidatorTest extends ViewsSqlTest {
public static function getInfo() {
return array(
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_basic.test b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_basic.test
index 20a9d4f..5fc60d8 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_basic.test
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_basic.test
@@ -1,6 +1,11 @@
<?php
/**
+ * @file
+ * Definition of ViewsBasicTest.
+ */
+
+/**
* Basic test class for Views query builder tests.
*/
class ViewsBasicTest extends ViewsSqlTest {
@@ -13,13 +18,13 @@ class ViewsBasicTest extends ViewsSqlTest {
}
/**
- * Test a trivial result set.
+ * Tests a trivial result set.
*/
public function testSimpleResultSet() {
$view = $this->getBasicView();
// Execute the view.
- $view->execute();
+ $this->executeView($view);
// Verify the result.
$this->assertEqual(5, count($view->result), t('The number of returned rows match.'));
@@ -30,7 +35,7 @@ class ViewsBasicTest extends ViewsSqlTest {
}
/**
- * Test filtering of the result set.
+ * Tests filtering of the result set.
*/
public function testSimpleFiltering() {
$view = $this->getBasicView();
@@ -58,7 +63,7 @@ class ViewsBasicTest extends ViewsSqlTest {
));
// Execute the view.
- $view->execute();
+ $this->executeView($view);
// Build the expected result.
$dataset = array(
@@ -88,7 +93,7 @@ class ViewsBasicTest extends ViewsSqlTest {
}
/**
- * Test simple argument.
+ * Tests simple argument.
*/
public function testSimpleArgument() {
$view = $this->getBasicView();
@@ -139,7 +144,7 @@ class ViewsBasicTest extends ViewsSqlTest {
// Execute with a view
$view->set_arguments(array(27));
- $view->execute();
+ $this->executeView($view);
// Build the expected result.
$dataset = array(
@@ -159,7 +164,7 @@ class ViewsBasicTest extends ViewsSqlTest {
// Test "show all" if no argument is present.
$view = $saved_view;
- $view->execute();
+ $this->executeView($view);
// Build the expected result.
$dataset = $this->dataSet();
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_cache.test b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_cache.test
index c004112..3103762 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_cache.test
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_cache.test
@@ -2,11 +2,13 @@
/**
* @file
- * Test cache system.
+ * Definition of ViewsCacheTest.
*/
/**
* Basic test for pluggable caching.
+ *
+ * @see views_plugin_cache
*/
class ViewsCacheTest extends ViewsSqlTest {
public static function getInfo() {
@@ -19,13 +21,15 @@ class ViewsCacheTest extends ViewsSqlTest {
/**
* Build and return a basic view of the views_test table.
+ *
+ * @return view
*/
protected function getBasicView() {
views_include('view');
// Create the basic view.
$view = new view();
- $view->vid = 'test_view';
+ $view->name = 'test_view';
$view->add_display('default');
$view->base_table = 'views_test';
@@ -68,6 +72,8 @@ class ViewsCacheTest extends ViewsSqlTest {
/**
* Tests time based caching.
+ *
+ * @see views_plugin_cache_time
*/
function testTimeCaching() {
// Create a basic result which just 2 results.
@@ -79,7 +85,7 @@ class ViewsCacheTest extends ViewsSqlTest {
'output_lifespan' => '3600',
));
- $view->execute();
+ $this->executeView($view);
// Verify the result.
$this->assertEqual(5, count($view->result), t('The number of returned rows match.'));
@@ -100,13 +106,15 @@ class ViewsCacheTest extends ViewsSqlTest {
'output_lifespan' => '3600',
));
- $view->execute();
+ $this->executeView($view);
// Verify the result.
$this->assertEqual(5, count($view->result), t('The number of returned rows match.'));
}
/**
* Tests no caching.
+ *
+ * @see views_plugin_cache_time
*/
function testNoneCaching() {
// Create a basic result which just 2 results.
@@ -116,7 +124,7 @@ class ViewsCacheTest extends ViewsSqlTest {
'type' => 'none',
));
- $view->execute();
+ $this->executeView($view);
// Verify the result.
$this->assertEqual(5, count($view->result), t('The number of returned rows match.'));
@@ -129,17 +137,108 @@ class ViewsCacheTest extends ViewsSqlTest {
drupal_write_record('views_test', $record);
- // The Result should be the same as before, because of the caching.
+ // The Result changes, because the view is not cached.
$view = $this->getBasicView();
$view->set_display();
$view->display_handler->override_option('cache', array(
- 'type' => 'time',
- 'results_lifespan' => '3600',
- 'output_lifespan' => '3600',
+ 'type' => 'none',
));
- $view->execute();
+ $this->executeView($view);
// Verify the result.
$this->assertEqual(6, count($view->result), t('The number of returned rows match.'));
}
+
+ /**
+ * Tests css/js storage and restoring mechanism.
+ */
+ function testHeaderStorage() {
+ // Create a view with output caching enabled.
+ // Some hook_views_pre_render in views_test.module adds the test css/js file.
+ // so they should be added to the css/js storage.
+ $view = $this->getBasicView();
+ $view->init_display();
+ $view->name = 'test_cache_header_storage';
+ $view->display_handler->override_option('cache', array(
+ 'type' => 'time',
+ 'output_lifespan' => '3600',
+ ));
+
+ $view->preview();
+ $view->destroy();
+ unset($view->pre_render_called);
+ drupal_static_reset('drupal_add_css');
+ drupal_static_reset('drupal_add_js');
+
+ $view->init_display();
+ $view->preview();
+ $css = drupal_add_css();
+ $css_path = drupal_get_path('module', 'views_test') . '/views_cache.test.css';
+ $js_path = drupal_get_path('module', 'views_test') . '/views_cache.test.js';
+ $js = drupal_add_js();
+
+ $this->assertTrue(isset($css[$css_path]), 'Make sure the css is added for cached views.');
+ $this->assertTrue(isset($js[$js_path]), 'Make sure the js is added for cached views.');
+ $this->assertFalse(!empty($view->pre_render_called), 'Make sure hook_views_pre_render is not called for the cached view.');
+ $view->destroy();
+
+ // Now add some css/jss before running the view.
+ // Make sure that this css is not added when running the cached view.
+ $view->name = 'test_cache_header_storage_2';
+
+ $system_css_path = drupal_get_path('module', 'system') . '/system.maintenance.css';
+ drupal_add_css($system_css_path);
+ $system_js_path = drupal_get_path('module', 'system') . '/system.cron.js';
+ drupal_add_js($system_js_path);
+
+ $view->init_display();
+ $view->preview();
+ $view->destroy();
+ drupal_static_reset('drupal_add_css');
+ drupal_static_reset('drupal_add_js');
+
+ $view->init_display();
+ $view->preview();
+
+ $css = drupal_add_css();
+ $js = drupal_add_js();
+
+ $this->assertFalse(isset($css[$system_css_path]), 'Make sure that unrelated css is not added.');
+ $this->assertFalse(isset($js[$system_js_path]), 'Make sure that unrelated js is not added.');
+
+ }
+
+ /**
+ * Check that HTTP headers are cached for views.
+ */
+ function testHttpHeadersCaching() {
+ // Create a few nodes to appear in RSS feed.
+ for ($i = 0; $i < 5; $i++) {
+ $this->drupalCreateNode();
+ }
+
+ // Make the first request and check returned content type.
+ $this->drupalGet('test_feed_http_headers_caching');
+ $first_content = $this->drupalGetContent();
+ $first_content_type = $this->drupalGetHeader('content-type');
+ $expected_type = 'application/rss+xml';
+ $this->assertIdentical(0, strpos(trim($first_content_type), $expected_type), t('Expected content type returned.'));
+
+ // Check that we have 5 items in RSS feed returned by the first request.
+ $xml = simplexml_load_string($first_content);
+ $items = $xml->xpath('/rss/channel/item');
+ $this->assertEqual(5, count($items), t('The number of RSS feed items matched.'));
+
+ // Create another node to be sure we get cached results on the second
+ // request.
+ $this->drupalCreateNode();
+
+ // Make the second request, check content type and content matching.
+ $this->drupalGet('test_feed_http_headers_caching');
+ $second_content = $this->drupalGetContent();
+ $this->assertEqual($first_content, $second_content, t('The second result fetched from cache.'));
+ $second_content_type = $this->drupalGetHeader('content-type');
+ $this->assertEqual($first_content_type, $second_content_type, t('Content types of responses are equal.'));
+ }
+
}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_cache.test.css b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_cache.test.css
new file mode 100644
index 0000000..8dd17c1
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_cache.test.css
@@ -0,0 +1,5 @@
+/**
+ * @file
+ * Just a placeholder file for the test.
+ * @see ViewsCacheTest::testHeaderStorage
+ */
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_cache.test.js b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_cache.test.js
new file mode 100644
index 0000000..8dd17c1
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_cache.test.js
@@ -0,0 +1,5 @@
+/**
+ * @file
+ * Just a placeholder file for the test.
+ * @see ViewsCacheTest::testHeaderStorage
+ */
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_exposed_form.test b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_exposed_form.test
index 4c660f6..72baf2c 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_exposed_form.test
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_exposed_form.test
@@ -2,9 +2,12 @@
/**
* @file
- * Test exposed forms.
+ * Definition of ViewsExposedFormTest.
*/
+/**
+ * Tests exposed forms.
+ */
class ViewsExposedFormTest extends ViewsSqlTest {
public static function getInfo() {
return array(
@@ -54,7 +57,7 @@ class ViewsExposedFormTest extends ViewsSqlTest {
}
/**
- * Test the admin interface of exposed filter and sort items.
+ * Tests the admin interface of exposed filter and sort items.
*/
function testExposedAdminUi() {
$admin_user = $this->drupalCreateUser(array('administer views', 'administer site configuration'));
@@ -63,13 +66,28 @@ class ViewsExposedFormTest extends ViewsSqlTest {
$edit = array();
$this->drupalGet('admin/structure/views/nojs/config-item/test_exposed_admin_ui/default/filter/type');
- // Be sure that the button is called exposed
+ // Be sure that the button is called exposed.
$this->helperButtonHasLabel('edit-options-expose-button-button', t('Expose filter'));
+ // The first time the filter UI is displayed, the operator and the
+ // value forms should be shown.
+ $this->assertFieldById('edit-options-operator-in', '', 'Operator In exists');
+ $this->assertFieldById('edit-options-operator-not-in', '', 'Operator Not In exists');
+ $this->assertFieldById('edit-options-value-page', '', 'Checkbox for Page exists');
+ $this->assertFieldById('edit-options-value-article', '', 'Checkbox for Article exists');
+
// Click the Expose filter button.
$this->drupalPost('admin/structure/views/nojs/config-item/test_exposed_admin_ui/default/filter/type', $edit, t('Expose filter'));
- // Check the label of the expose button
+ // Check the label of the expose button.
$this->helperButtonHasLabel('edit-options-expose-button-button', t('Hide filter'));
+ // Check the label of the grouped exposed button
+ $this->helperButtonHasLabel('edit-options-group-button-button', t('Grouped filters'));
+
+ // After Expose the filter, Operator and Value should be still here
+ $this->assertFieldById('edit-options-operator-in', '', 'Operator In exists');
+ $this->assertFieldById('edit-options-operator-not-in', '', 'Operator Not In exists');
+ $this->assertFieldById('edit-options-value-page', '', 'Checkbox for Page exists');
+ $this->assertFieldById('edit-options-value-article', '', 'Checkbox for Article exists');
// Check the validations of the filter handler.
$edit = array();
@@ -87,10 +105,65 @@ class ViewsExposedFormTest extends ViewsSqlTest {
$this->helperButtonHasLabel('edit-options-expose-button-button', t('Expose sort'));
$this->assertNoFieldById('edit-options-expose-label', '', t('Make sure no label field is shown'));
+ // Click the Grouped Filters button.
+ $this->drupalGet('admin/structure/views/nojs/config-item/test_exposed_admin_ui/default/filter/type');
+ $this->drupalPost(NULL, array(), t('Grouped filters'));
+
+ // After click on 'Grouped Filters' standard operator and value should not be displayed
+ $this->assertNoFieldById('edit-options-operator-in', '', 'Operator In not exists');
+ $this->assertNoFieldById('edit-options-operator-not-in', '', 'Operator Not In not exists');
+ $this->assertNoFieldById('edit-options-value-page', '', 'Checkbox for Page not exists');
+ $this->assertNoFieldById('edit-options-value-article', '', 'Checkbox for Article not exists');
+
+
+ // Check that after click on 'Grouped Filters', a new button is shown to
+ // add more items to the list.
+ $this->helperButtonHasLabel('edit-options-group-info-add-group', t('Add another item'));
+
+ // Create a grouped filter
+ $this->drupalGet('admin/structure/views/nojs/config-item/test_exposed_admin_ui/default/filter/type');
+ $edit = array();
+ $edit["options[group_info][group_items][1][title]"] = 'Is Article';
+ $edit["options[group_info][group_items][1][value][article]"] = 'article';
+
+ $edit["options[group_info][group_items][2][title]"] = 'Is Page';
+ $edit["options[group_info][group_items][2][value][page]"] = TRUE;
+
+ $edit["options[group_info][group_items][3][title]"] = 'Is Page and Article';
+ $edit["options[group_info][group_items][3][value][article]"] = TRUE;
+ $edit["options[group_info][group_items][3][value][page]"] = TRUE;
+ $this->drupalPost(NULL, $edit, t('Apply'));
+
+ // Validate that all the titles are defined for each group
+ $this->drupalGet('admin/structure/views/nojs/config-item/test_exposed_admin_ui/default/filter/type');
+ $edit = array();
+ $edit["options[group_info][group_items][1][title]"] = 'Is Article';
+ $edit["options[group_info][group_items][1][value][article]"] = TRUE;
+
+ // This should trigger an error
+ $edit["options[group_info][group_items][2][title]"] = '';
+ $edit["options[group_info][group_items][2][value][page]"] = TRUE;
+
+ $edit["options[group_info][group_items][3][title]"] = 'Is Page and Article';
+ $edit["options[group_info][group_items][3][value][article]"] = TRUE;
+ $edit["options[group_info][group_items][3][value][page]"] = TRUE;
+ $this->drupalPost(NULL, $edit, t('Apply'));
+ $this->assertRaw(t('The title is required if value for this item is defined.'), t('Group items should have a title'));
+
+ // Un-Expose the filter
+ $this->drupalGet('admin/structure/views/nojs/config-item/test_exposed_admin_ui/default/filter/type');
+ $this->drupalPost(NULL, array(), t('Hide filter'));
+
+ // After Un-Expose the filter, Operator and Value should be shown again
+ $this->assertFieldById('edit-options-operator-in', '', 'Operator In exists after hide filter');
+ $this->assertFieldById('edit-options-operator-not-in', '', 'Operator Not In exists after hide filter');
+ $this->assertFieldById('edit-options-value-page', '', 'Checkbox for Page exists after hide filter');
+ $this->assertFieldById('edit-options-value-article', '', 'Checkbox for Article exists after hide filter');
+
// Click the Expose sort button.
$edit = array();
$this->drupalPost('admin/structure/views/nojs/config-item/test_exposed_admin_ui/default/sort/created', $edit, t('Expose sort'));
- // Check the label of the expose button
+ // Check the label of the expose button.
$this->helperButtonHasLabel('edit-options-expose-button-button', t('Hide sort'));
$this->assertFieldById('edit-options-expose-label', '', t('Make sure a label field is shown'));
}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_glossary.test b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_glossary.test
index 4c0ca56..0fe0fba 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_glossary.test
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_glossary.test
@@ -2,9 +2,12 @@
/**
* @file
- * Test glossary view ( summary of arguments ).
+ * Definition of ViewsGlossaryTestCase.
*/
+/**
+ * Tests glossary view ( summary of arguments ).
+ */
class ViewsGlossaryTestCase extends ViewsSqlTest {
public static function getInfo() {
return array(
@@ -19,7 +22,7 @@ class ViewsGlossaryTestCase extends ViewsSqlTest {
}
/**
- * Test the default glossary view.
+ * Tests the default glossary view.
*/
public function testGlossaryView() {
// create a contentype and add some nodes, with a non random title.
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_groupby.test b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_groupby.test
index ed27598..718d8dc 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_groupby.test
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_groupby.test
@@ -1,5 +1,13 @@
<?php
+/**
+ * @file
+ * Tests aggregate functionality of Views.
+ */
+
+/**
+ * Tests aggregate functionality of views, for example count.
+ */
class ViewsQueryGroupByTest extends ViewsSqlTest {
public static function getInfo() {
return array(
@@ -11,7 +19,7 @@ class ViewsQueryGroupByTest extends ViewsSqlTest {
}
/**
- * Test aggregate count feature.
+ * Tests aggregate count feature.
*/
public function testAggregateCount() {
// Create 2 nodes of type1 and 3 nodes of type2
@@ -276,6 +284,9 @@ class ViewsQueryGroupByTest extends ViewsSqlTest {
}
}
+/**
+ * Tests UI of aggregate functionality..
+ */
class viewsUiGroupbyTestCase extends DrupalWebTestCase {
function setUp() {
// Enable views_ui.
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_handlers.test b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_handlers.test
index 19126fa..d54a7df 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_handlers.test
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_handlers.test
@@ -2,9 +2,12 @@
/**
* @file
- * Test abstract handlers of views.
+ * Definition of ViewsHandlersTest.
*/
+/**
+ * Tests abstract handlers of views.
+ */
class ViewsHandlersTest extends ViewsSqlTest {
public static function getInfo() {
return array(
@@ -37,7 +40,7 @@ class ViewsHandlersTest extends ViewsSqlTest {
}
/**
- * Test views_break_phrase_string function.
+ * Tests views_break_phrase_string function.
*/
function test_views_break_phrase_string() {
$empty_stdclass = new stdClass();
@@ -52,28 +55,47 @@ class ViewsHandlersTest extends ViewsSqlTest {
$this->assertEqual($handler, views_break_phrase_string('', $handler));
// test ors
- $this->assertEqualValue(array('word1', 'word2', 'word'), views_break_phrase_string('word1 word2+word', $handler));
+ $handler = views_break_phrase_string('word1 word2+word');
+ $this->assertEqualValue(array('word1', 'word2', 'word'), $handler);
+ $this->assertEqual('or', $handler->operator);
+ $handler = views_break_phrase_string('word1+word2+word');
+ $this->assertEqualValue(array('word1', 'word2', 'word'), $handler);
$this->assertEqual('or', $handler->operator);
- $this->assertEqualValue(array('word1', 'word2', 'word'), views_break_phrase_string('word1+word2+word', $handler));
+ $handler = views_break_phrase_string('word1 word2 word');
+ $this->assertEqualValue(array('word1', 'word2', 'word'), $handler);
$this->assertEqual('or', $handler->operator);
- $this->assertEqualValue(array('word1', 'word2', 'word'), views_break_phrase_string('word1 word2 word', $handler));
+ $handler = views_break_phrase_string('word-1+word-2+word');
+ $this->assertEqualValue(array('word-1', 'word-2', 'word'), $handler);
$this->assertEqual('or', $handler->operator);
- $this->assertEqualValue(array('word1', 'word2', 'word'), views_break_phrase_string('word1 word2++word', $handler));
+ $handler = views_break_phrase_string('wõrd1+wõrd2+wõrd');
+ $this->assertEqualValue(array('wõrd1', 'wõrd2', 'wõrd'), $handler);
$this->assertEqual('or', $handler->operator);
// test ands.
- $this->assertEqualValue(array('word1', 'word2', 'word'), views_break_phrase_string('word1,word2,word', $handler));
+ $handler = views_break_phrase_string('word1,word2,word');
+ $this->assertEqualValue(array('word1', 'word2', 'word'), $handler);
$this->assertEqual('and', $handler->operator);
- $this->assertEqualValue(array('word1', 'word2', 'word'), views_break_phrase_string('word1,,word2,word', $handler));
+ $handler = views_break_phrase_string('word1 word2,word');
+ $this->assertEqualValue(array('word1 word2', 'word'), $handler);
$this->assertEqual('and', $handler->operator);
- $this->assertEqualValue(array('word1 word2', 'word'), views_break_phrase_string('word1 word2,word', $handler));
+ $handler = views_break_phrase_string('word1,word2 word');
+ $this->assertEqualValue(array('word1', 'word2 word'), $handler);
$this->assertEqual('and', $handler->operator);
- $this->assertEqualValue(array('word1', 'word2 word'), views_break_phrase_string('word1,word2 word', $handler));
+ $handler = views_break_phrase_string('word-1,word-2,word');
+ $this->assertEqualValue(array('word-1', 'word-2', 'word'), $handler);
+ $this->assertEqual('and', $handler->operator);
+ $handler = views_break_phrase_string('wõrd1,wõrd2,wõrd');
+ $this->assertEqualValue(array('wõrd1', 'wõrd2', 'wõrd'), $handler);
+ $this->assertEqual('and', $handler->operator);
+
+ // test a single word
+ $handler = views_break_phrase_string('word');
+ $this->assertEqualValue(array('word'), $handler);
$this->assertEqual('and', $handler->operator);
}
/**
- * Test views_break_phrase function.
+ * Tests views_break_phrase function.
*/
function test_views_break_phrase() {
$empty_stdclass = new stdClass();
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_module.test b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_module.test
index 9804f57..dc6c164 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_module.test
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_module.test
@@ -1,6 +1,13 @@
<?php
-
+/**
+ * @file
+ * Definition of ViewsModuleTest.
+ */
+
+/**
+ * Tests basic functions from the Views module.
+ */
class ViewsModuleTest extends ViewsSqlTest {
public static function getInfo() {
return array(
@@ -96,7 +103,7 @@ class ViewsModuleTest extends ViewsSqlTest {
}
/**
- * Test the views_get_handler method.
+ * Tests the views_get_handler method.
*/
function testviews_get_handler() {
$types = array('field', 'area', 'filter');
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_pager.test b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_pager.test
index 9c3cf3e..fef4915 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_pager.test
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_pager.test
@@ -2,10 +2,13 @@
/**
* @file
- * Tests the pluggable pager system.
+ * Definition of ViewsPagerTest.
*/
-class ViewsPagerTest extends DrupalWebTestCase {
+/**
+ * Tests the pluggable pager system.
+ */
+class ViewsPagerTest extends ViewsSqlTest {
public static function getInfo() {
return array(
'name' => 'Pager',
@@ -114,7 +117,7 @@ class ViewsPagerTest extends DrupalWebTestCase {
}
/**
- * Test the none-pager-query.
+ * Tests the none-pager-query.
*/
public function testNoLimit() {
// Create 11 nodes and make sure that everyone is returned.
@@ -124,8 +127,7 @@ class ViewsPagerTest extends DrupalWebTestCase {
}
$view = $this->viewsPagerNoLimit();
$view->set_display('default');
- $view->pre_execute();
- $view->execute();
+ $this->executeView($view);
$this->assertEqual(count($view->result), 11, 'Make sure that every item is returned in the result');
$view->destroy();
@@ -141,8 +143,7 @@ class ViewsPagerTest extends DrupalWebTestCase {
),
);
$view->display_handler->set_option('pager', $pager);
- $view->pre_execute();
- $view->execute();
+ $this->executeView($view);
$this->assertEqual(count($view->result), 8, 'Make sure that every item beside the first three is returned in the result');
@@ -174,8 +175,27 @@ class ViewsPagerTest extends DrupalWebTestCase {
return $view;
}
+ public function testViewTotalRowsWithoutPager() {
+ $this->createNodes(23);
+
+ $view = $this->viewsPagerNoLimit();
+ $view->get_total_rows = TRUE;
+ $view->set_display('default');
+ $this->executeView($view);
+
+ $this->assertEqual($view->total_rows, 23, "'total_rows' is calculated when pager type is 'none' and 'get_total_rows' is TRUE.");
+ }
+
+ public function createNodes($count) {
+ if ($count >= 0) {
+ for ($i = 0; $i < $count; $i++) {
+ $this->drupalCreateNode();
+ }
+ }
+ }
+
/**
- * Test the some pager plugin.
+ * Tests the some pager plugin.
*/
public function testLimit() {
// Create 11 nodes and make sure that everyone is returned.
@@ -185,7 +205,7 @@ class ViewsPagerTest extends DrupalWebTestCase {
}
$view = $this->viewsPagerLimit();
$view->set_display('default');
- $view->execute();
+ $this->executeView($view);
$this->assertEqual(count($view->result), 5, 'Make sure that only a certain count of items is returned');
$view->destroy();
@@ -201,8 +221,7 @@ class ViewsPagerTest extends DrupalWebTestCase {
),
);
$view->display_handler->set_option('pager', $pager);
- $view->pre_execute();
- $view->execute();
+ $this->executeView($view);
$this->assertEqual(count($view->result), 3, 'Make sure that only a certain count of items is returned');
// Check some public functions.
@@ -235,7 +254,7 @@ class ViewsPagerTest extends DrupalWebTestCase {
}
/**
- * Test the normal pager.
+ * Tests the normal pager.
*/
public function testNormalPager() {
// Create 11 nodes and make sure that everyone is returned.
@@ -245,8 +264,7 @@ class ViewsPagerTest extends DrupalWebTestCase {
}
$view = $this->viewsPagerFull();
$view->set_display('default');
- $view->pre_execute();
- $view->execute();
+ $this->executeView($view);
$this->assertEqual(count($view->result), 5, 'Make sure that only a certain count of items is returned');
$view->destroy();
@@ -262,15 +280,13 @@ class ViewsPagerTest extends DrupalWebTestCase {
),
);
$view->display_handler->set_option('pager', $pager);
- $view->pre_execute();
- $view->execute();
+ $this->executeView($view);
$this->assertEqual(count($view->result), 3, 'Make sure that only a certain count of items is returned');
// Test items per page = 0
$view = $this->viewPagerFullZeroItemsPerPage();
$view->set_display('default');
- $view->pre_execute();
- $view->execute();
+ $this->executeView($view);
$this->assertEqual(count($view->result), 11, 'All items are return');
@@ -292,7 +308,7 @@ class ViewsPagerTest extends DrupalWebTestCase {
);
$view->display_handler->set_option('pager', $pager);
- $view->execute();
+ $this->executeView($view);
$this->assertEqual($view->query->pager->get_items_per_page(), 0);
$this->assertEqual(count($view->result), 11);
}
@@ -402,14 +418,14 @@ class ViewsPagerTest extends DrupalWebTestCase {
}
/**
- * Test the minipager.
+ * Tests the minipager.
*/
public function testMiniPager() {
// the functionality is the same as the normal pager, so i don't know what to test here.
}
/**
- * Test rendering with NULL pager.
+ * Tests rendering with NULL pager.
*/
public function testRenderNullPager() {
// Create 11 nodes and make sure that everyone is returned.
@@ -419,10 +435,62 @@ class ViewsPagerTest extends DrupalWebTestCase {
}
$view = $this->viewsPagerFullFields();
$view->set_display('default');
- $view->execute();
+ $this->executeView($view);
$view->use_ajax = TRUE; // force the value again here
$view->query->pager = NULL;
$output = $view->render();
$this->assertEqual(preg_match('/<ul class="pager">/', $output), 0, t('The pager is not rendered.'));
}
+
+ /**
+ * Test the api functions on the view object.
+ */
+ function testPagerApi() {
+ $view = $this->viewsPagerFull();
+ // On the first round don't initialize the pager.
+
+ $this->assertEqual($view->get_items_per_page(), NULL, 'If the pager is not initialized and no manual override there is no items per page.');
+ $rand_number = rand(1, 5);
+ $view->set_items_per_page($rand_number);
+ $this->assertEqual($view->get_items_per_page(), $rand_number, 'Make sure get_items_per_page uses the settings of set_items_per_page.');
+
+ $this->assertEqual($view->get_offset(), NULL, 'If the pager is not initialized and no manual override there is no offset.');
+ $rand_number = rand(1, 5);
+ $view->set_offset($rand_number);
+ $this->assertEqual($view->get_offset(), $rand_number, 'Make sure get_offset uses the settings of set_offset.');
+
+ $this->assertEqual($view->get_current_page(), NULL, 'If the pager is not initialized and no manual override there is no current page.');
+ $rand_number = rand(1, 5);
+ $view->set_current_page($rand_number);
+ $this->assertEqual($view->get_current_page(), $rand_number, 'Make sure get_current_page uses the settings of set_current_page.');
+
+ $view->destroy();
+
+ // On this round enable the pager.
+ $view->init_display();
+ $view->init_query();
+ $view->init_pager();
+
+ $this->assertEqual($view->get_items_per_page(), 5, 'Per default the view has 5 items per page.');
+ $rand_number = rand(1, 5);
+ $view->set_items_per_page($rand_number);
+ $rand_number = rand(6, 11);
+ $view->query->pager->set_items_per_page($rand_number);
+ $this->assertEqual($view->get_items_per_page(), $rand_number, 'Make sure get_items_per_page uses the settings of set_items_per_page.');
+
+ $this->assertEqual($view->get_offset(), 0, 'Per default a view has a 0 offset.');
+ $rand_number = rand(1, 5);
+ $view->set_offset($rand_number);
+ $rand_number = rand(6, 11);
+ $view->query->pager->set_offset($rand_number);
+ $this->assertEqual($view->get_offset(), $rand_number, 'Make sure get_offset uses the settings of set_offset.');
+
+ $this->assertEqual($view->get_current_page(), 0, 'Per default the current page is 0.');
+ $rand_number = rand(1, 5);
+ $view->set_current_page($rand_number);
+ $rand_number = rand(6, 11);
+ $view->query->pager->set_current_page($rand_number);
+ $this->assertEqual($view->get_current_page(), $rand_number, 'Make sure get_current_page uses the settings of set_current_page.');
+
+ }
}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_plugin_localization_test.inc b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_plugin_localization_test.inc
index 35a870d..1987fd8 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_plugin_localization_test.inc
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_plugin_localization_test.inc
@@ -1,6 +1,11 @@
<?php
/**
+ * @file
+ * Definition of views_plugin_localization_test.
+ */
+
+/**
* A stump localisation plugin which has static variables to cache the input.
*/
class views_plugin_localization_test extends views_plugin_localization {
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_query.test b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_query.test
index ea4e2bc..735df0e 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_query.test
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_query.test
@@ -367,7 +367,7 @@ abstract class ViewsSqlTest extends ViewsTestCase {
// Create the basic view.
$view = new view();
- $view->vid = 'test_view';
+ $view->name = 'test_view';
$view->add_display('default');
$view->base_table = 'views_test';
@@ -413,4 +413,21 @@ abstract class ViewsSqlTest extends ViewsTestCase {
return $view;
}
+
+ /**
+ * Build and return a Page view of the views_test table.
+ *
+ * @return view
+ */
+ protected function getBasicPageView() {
+ views_include('view');
+ $view = $this->getBasicView();
+
+ // In order to test exposed filters, we have to disable
+ // the exposed forms cache.
+ drupal_static_reset('views_exposed_form_cache');
+
+ $display = $view->new_display('page', 'Page', 'page_1');
+ return $view;
+ }
}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_test.info b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_test.info
index c3278f7..c41ad54 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_test.info
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_test.info
@@ -5,9 +5,9 @@ core = 7.x
dependencies[] = views
hidden = TRUE
-; Information added by drupal.org packaging script on 2012-02-22
-version = "7.x-3.3"
+; Information added by drupal.org packaging script on 2012-08-24
+version = "7.x-3.5"
core = "7.x"
project = "views"
-datestamp = "1329946249"
+datestamp = "1345829394"
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_test.install b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_test.install
index 3080b74..b0ccd8b 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_test.install
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_test.install
@@ -1,5 +1,13 @@
<?php
+/**
+ * @file
+ * Install, update, and uninstall functions for the Views Test module.
+ */
+
+/**
+ * Implements hook_schema().
+ */
function views_test_schema() {
return variable_get('views_test_schema', array());
}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_test.module b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_test.module
index 18536b9..f6026b8 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_test.module
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_test.module
@@ -1,6 +1,11 @@
<?php
/**
+ * @file
+ * Helper module for Views tests.
+ */
+
+/**
* Implements hook_permission().
*/
function views_test_permission() {
@@ -23,14 +28,14 @@ function views_test_views_api() {
}
/**
- * Implements hook_views_data()
+ * Implements hook_views_data().
*/
function views_test_views_data() {
return variable_get('views_test_views_data', array());
}
/**
- * Implements hook_views_plugins()
+ * Implements hook_views_plugins().
*/
function views_test_views_plugins() {
return variable_get('views_test_views_plugins', array());
@@ -43,3 +48,14 @@ function views_test_test_static_access_callback($access) {
function views_test_test_dynamic_access_callback($access, $argument1, $argument2) {
return $access && $argument1 == variable_get('test_dynamic_access_argument1', NULL) && $argument2 == variable_get('test_dynamic_access_argument2', NULL);
}
+
+/**
+ * Implements hook_views_pre_render().
+ */
+function views_test_views_pre_render(&$view) {
+ if ($view->name == 'test_cache_header_storage') {
+ drupal_add_js(drupal_get_path('module', 'views_test') . '/views_cache.test.js');
+ drupal_add_css(drupal_get_path('module', 'views_test') . '/views_cache.test.css');
+ $view->pre_render_called = TRUE;
+ }
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_test.views_default.inc b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_test.views_default.inc
index dce5906..0448705 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_test.views_default.inc
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_test.views_default.inc
@@ -1,7 +1,8 @@
<?php
+
/**
* @file
- * Test views
+ * Tests views.
*/
/**
@@ -141,5 +142,81 @@ function views_test_views_default_views() {
$views[$view->name] = $view;
+ $view = new view;
+ $view->name = 'test_argument_default_current_user';
+ $view->description = '';
+ $view->tag = '';
+ $view->view_php = '';
+ $view->base_table = 'node';
+ $view->is_cacheable = FALSE;
+ $view->api_version = 3;
+ $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
+
+ /* Display: Master */
+ $handler = $view->new_display('default', 'Master', 'default');
+ $handler->display->display_options['access']['type'] = 'none';
+ $handler->display->display_options['cache']['type'] = 'none';
+ $handler->display->display_options['exposed_form']['type'] = 'basic';
+ $handler->display->display_options['pager']['type'] = 'full';
+ $handler->display->display_options['pager']['options']['items_per_page'] = '10';
+ $handler->display->display_options['pager']['options']['offset'] = '0';
+ $handler->display->display_options['pager']['options']['id'] = '0';
+ $handler->display->display_options['style_plugin'] = 'default';
+ $handler->display->display_options['row_plugin'] = 'fields';
+ /* Field: Content: Title */
+ $handler->display->display_options['fields']['title']['id'] = 'title';
+ $handler->display->display_options['fields']['title']['table'] = 'node';
+ $handler->display->display_options['fields']['title']['field'] = 'title';
+ $handler->display->display_options['fields']['title']['alter']['alter_text'] = 0;
+ $handler->display->display_options['fields']['title']['alter']['make_link'] = 0;
+ $handler->display->display_options['fields']['title']['alter']['trim'] = 0;
+ $handler->display->display_options['fields']['title']['alter']['word_boundary'] = 1;
+ $handler->display->display_options['fields']['title']['alter']['ellipsis'] = 1;
+ $handler->display->display_options['fields']['title']['alter']['strip_tags'] = 0;
+ $handler->display->display_options['fields']['title']['alter']['html'] = 0;
+ $handler->display->display_options['fields']['title']['hide_empty'] = 0;
+ $handler->display->display_options['fields']['title']['empty_zero'] = 0;
+ $handler->display->display_options['fields']['title']['link_to_node'] = 0;
+ /* Contextual filter: Content: Author uid */
+ $handler->display->display_options['arguments']['uid']['id'] = 'uid';
+ $handler->display->display_options['arguments']['uid']['table'] = 'node';
+ $handler->display->display_options['arguments']['uid']['field'] = 'uid';
+ $handler->display->display_options['arguments']['uid']['default_action'] = 'default';
+
+ $views[$view->name] = $view;
+
+ $view = new view();
+ $view->name = 'test_feed_http_headers_caching';
+ $view->description = '';
+ $view->tag = '';
+ $view->base_table = 'node';
+ $view->core = 7;
+ $view->api_version = '3.0';
+ $view->disabled = FALSE;
+
+ /* Display: Master */
+ $handler = $view->new_display('default', 'Master', 'default');
+ $handler->display->display_options['access']['type'] = 'none';
+ $handler->display->display_options['cache']['type'] = 'time';
+ $handler->display->display_options['cache']['results_lifespan'] = '3600';
+ $handler->display->display_options['cache']['results_lifespan_custom'] = '0';
+ $handler->display->display_options['cache']['output_lifespan'] = '3600';
+ $handler->display->display_options['cache']['output_lifespan_custom'] = '0';
+ $handler->display->display_options['query']['type'] = 'views_query';
+ $handler->display->display_options['exposed_form']['type'] = 'basic';
+ $handler->display->display_options['pager']['type'] = 'full';
+ $handler->display->display_options['style_plugin'] = 'default';
+ $handler->display->display_options['row_plugin'] = 'node';
+
+ /* Display: Feed */
+ $handler = $view->new_display('feed', 'Feed', 'feed_1');
+ $handler->display->display_options['pager']['type'] = 'none';
+ $handler->display->display_options['pager']['options']['offset'] = '0';
+ $handler->display->display_options['style_plugin'] = 'rss';
+ $handler->display->display_options['row_plugin'] = 'node_rss';
+ $handler->display->display_options['path'] = 'test_feed_http_headers_caching';
+
+ $views[$view->name] = $view;
+
return $views;
}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_translatable.test b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_translatable.test
index 515a33d..0cb27e4 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_translatable.test
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_translatable.test
@@ -1,5 +1,13 @@
<?php
+/**
+ * @file
+ * Definition of ViewsTranslatableTest.
+ */
+
+/**
+ * Tests Views pluggable translations.
+ */
class ViewsTranslatableTest extends ViewsSqlTest {
var $strings;
@@ -11,7 +19,7 @@ class ViewsTranslatableTest extends ViewsSqlTest {
);
}
- /*
+ /**
* The views plugin definition. Override it if you test provides a plugin.
*/
public function viewsPlugins() {
@@ -40,7 +48,7 @@ class ViewsTranslatableTest extends ViewsSqlTest {
}
/**
- * Test the unpack translation funtionality.
+ * Tests the unpack translation funtionality.
*/
public function testUnpackTranslatable() {
$view = $this->view_unpack_translatable();
@@ -74,8 +82,7 @@ class ViewsTranslatableTest extends ViewsSqlTest {
public function testTranslation() {
$view = $this->view_unpack_translatable();
$view->set_display('default');
- $view->pre_execute();
- $view->execute();
+ $this->executeView($view);
$expected_strings = array();
foreach ($this->strings as $string) {
@@ -109,12 +116,15 @@ class ViewsTranslatableTest extends ViewsSqlTest {
'Offset1' => array('pager', 'expose', 'offset_label'),
'Master1' => array('title'),
'title1' => array('title'),
+ 'Tag first1' => array('pager', 'tags', 'first'),
+ 'Tag prev1' => array('pager', 'tags', 'previous'),
+ 'Tag next1' => array('pager', 'tags', 'next'),
+ 'Tag last1' => array('pager', 'tags', 'last'),
'Items per page1' => array('pager', 'expose', 'items_per_page_label'),
'fieldlabel1' => array('field', 'node', 'nid', 'label'),
'filterlabel1' => array('filter', 'node', 'nid', 'expose', 'label'),
'- All -' => array('pager', 'expose', 'items_per_page_options_all_label'),
);
-
foreach ($translatables as $translatable) {
$this->assertEqual($translatable['keys'], $this->string_keys[$translatable['value']]);
}
@@ -148,6 +158,11 @@ class ViewsTranslatableTest extends ViewsSqlTest {
$handler->display->display_options['pager']['options']['items_per_page'] = '10';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['pager']['options']['id'] = '0';
+ $handler->display->display_options['pager']['options']['quantity'] = '9';
+ $handler->display->display_options['pager']['options']['tags']['first'] = 'Tag first1';
+ $handler->display->display_options['pager']['options']['tags']['previous'] = 'Tag prev1';
+ $handler->display->display_options['pager']['options']['tags']['next'] = 'Tag next1';
+ $handler->display->display_options['pager']['options']['tags']['last'] = 'Tag last1';
$handler->display->display_options['pager']['options']['expose']['items_per_page'] = TRUE;
$handler->display->display_options['pager']['options']['expose']['items_per_page_label'] = 'Items per page1';
$handler->display->display_options['pager']['options']['expose']['offset'] = TRUE;
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_ui.test b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_ui.test
index 6301ac9..8785539 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_ui.test
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_ui.test
@@ -2,7 +2,7 @@
/**
* @file
- * Tests views UI Wizard.
+ * Tests Views UI Wizard.
*/
/**
@@ -19,6 +19,9 @@ class ViewsUIWizardHelper extends DrupalWebTestCase {
}
}
+/**
+ * Tests creating views with the wizard and viewing them on the listing page.
+ */
class ViewsUIWizardBasicTestCase extends ViewsUIWizardHelper {
public static function getInfo() {
return array(
@@ -136,7 +139,7 @@ class ViewsUIWizardBasicTestCase extends ViewsUIWizardHelper {
// Check if the export screen works.
$this->drupalGet('admin/structure/views/view/' . $view3['name'] . '/export');
- $this->assertRaw('$view = new view;');
+ $this->assertRaw('$view = new view();');
$this->assertRaw($view3['human_name']);
$this->assertRaw($view3['description']);
@@ -145,6 +148,9 @@ class ViewsUIWizardBasicTestCase extends ViewsUIWizardHelper {
}
}
+/**
+ * Tests enabling, disabling, and reverting default views via the listing page.
+ */
class ViewsUIWizardDefaultViewsTestCase extends ViewsUIWizardHelper {
public static function getInfo() {
return array(
@@ -155,7 +161,7 @@ class ViewsUIWizardDefaultViewsTestCase extends ViewsUIWizardHelper {
}
/**
- * Test default views.
+ * Tests default views.
*/
function testDefaultViews() {
// Make sure the front page view starts off as disabled (does not appear on
@@ -250,6 +256,9 @@ class ViewsUIWizardDefaultViewsTestCase extends ViewsUIWizardHelper {
}
}
+/**
+ * Tests the ability of the views wizard to create views filtered by taxonomy.
+ */
class ViewsUIWizardTaggedWithTestCase extends ViewsUIWizardHelper {
protected $node_type_with_tags;
protected $node_type_without_tags;
@@ -319,7 +328,7 @@ class ViewsUIWizardTaggedWithTestCase extends ViewsUIWizardHelper {
}
/**
- * Test the "tagged with" functionality.
+ * Tests the "tagged with" functionality.
*/
function testTaggedWith() {
// In this test we will only create nodes that have an instance of the tag
@@ -383,7 +392,7 @@ class ViewsUIWizardTaggedWithTestCase extends ViewsUIWizardHelper {
}
/**
- * Test that the "tagged with" form element only shows for node types that support it.
+ * Tests that the "tagged with" form element only shows for node types that support it.
*/
function testTaggedWithByNodeType() {
// The tagging field is associated with one of our node types only. So the
@@ -415,6 +424,9 @@ class ViewsUIWizardTaggedWithTestCase extends ViewsUIWizardHelper {
}
}
+/**
+ * Tests the ability of the views wizard to create views with sorts.
+ */
class ViewsUIWizardSortingTestCase extends ViewsUIWizardHelper {
public static function getInfo() {
return array(
@@ -425,7 +437,7 @@ class ViewsUIWizardSortingTestCase extends ViewsUIWizardHelper {
}
/**
- * Test the sorting functionality.
+ * Tests the sorting functionality.
*/
function testSorting() {
// Create nodes, each with a different creation time so that we can do a
@@ -482,6 +494,9 @@ class ViewsUIWizardSortingTestCase extends ViewsUIWizardHelper {
}
}
+/**
+ * Tests the ability of the views wizard to specify the number of items per page.
+ */
class ViewsUIWizardItemsPerPageTestCase extends ViewsUIWizardHelper {
public static function getInfo() {
return array(
@@ -492,7 +507,7 @@ class ViewsUIWizardItemsPerPageTestCase extends ViewsUIWizardHelper {
}
/**
- * Test the number of items per page.
+ * Tests the number of items per page.
*/
function testItemsPerPage() {
// Create articles, each with a different creation time so that we can do a
@@ -564,6 +579,9 @@ class ViewsUIWizardItemsPerPageTestCase extends ViewsUIWizardHelper {
}
}
+/**
+ * Tests the ability of the views wizard to put views in a menu.
+ */
class ViewsUIWizardMenuTestCase extends ViewsUIWizardHelper {
public static function getInfo() {
return array(
@@ -574,7 +592,7 @@ class ViewsUIWizardMenuTestCase extends ViewsUIWizardHelper {
}
/**
- * Test the menu functionality.
+ * Tests the menu functionality.
*/
function testMenus() {
// Create a view with a page display and a menu link in the Main Menu.
@@ -609,6 +627,9 @@ class ViewsUIWizardMenuTestCase extends ViewsUIWizardHelper {
}
}
+/**
+ * Tests the ability of the views wizard to create views with a jump menu style plugin.
+ */
class ViewsUIWizardJumpMenuTestCase extends ViewsUIWizardHelper {
public static function getInfo() {
return array(
@@ -619,7 +640,7 @@ class ViewsUIWizardJumpMenuTestCase extends ViewsUIWizardHelper {
}
/**
- * Test the jump menu style plugin.
+ * Tests the jump menu style plugin.
*/
function testJumpMenus() {
// We'll run this test for several different base tables that appear in the
@@ -767,6 +788,9 @@ class ViewsUIWizardJumpMenuTestCase extends ViewsUIWizardHelper {
}
}
+/**
+ * Tests that displays can be correctly overridden via the user interface.
+ */
class ViewsUIWizardOverrideDisplaysTestCase extends ViewsUIWizardHelper {
public static function getInfo() {
return array(
@@ -777,7 +801,7 @@ class ViewsUIWizardOverrideDisplaysTestCase extends ViewsUIWizardHelper {
}
/**
- * Test that displays can be overridden via the UI.
+ * Tests that displays can be overridden via the UI.
*/
function testOverrideDisplays() {
// Create a basic view that shows all content, with a page and a block
@@ -838,7 +862,7 @@ class ViewsUIWizardOverrideDisplaysTestCase extends ViewsUIWizardHelper {
}
/**
- * Test that the wizard correctly sets up default and overridden displays.
+ * Tests that the wizard correctly sets up default and overridden displays.
*/
function testWizardMixedDefaultOverriddenDisplays() {
// Create a basic view with a page, block, and feed. Give the page and feed
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_upgrade.test b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_upgrade.test
index 0e8626b..3f453db 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_upgrade.test
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_upgrade.test
@@ -2,11 +2,14 @@
/**
* @file
+ * Definition of ViewsUpgradeTestCase.
+ */
+
+/**
* Try to test the upgrade path of all conversions.
*
* You can find all conversions by searching for "moved to".
*/
-
class ViewsUpgradeTestCase extends ViewsSqlTest {
public static function getInfo() {
return array(
@@ -48,7 +51,7 @@ class ViewsUpgradeTestCase extends ViewsSqlTest {
}
/**
- * Test the moved to parameter in general.
+ * Tests the moved to parameter in general.
*/
public function testMovedTo() {
// Test moving on field lavel.
@@ -87,7 +90,7 @@ class ViewsUpgradeTestCase extends ViewsSqlTest {
}
/**
- * Test a import via ui.
+ * Tests a import via ui.
*
* To ensure the general functionality, the recent comments view from drupal6
* is used.
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_view.test b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_view.test
index f57961e..d268a0c 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_view.test
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_view.test
@@ -1,7 +1,12 @@
<?php
/**
- * Test the view class.
+ * @file
+ * Definition of ViewsViewTest.
+ */
+
+/**
+ * Views class tests.
*/
class ViewsViewTest extends ViewsSqlTest {
public static function getInfo() {
@@ -13,7 +18,7 @@ class ViewsViewTest extends ViewsSqlTest {
}
/**
- * Test the deconstructor to be sure that every kind of heavy objects are removed.
+ * Tests the deconstructor to be sure that every kind of heavy objects are removed.
*/
function testDestroy() {
$view = $this->view_test_destroy();