summaryrefslogtreecommitdiff
path: root/kolab.org/www/drupal-7.18/sites/all/modules/views/tests
diff options
context:
space:
mode:
Diffstat (limited to 'kolab.org/www/drupal-7.18/sites/all/modules/views/tests')
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/views/tests/field/views_fieldapi.test12
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/views/tests/handlers/views_handler_field_boolean.test34
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/views/tests/node/views_node_revision_relations.test177
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/views/tests/styles/views_plugin_style.test16
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/views/tests/styles/views_plugin_style_base.test33
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/views/tests/styles/views_plugin_style_jump_menu.test8
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/views/tests/styles/views_plugin_style_mapping.test144
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/views/tests/styles/views_plugin_style_unformatted.test22
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/views/tests/test_plugins/views_test_plugin_style_test_mapping.inc52
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/views/tests/views_test.info6
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/views/tests/views_test.module56
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/views/tests/views_translatable.test23
12 files changed, 534 insertions, 49 deletions
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/views/tests/field/views_fieldapi.test b/kolab.org/www/drupal-7.18/sites/all/modules/views/tests/field/views_fieldapi.test
index c5393b5..da4c27b 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/views/tests/field/views_fieldapi.test
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/views/tests/field/views_fieldapi.test
@@ -88,10 +88,9 @@ class ViewsFieldApiTestHelper extends ViewsSqlTest {
*/
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;
+ drupal_static_reset('_views_fetch_data_cache');
+ drupal_static_reset('_views_fetch_data_recursion_protected');
+ drupal_static_reset('_views_fetch_data_fully_loaded');
}
}
@@ -169,10 +168,7 @@ class viewsFieldApiDataTest extends ViewsFieldApiTestHelper {
}
// 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;
+ $this->clearViewsCaches();
}
/**
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/views/tests/handlers/views_handler_field_boolean.test b/kolab.org/www/drupal-7.18/sites/all/modules/views/tests/handlers/views_handler_field_boolean.test
index 92ec7a5..286b942 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/views/tests/handlers/views_handler_field_boolean.test
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/views/tests/handlers/views_handler_field_boolean.test
@@ -66,11 +66,43 @@ class ViewsHandlerFieldBooleanTest extends ViewsSqlTest {
$this->assertEqual('✖', $view->field['age']->advanced_render($view->result[0]));
$this->assertEqual('✔', $view->field['age']->advanced_render($view->result[1]));
- // Set a custom output format.
+ // Set a custom output format programmatically.
$view->field['age']->formats['test'] = array(t('Test-True'), t('Test-False'));
$view->field['age']->options['type'] = 'test';
$this->assertEqual(t('Test-False'), $view->field['age']->advanced_render($view->result[0]));
$this->assertEqual(t('Test-True'), $view->field['age']->advanced_render($view->result[1]));
+ // Set a custom output format through the UI using plain-text inputs.
+ $view->field['age']->options['type'] = 'custom';
+ $values = array(
+ 'false' => 'Nay',
+ 'true' => 'Yay',
+ );
+ $view->field['age']->options['type_custom_false'] = $values['false'];
+ $view->field['age']->options['type_custom_true'] = $values['true'];
+ $this->assertEqual($values['false'], $view->field['age']->advanced_render($view->result[0]));
+ $this->assertEqual($values['true'], $view->field['age']->advanced_render($view->result[1]));
+
+ // Set a custom output format through the UI using valid HTML inputs.
+ $view->field['age']->options['type'] = 'custom';
+ $values = array(
+ 'false' => '<div class="bar">Nay</div>',
+ 'true' => '<div class="foo">Yay</div>',
+ );
+ $view->field['age']->options['type_custom_false'] = $values['false'];
+ $view->field['age']->options['type_custom_true'] = $values['true'];
+ $this->assertEqual($values['false'], $view->field['age']->advanced_render($view->result[0]));
+ $this->assertEqual($values['true'], $view->field['age']->advanced_render($view->result[1]));
+
+ // Set a custom output format through the UI using unsafe inputs.
+ $view->field['age']->options['type'] = 'custom';
+ $values = array(
+ 'false' => '<script>alert("Nay");</script>',
+ 'true' => '<script>alert("Yay");</script>',
+ );
+ $view->field['age']->options['type_custom_false'] = $values['false'];
+ $view->field['age']->options['type_custom_true'] = $values['true'];
+ $this->assertNotEqual($values['false'], $view->field['age']->advanced_render($view->result[0]));
+ $this->assertNotEqual($values['true'], $view->field['age']->advanced_render($view->result[1]));
}
}
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/views/tests/node/views_node_revision_relations.test b/kolab.org/www/drupal-7.18/sites/all/modules/views/tests/node/views_node_revision_relations.test
new file mode 100644
index 0000000..6b38396
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/views/tests/node/views_node_revision_relations.test
@@ -0,0 +1,177 @@
+<?php
+
+/**
+ * @file
+ * Definition of ViewsNodeRevisionRelationsTestCase.
+ */
+
+/**
+ * Tests basic node_revision table integration into views.
+ */
+class ViewsNodeRevisionRelationsTestCase extends ViewsSqlTest {
+
+ public static function getInfo() {
+ return array(
+ 'name' => 'Tests basic node_revision integration',
+ 'description' => 'Tests the integration of node_revision table of node module',
+ 'group' => 'Views Modules',
+ );
+ }
+
+ /**
+ * Create a node with revision and rest result count for both views.
+ */
+ public function testNodeRevisionRelationship() {
+ $node = $this->drupalCreateNode();
+ // Create revision of the node.
+ $node_revision = clone $node;
+ $node_revision->revision = 1;
+ node_save($node_revision);
+ $column_map = array(
+ 'vid' => 'vid',
+ 'node_revision_nid' => 'node_revision_nid',
+ 'node_node_revision_nid' => 'node_node_revision_nid',
+ );
+
+ // Here should be two rows.
+ $view_nid = $this->test_view_node_revision_nid();
+ $this->executeView($view_nid, array($node->nid));
+ $resultset_nid = array(
+ array(
+ 'vid' => '1',
+ 'node_revision_nid' => '1',
+ 'node_node_revision_nid' => '1',
+ ),
+ array(
+ 'vid' => '2',
+ 'node_revision_nid' => '1',
+ 'node_node_revision_nid' => '1',
+ ),
+ );
+ $this->assertIdenticalResultset($view_nid, $resultset_nid, $column_map);
+
+ // There should be only one row with active revision 2.
+ $view_vid = $this->test_view_node_revision_vid();
+ $this->executeView($view_vid, array($node->nid));
+ $resultset_vid = array(
+ array(
+ 'vid' => '2',
+ 'node_revision_nid' => '1',
+ 'node_node_revision_nid' => '1',
+ ),
+ );
+ $this->assertIdenticalResultset($view_vid, $resultset_vid, $column_map);
+ }
+
+ /**
+ * Test view with default join on node.nid.
+ */
+ function test_view_node_revision_nid() {
+ $view = new view();
+ $view->name = 'test_node_revision_nid';
+ $view->description = '';
+ $view->tag = '';
+ $view->base_table = 'node_revision';
+ $view->human_name = 'Test node revision nid';
+ $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['use_more_always'] = FALSE;
+ $handler->display->display_options['access']['type'] = 'perm';
+ $handler->display->display_options['access']['perm'] = 'view revisions';
+ $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';
+ /* Relationship: Content revision: Content */
+ $handler->display->display_options['relationships']['nid']['id'] = 'nid';
+ $handler->display->display_options['relationships']['nid']['table'] = 'node_revision';
+ $handler->display->display_options['relationships']['nid']['field'] = 'nid';
+ $handler->display->display_options['relationships']['nid']['label'] = 'NID';
+ $handler->display->display_options['relationships']['nid']['required'] = TRUE;
+ /* Field: Content revision: Vid */
+ $handler->display->display_options['fields']['vid']['id'] = 'vid';
+ $handler->display->display_options['fields']['vid']['table'] = 'node_revision';
+ $handler->display->display_options['fields']['vid']['field'] = 'vid';
+ /* Field: Content revision: Nid */
+ $handler->display->display_options['fields']['nid_1']['id'] = 'nid_1';
+ $handler->display->display_options['fields']['nid_1']['table'] = 'node_revision';
+ $handler->display->display_options['fields']['nid_1']['field'] = 'nid';
+ /* Field: Content: Nid */
+ $handler->display->display_options['fields']['nid']['id'] = 'nid';
+ $handler->display->display_options['fields']['nid']['table'] = 'node';
+ $handler->display->display_options['fields']['nid']['field'] = 'nid';
+ $handler->display->display_options['fields']['nid']['relationship'] = 'nid';
+ /* Contextual filter: Content revision: Nid */
+ $handler->display->display_options['arguments']['nid']['id'] = 'nid';
+ $handler->display->display_options['arguments']['nid']['table'] = 'node_revision';
+ $handler->display->display_options['arguments']['nid']['field'] = 'nid';
+ $handler->display->display_options['arguments']['nid']['default_argument_type'] = 'fixed';
+ $handler->display->display_options['arguments']['nid']['summary']['number_of_records'] = '0';
+ $handler->display->display_options['arguments']['nid']['summary']['format'] = 'default_summary';
+ $handler->display->display_options['arguments']['nid']['summary_options']['items_per_page'] = '25';
+
+ return $view;
+ }
+
+ /**
+ * Test view with default join on node.vid.
+ */
+ function test_view_node_revision_vid() {
+ $view = new view();
+ $view->name = 'test_node_revision_vid';
+ $view->description = '';
+ $view->tag = '';
+ $view->base_table = 'node_revision';
+ $view->human_name = 'Test node revision vid';
+ $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['use_more_always'] = FALSE;
+ $handler->display->display_options['access']['type'] = 'perm';
+ $handler->display->display_options['access']['perm'] = 'view revisions';
+ $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';
+ /* Relationship: Content revision: Content */
+ $handler->display->display_options['relationships']['vid']['id'] = 'vid';
+ $handler->display->display_options['relationships']['vid']['table'] = 'node_revision';
+ $handler->display->display_options['relationships']['vid']['field'] = 'vid';
+ $handler->display->display_options['relationships']['vid']['label'] = 'VID';
+ $handler->display->display_options['relationships']['vid']['required'] = TRUE;
+ /* Field: Content revision: Vid */
+ $handler->display->display_options['fields']['vid']['id'] = 'vid';
+ $handler->display->display_options['fields']['vid']['table'] = 'node_revision';
+ $handler->display->display_options['fields']['vid']['field'] = 'vid';
+ /* Field: Content revision: Nid */
+ $handler->display->display_options['fields']['nid_1']['id'] = 'nid_1';
+ $handler->display->display_options['fields']['nid_1']['table'] = 'node_revision';
+ $handler->display->display_options['fields']['nid_1']['field'] = 'nid';
+ /* Field: Content: Nid */
+ $handler->display->display_options['fields']['nid']['id'] = 'nid';
+ $handler->display->display_options['fields']['nid']['table'] = 'node';
+ $handler->display->display_options['fields']['nid']['field'] = 'nid';
+ $handler->display->display_options['fields']['nid']['relationship'] = 'vid';
+ /* Contextual filter: Content revision: Nid */
+ $handler->display->display_options['arguments']['nid']['id'] = 'nid';
+ $handler->display->display_options['arguments']['nid']['table'] = 'node_revision';
+ $handler->display->display_options['arguments']['nid']['field'] = 'nid';
+ $handler->display->display_options['arguments']['nid']['default_argument_type'] = 'fixed';
+ $handler->display->display_options['arguments']['nid']['summary']['number_of_records'] = '0';
+ $handler->display->display_options['arguments']['nid']['summary']['format'] = 'default_summary';
+ $handler->display->display_options['arguments']['nid']['summary_options']['items_per_page'] = '25';
+
+ return $view;
+ }
+}
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/views/tests/styles/views_plugin_style.test b/kolab.org/www/drupal-7.18/sites/all/modules/views/tests/styles/views_plugin_style.test
index 87f5b7d..dfc5413 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/views/tests/styles/views_plugin_style.test
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/views/tests/styles/views_plugin_style.test
@@ -8,7 +8,7 @@
/**
* Tests some general style plugin related functionality.
*/
-class ViewsPluginStyleTestCase extends ViewsSqlTest {
+class ViewsPluginStyleTestCase extends ViewsPluginStyleTestBase {
public static function getInfo() {
return array(
'name' => 'Styles',
@@ -232,20 +232,6 @@ class ViewsPluginStyleTestCase extends ViewsSqlTest {
}
}
-
- /**
- * 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.
*/
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/views/tests/styles/views_plugin_style_base.test b/kolab.org/www/drupal-7.18/sites/all/modules/views/tests/styles/views_plugin_style_base.test
new file mode 100644
index 0000000..514077d
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/views/tests/styles/views_plugin_style_base.test
@@ -0,0 +1,33 @@
+<?php
+
+/**
+ * @file
+ * Definition of ViewsPluginStyleTestBase.
+ */
+
+/**
+ * Provides a base foundation for testing style plugins.
+ */
+abstract class ViewsPluginStyleTestBase extends ViewsSqlTest {
+
+ /**
+ * Stores the SimpleXML representation of the output.
+ *
+ * @var SimpleXMLElement
+ */
+ protected $elements;
+
+ /**
+ * 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);
+ }
+ }
+
+}
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/views/tests/styles/views_plugin_style_jump_menu.test b/kolab.org/www/drupal-7.18/sites/all/modules/views/tests/styles/views_plugin_style_jump_menu.test
index 9a53bfc..dd4eca0 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/views/tests/styles/views_plugin_style_jump_menu.test
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/views/tests/styles/views_plugin_style_jump_menu.test
@@ -9,6 +9,14 @@
* Tests jump menu style functionality.
*/
class viewsPluginStyleJumpMenuTest extends ViewsSqlTest {
+
+ /**
+ * Stores all created nodes.
+ *
+ * @var array
+ */
+ var $nodes;
+
public static function getInfo() {
return array(
'name' => 'Jump menu',
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/views/tests/styles/views_plugin_style_mapping.test b/kolab.org/www/drupal-7.18/sites/all/modules/views/tests/styles/views_plugin_style_mapping.test
new file mode 100644
index 0000000..5785075
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/views/tests/styles/views_plugin_style_mapping.test
@@ -0,0 +1,144 @@
+<?php
+
+/**
+ * @file
+ * Definition of ViewsPluginStyleMappingTest.
+ */
+
+/**
+ * Tests the default/mapping row style.
+ */
+class ViewsPluginStyleMappingTest extends ViewsPluginStyleTestBase {
+
+ public static function getInfo() {
+ return array(
+ 'name' => 'Style: Mapping',
+ 'description' => 'Test mapping style functionality.',
+ 'group' => 'Views Plugins',
+ );
+ }
+
+ public function setUp() {
+ parent::setUp();
+
+ // Reset the plugin data.
+ views_fetch_plugin_data(NULL, NULL, TRUE);
+ }
+
+ protected function viewsPlugins() {
+ return array(
+ 'style' => array(
+ 'test_mapping' => array(
+ 'title' => t('Field mapping'),
+ 'help' => t('Maps specific fields to specific purposes.'),
+ 'handler' => 'views_test_plugin_style_test_mapping',
+ 'path' => drupal_get_path('module', 'views_test') . '/test_plugins',
+ 'theme' => 'views_view_mapping_test',
+ 'theme path' => drupal_get_path('module', 'views_test'),
+ 'theme file' => 'views_test.module',
+ 'uses row plugin' => FALSE,
+ 'uses fields' => TRUE,
+ 'uses options' => TRUE,
+ 'uses grouping' => FALSE,
+ 'type' => 'normal',
+ ),
+ ),
+ );
+ }
+
+ /**
+ * Overrides ViewsTestCase::getBasicView().
+ */
+ protected function getBasicView() {
+ $view = parent::getBasicView();
+ $view->display['default']->handler->override_option('style_plugin', 'test_mapping');
+ $view->display['default']->handler->override_option('style_options', array(
+ 'mapping' => array(
+ 'name_field' => 'name',
+ 'numeric_field' => array(
+ 'age',
+ ),
+ 'title_field' => 'name',
+ 'toggle_numeric_field' => TRUE,
+ 'toggle_title_field' => TRUE,
+ ),
+ ));
+ $view->display['default']->handler->override_option('fields', array(
+ 'age' => array(
+ 'id' => 'age',
+ 'table' => 'views_test',
+ 'field' => 'age',
+ 'relationship' => 'none',
+ ),
+ 'name' => array(
+ 'id' => 'name',
+ 'table' => 'views_test',
+ 'field' => 'name',
+ 'relationship' => 'none',
+ ),
+ 'job' => array(
+ 'id' => 'job',
+ 'table' => 'views_test',
+ 'field' => 'job',
+ 'relationship' => 'none',
+ ),
+ ));
+ return $view;
+ }
+
+ /**
+ * Verifies that the fields were mapped correctly.
+ */
+ public function testMappedOutput() {
+ $view = $this->getBasicView();
+ $output = $this->mappedOutputHelper($view);
+ $this->assertTrue(strpos($output, 'job') === FALSE, 'The job field is added to the view but not in the mapping.');
+
+ $view = $this->getBasicView();
+ $view->display['default']->display_options['style_options']['mapping']['name_field'] = 'job';
+ $output = $this->mappedOutputHelper($view);
+ $this->assertTrue(strpos($output, 'job') !== FALSE, 'The job field is added to the view and is in the mapping.');
+ }
+
+ /**
+ * Tests the mapping of fields.
+ *
+ * @param view $view
+ * The view to test.
+ *
+ * @return string
+ * The view rendered as HTML.
+ */
+ protected function mappedOutputHelper($view) {
+ $rendered_output = $view->preview();
+ $this->storeViewPreview($rendered_output);
+ $rows = $this->elements->body->div->div->div;
+ $data_set = $this->dataSet();
+
+ $count = 0;
+ foreach ($rows as $row) {
+ $attributes = $row->attributes();
+ $class = (string) $attributes['class'][0];
+ $this->assertTrue(strpos($class, 'views-row-mapping-test') !== FALSE, 'Make sure that each row has the correct CSS class.');
+
+ foreach ($row->div as $field) {
+ // Split up the field-level class, the first part is the mapping name
+ // and the second is the field ID.
+ $field_attributes = $field->attributes();
+ $name = strtok((string) $field_attributes['class'][0], '-');
+ $field_id = strtok('-');
+
+ // The expected result is the mapping name and the field value,
+ // separated by ':'.
+ $expected_result = $name . ':' . $data_set[$count][$field_id];
+ $actual_result = (string) $field;
+ $this->assertIdentical($expected_result, $actual_result, format_string('The fields were mapped successfully: %name => %field_id', array('%name' => $name, '%field_id' => $field_id)));
+ }
+
+ $count++;
+ }
+
+ return $rendered_output;
+ }
+
+}
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/views/tests/styles/views_plugin_style_unformatted.test b/kolab.org/www/drupal-7.18/sites/all/modules/views/tests/styles/views_plugin_style_unformatted.test
index 20b7b4d..0c0e882 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/views/tests/styles/views_plugin_style_unformatted.test
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/views/tests/styles/views_plugin_style_unformatted.test
@@ -8,14 +8,7 @@
/**
* Tests the default/unformatted row style.
*/
-class ViewsPluginStyleUnformattedTestCase extends ViewsSqlTest {
-
- /**
- * Stores all created nodes.
- *
- * @var array
- */
- var $nodes;
+class ViewsPluginStyleUnformattedTestCase extends ViewsPluginStyleTestBase {
public static function getInfo() {
return array(
@@ -26,19 +19,6 @@ class ViewsPluginStyleUnformattedTestCase extends ViewsSqlTest {
}
/**
- * 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() {
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/views/tests/test_plugins/views_test_plugin_style_test_mapping.inc b/kolab.org/www/drupal-7.18/sites/all/modules/views/tests/test_plugins/views_test_plugin_style_test_mapping.inc
new file mode 100644
index 0000000..b926787
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/views/tests/test_plugins/views_test_plugin_style_test_mapping.inc
@@ -0,0 +1,52 @@
+<?php
+
+/**
+ * @file
+ * Definition of views_test_plugin_style_test_mapping.
+ */
+
+/**
+ * Provides a test mapping style plugin.
+ */
+class views_test_plugin_style_test_mapping extends views_plugin_style_mapping {
+
+ /**
+ * Overrides views_plugin_style_mapping::define_mapping().
+ */
+ protected function define_mapping() {
+ return array(
+ 'title_field' => array(
+ '#title' => t('Title field'),
+ '#description' => t('Choose the field with the custom title.'),
+ '#toggle' => TRUE,
+ '#required' => TRUE,
+ ),
+ 'name_field' => array(
+ '#title' => t('Name field'),
+ '#description' => t('Choose the field with the custom name.'),
+ ),
+ 'numeric_field' => array(
+ '#title' => t('Numeric field'),
+ '#description' => t('Select one or more numeric fields.'),
+ '#multiple' => TRUE,
+ '#toggle' => TRUE,
+ '#filter' => 'filter_numeric_fields',
+ '#required' => TRUE,
+ ),
+ );
+ }
+
+ /**
+ * Restricts the allowed fields to only numeric fields.
+ *
+ * @param array $fields
+ * An array of field labels, keyed by the field ID.
+ */
+ protected function filter_numeric_fields(&$fields) {
+ foreach ($this->view->field as $id => $field) {
+ if (!($field instanceof views_handler_field_numeric)) {
+ unset($fields[$id]);
+ }
+ }
+ }
+}
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/views/tests/views_test.info b/kolab.org/www/drupal-7.18/sites/all/modules/views/tests/views_test.info
index c41ad54..23bd884 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/views/tests/views_test.info
+++ b/kolab.org/www/drupal-7.18/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-08-24
-version = "7.x-3.5"
+; Information added by drupal.org packaging script on 2013-04-09
+version = "7.x-3.7"
core = "7.x"
project = "views"
-datestamp = "1345829394"
+datestamp = "1365499236"
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/views/tests/views_test.module b/kolab.org/www/drupal-7.18/sites/all/modules/views/tests/views_test.module
index f6026b8..7adcf43 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/views/tests/views_test.module
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/views/tests/views_test.module
@@ -59,3 +59,59 @@ function views_test_views_pre_render(&$view) {
$view->pre_render_called = TRUE;
}
}
+
+/**
+ * Implements hook_preprocess_HOOK() for theme_views_view_mapping_test().
+ */
+function template_preprocess_views_view_mapping_test(&$variables) {
+ $variables['element'] = array();
+
+ foreach ($variables['rows'] as $delta => $row) {
+ $fields = array();
+ foreach ($variables['options']['mapping'] as $type => $field_names) {
+ if (!is_array($field_names)) {
+ $field_names = array($field_names);
+ }
+ foreach ($field_names as $field_name) {
+ if ($value = $variables['view']->style_plugin->get_field($delta, $field_name)) {
+ $fields[$type . '-' . $field_name] = $type . ':' . $value;
+ }
+ }
+ }
+
+ // If there are no fields in this row, skip to the next one.
+ if (empty($fields)) {
+ continue;
+ }
+
+ // Build a container for the row.
+ $variables['element'][$delta] = array(
+ '#type' => 'container',
+ '#attributes' => array(
+ 'class' => array(
+ 'views-row-mapping-test',
+ ),
+ ),
+ );
+
+ // Add each field to the row.
+ foreach ($fields as $key => $render) {
+ $variables['element'][$delta][$key] = array(
+ '#children' => $render,
+ '#type' => 'container',
+ '#attributes' => array(
+ 'class' => array(
+ $key,
+ ),
+ ),
+ );
+ }
+ }
+}
+
+/**
+ * Returns HTML for the Mapping Test style.
+ */
+function theme_views_view_mapping_test($variables) {
+ return drupal_render($variables['element']);
+}
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/views/tests/views_translatable.test b/kolab.org/www/drupal-7.18/sites/all/modules/views/tests/views_translatable.test
index 0cb27e4..983a97e 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/views/tests/views_translatable.test
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/views/tests/views_translatable.test
@@ -114,7 +114,6 @@ class ViewsTranslatableTest extends ViewsSqlTest {
'more1' => array('use_more_text'),
'Reset1' => array('exposed_form', 'reset_button_label'),
'Offset1' => array('pager', 'expose', 'offset_label'),
- 'Master1' => array('title'),
'title1' => array('title'),
'Tag first1' => array('pager', 'tags', 'first'),
'Tag prev1' => array('pager', 'tags', 'previous'),
@@ -124,9 +123,23 @@ class ViewsTranslatableTest extends ViewsSqlTest {
'fieldlabel1' => array('field', 'node', 'nid', 'label'),
'filterlabel1' => array('filter', 'node', 'nid', 'expose', 'label'),
'- All -' => array('pager', 'expose', 'items_per_page_options_all_label'),
+ 'Header1' => array('header', 'views', 'area', 'content'),
+ );
+
+ $formats = array(
+ 'Header1' => 'filtered_html',
);
+
foreach ($translatables as $translatable) {
$this->assertEqual($translatable['keys'], $this->string_keys[$translatable['value']]);
+
+ // Make sure the format is correct.
+ if (isset($formats[$translatable['value']])) {
+ $this->assertEqual($translatable['format'], $formats[$translatable['value']]);
+ }
+ else {
+ $this->assertNull($translatable['format'], 'No format defined');
+ }
}
}
}
@@ -169,6 +182,14 @@ class ViewsTranslatableTest extends ViewsSqlTest {
$handler->display->display_options['pager']['options']['expose']['offset_label'] = 'Offset1';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'fields';
+ /* Global: Header */
+ $handler->display->display_options['header']['area']['id'] = 'area';
+ $handler->display->display_options['header']['area']['table'] = 'views';
+ $handler->display->display_options['header']['area']['field'] = 'area';
+ $handler->display->display_options['header']['area']['empty'] = FALSE;
+ $handler->display->display_options['header']['area']['content'] = 'Header1';
+ $handler->display->display_options['header']['area']['format'] = 'filtered_html';
+ $handler->display->display_options['header']['area']['tokenize'] = 0;
/* Field: Content: Nid */
$handler->display->display_options['fields']['nid']['id'] = 'nid';
$handler->display->display_options['fields']['nid']['table'] = 'node';