5 use Webmozart\PathUtil\Path;
11 class CommandInfoAlterTest extends CommandUnishTestCase
13 use TestModuleHelperTrait;
16 * Tests command info alter.
18 public function testCommandInfoAlter()
20 $this->setUpDrupal(1, true);
21 $this->setupModulesForTests(['woot'], Path::join(__DIR__, 'resources/modules/d8'));
22 $this->drush('pm-enable', ['woot']);
23 $this->drush('woot:altered', [], ['help' => true, 'debug' => true]);
24 $this->assertNotContains('woot-initial-alias', $this->getOutput());
25 $this->assertContains('woot-new-alias', $this->getOutput());
27 // Check the debug messages.
28 $this->assertContains('[debug] Commands are potentially altered in Drupal\woot\WootCommandInfoAlterer.', $this->getErrorOutput());
29 $this->assertContains("[debug] Module 'woot' changed the alias of 'woot:altered' command into 'woot-new-alias' in Drupal\woot\WootCommandInfoAlterer::alterCommandInfo().", $this->getErrorOutput());
31 // Try to run the command with the initial alias.
32 $this->drush('woot-initial-alias', [], [], null, null, self::EXIT_ERROR);
33 // Run the command with the altered alias.
34 $this->drush('woot-new-alias');