1.20.x config.test public ConfigurationSyncTest::testSync()

Tests that hook_config_create() is run during config sync.

File

modules/config/tests/config.test, line 571
Tests for Configuration module.

Class

ConfigurationSyncTest
Tests that hook_config_create() is run during config sync.

Code

public function testSync() {
  $config_data = config_get('config_test_hooks.data');
  $this->assertEqual('brie', $config_data['favorite_cheese'], 'Config variable is set to brie.');
  $this->assertFalse(field_info_field('field_config_test'), 'The test field does not exist.');

  module_enable(array('config_test'));
  // Test that config value is altered when default config is synced from
  // another module.
  $config_data = config_get('config_test_hooks.data');
  $this->assertEqual('cheddar', $config_data['favorite_cheese'], 'Config variable is set to cheddar.');
  $this->assertTrue(field_info_field('field_config_test'), 'The test field has been installed.');

  // Test that content can actually be saved into the new field that was
  // created.
  $this->backdropLogin($this->admin_user);
  $this->backdropPost('node/add/post', array(
    'title' => 'Test post',
    'field_config_test[und][0][value]' => 'Test value in the new field',
  ), t('Save'));

  $this->assertText('Post Test post has been created.');
  $this->assertText('Test value in the new field');
}