summaryrefslogtreecommitdiff
path: root/modules/simpletest/tests
diff options
context:
space:
mode:
authorwebchick <webchick@24967.no-reply.drupal.org>2012-04-12 00:50:52 -0700
committerwebchick <webchick@24967.no-reply.drupal.org>2012-04-12 00:50:52 -0700
commite22feb71235729868069fbe862e804d66369d335 (patch)
tree77d422740ad03bbb199bf1be83d27e3d62206dd8 /modules/simpletest/tests
parent84194b38e368beec5acecee825d4ee3d01bf53a6 (diff)
downloadbrdo-e22feb71235729868069fbe862e804d66369d335.tar.gz
brdo-e22feb71235729868069fbe862e804d66369d335.tar.bz2
Issue #1211008 by yched, tim.plunkett, DamienMcKenna: Split field_bundle_settings() out per bundle.
Diffstat (limited to 'modules/simpletest/tests')
-rw-r--r--modules/simpletest/tests/upgrade/drupal-7.field.database.php16
-rw-r--r--modules/simpletest/tests/upgrade/update.field.test61
2 files changed, 77 insertions, 0 deletions
diff --git a/modules/simpletest/tests/upgrade/drupal-7.field.database.php b/modules/simpletest/tests/upgrade/drupal-7.field.database.php
new file mode 100644
index 000000000..630476133
--- /dev/null
+++ b/modules/simpletest/tests/upgrade/drupal-7.field.database.php
@@ -0,0 +1,16 @@
+<?php
+
+/**
+ * @file
+ * Test content for the field update path.
+ */
+
+db_insert('variable')->fields(array(
+ 'name',
+ 'value',
+))
+->values(array(
+ 'name' => 'field_bundle_settings',
+ 'value' => 'a:1:{s:4:"node";a:1:{s:4:"poll";a:1:{s:12:"extra_fields";a:1:{s:7:"display";a:2:{s:16:"poll_view_voting";a:1:{s:7:"default";a:2:{s:6:"weight";s:1:"0";s:7:"visible";b:1;}}s:17:"poll_view_results";a:1:{s:7:"default";a:2:{s:6:"weight";s:1:"0";s:7:"visible";b:0;}}}}}}}',
+))
+->execute();
diff --git a/modules/simpletest/tests/upgrade/update.field.test b/modules/simpletest/tests/upgrade/update.field.test
new file mode 100644
index 000000000..60d6ae8d9
--- /dev/null
+++ b/modules/simpletest/tests/upgrade/update.field.test
@@ -0,0 +1,61 @@
+<?php
+
+/**
+ * @file
+ * Provides update path tests for the Field module.
+ */
+
+/**
+ * Tests the Field 7.0 -> 7.x update path.
+ */
+class FieldUpdatePathTestCase extends UpdatePathTestCase {
+ public static function getInfo() {
+ return array(
+ 'name' => 'Field update path',
+ 'description' => 'Field update path tests.',
+ 'group' => 'Upgrade path',
+ );
+ }
+
+ public function setUp() {
+ // Use the filled update path and our field data.
+ $path = drupal_get_path('module', 'simpletest') . '/tests/upgrade';
+ $this->databaseDumpFiles = array(
+ $path . '/drupal-7.filled.standard_all.database.php.gz',
+ $path . '/drupal-7.field.database.php',
+ );
+ parent::setUp();
+
+ // Our test data includes poll extra field settings.
+ $this->uninstallModulesExcept(array('field', 'poll'));
+ }
+
+ /**
+ * Tests that the update is successful.
+ */
+ public function testFilledUpgrade() {
+ $this->assertTrue($this->performUpgrade(), t('The update was completed successfully.'));
+ $expected_settings = array(
+ 'extra_fields' => array(
+ 'display' => array(
+ 'poll_view_voting' => array(
+ 'default' => array(
+ 'weight' => '0',
+ 'visible' => TRUE,
+ ),
+ ),
+ 'poll_view_results' => array(
+ 'default' => array(
+ 'weight' => '0',
+ 'visible' => FALSE,
+ ),
+ ),
+ ),
+ 'form' => array(),
+ ),
+ 'view_modes' => array(),
+ );
+ $actual_settings = field_bundle_settings('node', 'poll');
+ $this->assertEqual($expected_settings, $actual_settings, 'Settings stored in field_bundle_settings were updated to per-bundle settings.');
+ }
+}