diff --git a/tests/features.test b/tests/features.test index 8b25ef7..69b944c 100644 --- a/tests/features.test +++ b/tests/features.test @@ -281,23 +281,21 @@ class FeaturesCtoolsIntegrationTest extends DrupalWebTestCase { } } - - /** - * Tests Features Drush Functionality. + * Tests Features' Drush integration. */ class FeaturesDrushExportTest extends DrupalWebTestCase { protected $profile = 'testing'; private $test_module = 'my_sweet_feature'; - private $test_module_path = "sites/all/modules/my_sweet_feature"; + private $test_module_path = 'public://my_sweet_feature'; /** * Test info. */ public static function getInfo() { return array( - 'name' => t('Features drush functionality.'), - 'description' => t('Run functional tests on Features `drush` commands.'), + 'name' => t('Drush integration'), + 'description' => t('Run tests on Features\' `drush` commands.'), 'group' => t('Features'), ); } @@ -306,7 +304,7 @@ class FeaturesDrushExportTest extends DrupalWebTestCase { * Set up test. */ public function setUp() { - parent::setUp(array('features', )); + parent::setUp(array('features')); } public function tearDown() { @@ -318,30 +316,24 @@ class FeaturesDrushExportTest extends DrupalWebTestCase { * Test features-export command when module is not present. */ public function testModuleExportNew() { - // We need to make sure the module does not exist. - $this->deleteTestModuleFiles(); - // Verify the module files are not present. $module_file_exists = is_dir($this->test_module_path); - $this->assertFalse($module_file_exists, "The test module files are not present."); + $this->assertFalse($module_file_exists, 'The test module files are not present.'); + + // Run drush command then check that the module was created. + $stream_wrapper = file_stream_wrapper_get_instance_by_uri($this->test_module_path); + $directory = $stream_wrapper->getDirectoryPath(); - // Run drush then check that the module was created. - exec("drush -y fe $this->test_module node:page", $output); + exec("drush fe $this->test_module node:page -y --destination=\"$directory\"", $output); $module_file_exists = is_dir($this->test_module_path); - $this->assertTrue($module_file_exists, "The test module has been created"); + $this->assertTrue($module_file_exists, 'The test module has been created'); // Verify the component was exported. $component_exported = is_file("$this->test_module_path/my_sweet_feature.features.field.inc"); - $this->assertTrue($component_exported, "The component was exported succesfully."); + $this->assertTrue($component_exported, 'The component was exported succesfully.'); - } - - - /** - * If a test module is found, remove it from the system. - */ - private function deleteTestModuleFiles() { + // Remove the test module. file_unmanaged_delete_recursive($this->test_module_path); }