public function FeedsHooksTestCase::testHookConfigDefaults in Feeds 7.2
Tests the hook hook_config_defaults().
File
- tests/
feeds_hooks.test, line 87 - Contains FeedsHooksTestCase.
Class
- FeedsHooksTestCase
- Tests for hooks invoked by Feeds not related to mapping.
Code
public function testHookConfigDefaults() {
// Switch on hook implementations in the feeds_tests module.
variable_set('feeds_tests_hook_config_defaults', TRUE);
$this
->createImporterConfiguration('Config defaults test', 'config_defaults_test');
// Load the importer and check the default value for
// 'feeds_tests_extra_setting'.
$importer = feeds_importer_load('config_defaults_test');
$importer_config = $importer
->getConfig();
$this
->assertFalse($importer_config['feeds_tests_extra_setting'], "Option 'Extra setting' is disabled.");
// Assert that other configurables do not have this setting.
$fetcher_config = $importer->fetcher
->getConfig();
$parser_config = $importer->fetcher
->getConfig();
$processor_config = $importer->fetcher
->getConfig();
$this
->assertFalse(isset($fetcher_config['feeds_tests_extra_setting']));
$this
->assertFalse(isset($parser_config['feeds_tests_extra_setting']));
$this
->assertFalse(isset($processor_config['feeds_tests_extra_setting']));
// Now change this setting.
$this
->setSettings('config_defaults_test', NULL, array(
'feeds_tests_extra_setting' => TRUE,
));
// Reload the importer and assert that the configuration option changed.
drupal_static_reset();
$importer = feeds_importer_load('config_defaults_test');
$importer_config = $importer
->getConfig();
$this
->assertTrue($importer_config['feeds_tests_extra_setting'], "Option 'Extra setting' is enabled.");
}