public function ConfigurationHandlerVariableTestCase::testCheckModifications in Configuration Management 7.2
File
- tests/
handlers/ vocabularies.test, line 81 - Tests for Configuration Management: Vocabularies.
Class
- ConfigurationHandlerVariableTestCase
- Base class for functional tests for configuration management.
Code
public function testCheckModifications() {
// Change the path from where the configurations are loaded.
$source = drupal_get_path('module', 'configuration') . '/tests/test_configs/';
$config = 'vocabulary.tags';
$results = ConfigurationManagement::importToActiveStore(array(
$config,
), FALSE, FALSE, TRUE, $source);
$object = db_select('configuration_tracked', 'ct')
->fields('ct')
->condition('component', 'vocabulary')
->condition('identifier', 'tags')
->execute()
->fetchObject();
$vid = db_query('SELECT vid FROM {taxonomy_vocabulary} WHERE machine_name = :machine_name', array(
':machine_name' => 'tags',
))
->fetchField();
$original_vocabulary = taxonomy_vocabulary_load($vid);
$this
->assertTrue(!empty($object), 'The vocabulary was suscessfully tracked.');
$web_user = $this
->drupalCreateUser(array(
'administer taxonomy',
));
$this
->drupalLogin($web_user);
$edit = array();
$edit['name'] = 'Modified';
$this
->drupalPost('admin/structure/taxonomy/tags/edit', $edit, t('Save'));
$this
->assertRaw(t('Updated vocabulary %name.', array(
'%name' => 'Modified',
)), 'The vocabulary for site name was modified');
$results = ConfigurationManagement::importToActiveStore(array(
'vocabulary.tags',
), FALSE, FALSE);
$current_vocabulary = taxonomy_vocabulary_load($vid);
$this
->assertEqual($original_vocabulary->name, $current_vocabulary->name, 'The vocabulary was suscessfully reverted.');
}