public function commandCase::testUnknownOptions

8.0.x commandTest.php public commandCase::testUnknownOptions()
6.x commandTest.php public commandCase::testUnknownOptions()
7.x commandTest.php public commandCase::testUnknownOptions()
5.x commandTest.php public commandCase::testUnknownOptions()
master commandTest.php public commandCase::testUnknownOptions()

Assert that unknown options are caught and flagged as errors

File

tests/commandTest.php, line 46

Namespace

Unish

Class

commandCase
@group base

Code

public function testUnknownOptions() {
  // Make sure an ordinary 'version' command works
  $return = $this->drush('version', array(), array('pipe' => NULL));
  // Add an unknown option --magic=1234 and insure it fails
  $return = $this->drush('version', array(), array('pipe' => NULL, 'magic' => 1234), NULL, NULL, self::EXIT_ERROR);
  // Finally, add in a hook that uses hook_drush_help_alter to allow the 'magic' option.
  // We need to run 'drush cc drush' to clear the commandfile cache; otherwise, our include will not be found.
  $include_path = dirname(__FILE__) . '/hooks/magic_help_alter';
  $this->drush('version', array(), array('include' => $include_path, 'pipe' => NULL, 'magic' => '1234', 'strict' => NULL));
}