diff --git a/tests/features.test b/tests/features.test index 8da66a3..ab48f74 100644 --- a/tests/features.test +++ b/tests/features.test @@ -280,3 +280,53 @@ class FeaturesCtoolsIntegrationTest extends DrupalWebTestCase { } } } + +/** + * Tests Features' Drush integration. + */ +class FeaturesDrushExportTest extends DrupalWebTestCase { + protected $profile = 'testing'; + private $test_module = 'my_sweet_feature'; + private $test_module_path = 'public://my_sweet_feature'; + + /** + * Test info. + */ + public static function getInfo() { + return array( + 'name' => t('Drush integration'), + 'description' => t('Run tests on Features\' `drush` commands.'), + 'group' => t('Features'), + ); + } + + /** + * Set up test. + */ + public function setUp() { + parent::setUp(array('features')); + } + + /** + * Test features-export command when module is not present. + */ + public function testModuleExportNew() { + $stream_wrapper = file_stream_wrapper_get_instance_by_uri($this->test_module_path); + $directory = $stream_wrapper->getDirectoryPath(); + $module_path = "$directory/$this->test_module"; + + // Verify the module files are not present. + $module_file_exists = is_dir($module_path); + $this->assertFalse($module_file_exists, 'The test module files are not present.'); + + // Run drush command then check that the module was created. + exec("drush fe $this->test_module node:page -y --destination=\"$directory\"", $output); + $module_file_exists = is_dir($module_path); + $this->assertTrue($module_file_exists, 'The test module has been created'); + + // Verify the component was exported. + $component_exported = is_file("$module_path/my_sweet_feature.features.field.inc"); + $this->assertTrue($component_exported, 'The component was exported succesfully.'); + } + +}