diff --git a/tests/features.test b/tests/features.test index 8da66a3..d2ed9a0 100644 --- a/tests/features.test +++ b/tests/features.test @@ -280,3 +280,54 @@ 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 = 'sites/all/modules/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() { + // 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.'); + + // Run drush command then check that the module was created. + exec("drush fe $this->test_module node:page -y", $output); + + $module_file_exists = is_dir($this->test_module_path); + $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.'); + + // Remove the test module. + file_unmanaged_delete_recursive($this->test_module_path); + } + +}