summaryrefslogtreecommitdiff
path: root/kolab.org/www/drupal-7.15/sites/all/modules/ctools/tests
diff options
context:
space:
mode:
Diffstat (limited to 'kolab.org/www/drupal-7.15/sites/all/modules/ctools/tests')
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/tests/context.test58
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/tests/css.test12
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/tests/ctools_export_test/ctools_export_test.info6
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/tests/ctools_plugin_test.info7
4 files changed, 77 insertions, 6 deletions
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/tests/context.test b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/tests/context.test
new file mode 100644
index 0000000..b5f6fb1
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/tests/context.test
@@ -0,0 +1,58 @@
+<?php
+
+class CtoolsContextKeywordsSubstitutionTestCase extends DrupalWebTestCase {
+ public static function getInfo() {
+ return array(
+ 'name' => 'Keywords substitution',
+ 'description' => 'Verify that keywords are properly replaced with data.',
+ 'group' => 'Chaos Tools Suite',
+ );
+ }
+
+ public function setUp() {
+ parent::setUp('ctools');
+
+ ctools_include('context');
+ }
+
+ public function testKeywordsSubstitution() {
+ // Create node context for substitution.
+ $node = $this->drupalCreateNode();
+ $context = ctools_context_create('node', $node);
+ $contexts = array('argument_1' => $context);
+
+ // Run tests on some edge cases.
+ $checks = array(
+ '%node:title' => array(
+ "{$node->title}",
+ t('Keyword and converter have been replaced.'),
+ ),
+ '%%node:title' => array(
+ "%node:title",
+ t('Keyword after escaped percent sign left untouched.'),
+ ),
+ '%node:title%node:nid' => array(
+ "{$node->title}{$node->nid}",
+ t('Multiple substitutions have been replaced.'),
+ ),
+ '%node:title:' => array(
+ "{$node->title}:",
+ t('Colon after keyword and converter left untouched.'),
+ ),
+ '%node:title%%' => array(
+ "{$node->title}%",
+ t('Escaped percent sign after keyword and converter left untouched.'),
+ ),
+ '%%%node:title' => array(
+ "%{$node->title}",
+ t('Keyword after escaped and unescaped percent sign has been replaced.'),
+ ),
+ );
+ foreach ($checks as $string => $expectations) {
+ list($expected_result, $message) = $expectations;
+ $actual_result = ctools_context_keyword_substitute($string, array(), $contexts);
+ $this->assertEqual($actual_result, $expected_result, $message);
+ }
+ }
+
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/tests/css.test b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/tests/css.test
index 039e975..4a5200c 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/tests/css.test
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/tests/css.test
@@ -65,5 +65,17 @@ class CtoolsCssTestCase extends DrupalWebTestCase {
$font_size = (strpos($filtered, 'font-size:12px;') !== FALSE);
$color = (strpos($filtered, 'color:blue') !== FALSE);
$this->assertTrue($font_size && $color, 'Multiple properties are merged.');
+
+ $css = '@import url("other.css");p {color: red;}';
+ $filtered = ctools_css_filter($css);
+ $other_css = (strpos($filtered, 'other.css') === FALSE);
+ $color = (strpos($filtered, 'color:red') !== FALSE);
+ $this->assertTrue($other_css && $color, 'CSS is properly sanitized.');
+
+ $css = ';p {color: red; font-size: 12px;}';
+ $filtered = ctools_css_filter($css);
+ $font_size = (strpos($filtered, 'font-size:12px;') !== FALSE);
+ $color = (strpos($filtered, 'color:red') !== FALSE);
+ $this->assertTrue($font_size && $color, 'Multiple properties are retained.');
}
}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/tests/ctools_export_test/ctools_export_test.info b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/tests/ctools_export_test/ctools_export_test.info
index 55bcba9..2d975c3 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/tests/ctools_export_test/ctools_export_test.info
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/tests/ctools_export_test/ctools_export_test.info
@@ -7,9 +7,9 @@ hidden = TRUE
files[] = ctools_export.test
-; Information added by drupal.org packaging script on 2012-08-08
-version = "7.x-1.1"
+; Information added by drupal.org packaging script on 2012-08-18
+version = "7.x-1.2"
core = "7.x"
project = "ctools"
-datestamp = "1344463011"
+datestamp = "1345319204"
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/tests/ctools_plugin_test.info b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/tests/ctools_plugin_test.info
index cf4bf9c..6d5e9cd 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/tests/ctools_plugin_test.info
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/tests/ctools_plugin_test.info
@@ -6,11 +6,12 @@ dependencies[] = ctools
files[] = ctools.plugins.test
files[] = object_cache.test
files[] = css.test
+files[] = context.test
hidden = TRUE
-; Information added by drupal.org packaging script on 2012-08-08
-version = "7.x-1.1"
+; Information added by drupal.org packaging script on 2012-08-18
+version = "7.x-1.2"
core = "7.x"
project = "ctools"
-datestamp = "1344463011"
+datestamp = "1345319204"