summaryrefslogtreecommitdiff
path: root/modules/simpletest/tests
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2009-07-02 04:27:23 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2009-07-02 04:27:23 +0000
commit0142292c718eaf31e73c3ee0cd9ef427bc18de16 (patch)
tree69e3a1784a48af68ec65537d375058bb2cb61daa /modules/simpletest/tests
parente9ca98b69d45b935fe4963a345cba92a87164ddb (diff)
downloadbrdo-0142292c718eaf31e73c3ee0cd9ef427bc18de16.tar.gz
brdo-0142292c718eaf31e73c3ee0cd9ef427bc18de16.tar.bz2
#373201 by moshe weitzman, chx, Frando, eaton: Allow renderable array properties to be passed directly to theme functions.
Diffstat (limited to 'modules/simpletest/tests')
-rw-r--r--modules/simpletest/tests/common.test22
-rw-r--r--modules/simpletest/tests/common_test.info8
-rw-r--r--modules/simpletest/tests/common_test.module25
3 files changed, 55 insertions, 0 deletions
diff --git a/modules/simpletest/tests/common.test b/modules/simpletest/tests/common.test
index 905fe7cd0..538fb1b2a 100644
--- a/modules/simpletest/tests/common.test
+++ b/modules/simpletest/tests/common.test
@@ -587,6 +587,10 @@ class DrupalRenderUnitTestCase extends DrupalWebTestCase {
);
}
+ function setUp() {
+ parent::setUp('common_test');
+ }
+
/**
* Test sorting by weight.
*/
@@ -637,6 +641,24 @@ class DrupalRenderUnitTestCase extends DrupalWebTestCase {
// The elements should appear in output in the same order as the array.
$this->assertTrue(strpos($output, $second) < strpos($output, $first), t('Elements were not sorted.'));
}
+
+ /**
+ * Test passing arguments to the theme function.
+ */
+ function testDrupalRenderThemeArguments() {
+ $element = array(
+ '#theme' => 'common_test_foo',
+ );
+ // Test that defaults work.
+ $this->assertEqual(drupal_render($element), 'foobar', 'Defaults work');
+ dd(drupal_render($e), 'defaults'); $element = array(
+ '#theme' => 'common_test_foo',
+ '#foo' => $this->randomName(),
+ '#bar' => $this->randomName(),
+ );
+ // Test that passing arguments to the theme function works.
+ $this->assertEqual(drupal_render($element), $element['#foo'] . $element['#bar'], 'Passing arguments to theme functions works');
+ }
}
/**
diff --git a/modules/simpletest/tests/common_test.info b/modules/simpletest/tests/common_test.info
new file mode 100644
index 000000000..81a15472a
--- /dev/null
+++ b/modules/simpletest/tests/common_test.info
@@ -0,0 +1,8 @@
+; $Id$
+name = "Common Test"
+description = "Support module for Common tests."
+package = Testing
+version = VERSION
+core = 7.x
+files[] = common_test.module
+hidden = TRUE
diff --git a/modules/simpletest/tests/common_test.module b/modules/simpletest/tests/common_test.module
new file mode 100644
index 000000000..71d384d10
--- /dev/null
+++ b/modules/simpletest/tests/common_test.module
@@ -0,0 +1,25 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Helper module for the Common tests.
+ */
+
+/**
+ * Implement hook_theme().
+ */
+function common_test_theme() {
+ return array(
+ 'common_test_foo' => array(
+ 'arguments' => array('foo' => 'foo', 'bar' => 'bar'),
+ ),
+ );
+}
+
+/**
+ * Theme function for testing drupal_render() theming.
+ */
+function theme_common_test_foo($foo, $bar) {
+ return $foo . $bar;
+}