public function RoleExportTestCase::testExport in Role Export 6
File
- ./role_export.test, line 29
- Test Role Export.
Class
- RoleExportTestCase
- @file
Test Role Export.
Code
public function testExport() {
$u = $this
->drupalCreateUser(array(
'access administration pages',
'administer permissions',
));
$this
->drupalLogin($u);
$edit = array(
'name' => 'Test Role',
'machine_name' => 'test_role_with_different_machine_name',
);
$this
->drupalPost('admin/user/roles', $edit, 'Add role');
$this
->assertRaw("The role has been added.", "Unable to add test role.");
$roles = user_roles();
$this
->assertTrue(isset($roles[924007658]), "Test Role wasn't added, or has incorrect hashed machine_name.");
$this
->assertFalse(module_exists('test_role_feature'), "The test Feature export module is already enabled.");
drush_set_context('DRUSH_AFFIRMATIVE', TRUE);
drush_features_export('test_role_feature', 'role_export:test_role_with_different_machine_name');
$this
->assertTrue(is_dir('sites/all/modules/test_role_feature'), "Failed to export Feature.");
module_load_include('inc', 'test_role_feature', 'test_role_feature.features.role_export');
$this
->assertTrue(function_exists('test_role_feature_role_export_defaults'), "Function test_role_feature_role_export_defaults doesn't appear in exported Feature.");
$defaults = test_role_feature_role_export_defaults();
$this
->assertTrue(isset($defaults['test_role_with_different_machine_name']), "No default defined for test_role_with_different_machine_name.");
$this
->assertEqual($defaults['test_role_with_different_machine_name']['rid'], 924007658, "Incorrect exported rid.");
$this
->assertEqual($defaults['test_role_with_different_machine_name']['name'], 'Test Role', "Incorrect exported name.");
$this
->assertEqual($defaults['test_role_with_different_machine_name']['machine_name'], 'test_role_with_different_machine_name', "Incorrect exported machine_name.");
}