summaryrefslogtreecommitdiff
path: root/modules/simpletest/drupal_web_test_case.php
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2009-06-12 08:39:40 +0000
committerDries Buytaert <dries@buytaert.net>2009-06-12 08:39:40 +0000
commit3d64cb5ecae7c0d093e1343f87901769dc7d819e (patch)
tree765b3104ae2bbdf96ac677f8deab9b5457ffa4bf /modules/simpletest/drupal_web_test_case.php
parentbfdea95337376b00e60049b640c076e8ab32293f (diff)
downloadbrdo-3d64cb5ecae7c0d093e1343f87901769dc7d819e.tar.gz
brdo-3d64cb5ecae7c0d093e1343f87901769dc7d819e.tar.bz2
- Patch #372743 by bjaspan, yched, KarenS, catch et al: node body and teasers as fields. Oh, my.
Diffstat (limited to 'modules/simpletest/drupal_web_test_case.php')
-rw-r--r--modules/simpletest/drupal_web_test_case.php32
1 files changed, 21 insertions, 11 deletions
diff --git a/modules/simpletest/drupal_web_test_case.php b/modules/simpletest/drupal_web_test_case.php
index b2d5af76d..535e18b4c 100644
--- a/modules/simpletest/drupal_web_test_case.php
+++ b/modules/simpletest/drupal_web_test_case.php
@@ -632,18 +632,17 @@ class DrupalWebTestCase extends DrupalTestCase {
*
* @param $settings
* An associative array of settings to change from the defaults, keys are
- * node properties, for example 'body' => 'Hello, world!'.
+ * node properties, for example 'title' => 'Hello, world!'.
* @return
* Created node object.
*/
protected function drupalCreateNode($settings = array()) {
// Populate defaults array.
$settings += array(
- 'body' => $this->randomName(32),
+ 'body' => array(array()),
'title' => $this->randomName(8),
'comment' => 2,
'changed' => REQUEST_TIME,
- 'format' => FILTER_FORMAT_DEFAULT,
'moderate' => 0,
'promote' => 0,
'revision' => 1,
@@ -660,11 +659,6 @@ class DrupalWebTestCase extends DrupalTestCase {
$settings['date'] = format_date($settings['created'], 'custom', 'Y-m-d H:i:s O');
}
- // Add the default teaser.
- if (!isset($settings['teaser'])) {
- $settings['teaser'] = $settings['body'];
- }
-
// If the node's user uid is not specified manually, use the currently
// logged in user if available, or else the user running the test.
if (!isset($settings['uid'])) {
@@ -677,6 +671,13 @@ class DrupalWebTestCase extends DrupalTestCase {
}
}
+ // Merge body field value and format separately.
+ $body = array(
+ 'value' => $this->randomName(32),
+ 'format' => FILTER_FORMAT_DEFAULT
+ );
+ $settings['body'][0] += $body;
+
$node = (object) $settings;
node_save($node);
@@ -989,9 +990,18 @@ class DrupalWebTestCase extends DrupalTestCase {
$this->preloadRegistry();
// Add the specified modules to the list of modules in the default profile.
- $args = func_get_args();
- $modules = array_unique(array_merge(drupal_get_profile_modules('default', 'en'), $args));
- drupal_install_modules($modules, TRUE);
+ // Install the modules specified by the default profile.
+ $core_modules = drupal_get_profile_modules('default', 'en');
+ drupal_install_modules($core_modules, TRUE);
+
+ node_type_clear();
+
+ // Install additional modules one at a time in order to make sure that the
+ // list of modules is updated between each module's installation.
+ $modules = func_get_args();
+ foreach ($modules as $module) {
+ drupal_install_modules(array($module), TRUE);
+ }
// Because the schema is static cached, we need to flush
// it between each run. If we don't, then it will contain