cms/drupal/modules/simpletest/tests/upgrade/update.field.test
changeset 541 e756a8c72c3d
equal deleted inserted replaced
540:07239de796bb 541:e756a8c72c3d
       
     1 <?php
       
     2 
       
     3 /**
       
     4  * @file
       
     5  * Provides update path tests for the Field module.
       
     6  */
       
     7 
       
     8 /**
       
     9  * Tests the Field 7.0 -> 7.x update path.
       
    10  */
       
    11 class FieldUpdatePathTestCase extends UpdatePathTestCase {
       
    12   public static function getInfo() {
       
    13     return array(
       
    14       'name' => 'Field update path',
       
    15       'description' => 'Field update path tests.',
       
    16       'group' => 'Upgrade path',
       
    17     );
       
    18   }
       
    19 
       
    20   public function setUp() {
       
    21     // Use the filled update path and our field data.
       
    22     $path = drupal_get_path('module', 'simpletest') . '/tests/upgrade';
       
    23     $this->databaseDumpFiles = array(
       
    24       $path . '/drupal-7.filled.standard_all.database.php.gz',
       
    25       $path . '/drupal-7.field.database.php',
       
    26     );
       
    27     parent::setUp();
       
    28 
       
    29     // Our test data includes poll extra field settings.
       
    30     $this->uninstallModulesExcept(array('field', 'poll'));
       
    31   }
       
    32 
       
    33   /**
       
    34    * Tests that the update is successful.
       
    35    */
       
    36   public function testFilledUpgrade() {
       
    37     $this->assertTrue($this->performUpgrade(), 'The update was completed successfully.');
       
    38     $expected_settings = array(
       
    39       'extra_fields' => array(
       
    40         'display' => array(
       
    41           'poll_view_voting' => array(
       
    42             'default' => array(
       
    43               'weight' => '0',
       
    44               'visible' => TRUE,
       
    45             ),
       
    46           ),
       
    47           'poll_view_results' => array(
       
    48             'default' => array(
       
    49               'weight' => '0',
       
    50               'visible' => FALSE,
       
    51             ),
       
    52           ),
       
    53         ),
       
    54         'form' => array(),
       
    55       ),
       
    56       'view_modes' => array(),
       
    57     );
       
    58     $actual_settings = field_bundle_settings('node', 'poll');
       
    59     $this->assertEqual($expected_settings, $actual_settings, 'Settings stored in field_bundle_settings were updated to per-bundle settings.');
       
    60   }
       
    61 }