PHPUnit_TextUI_Command::handleArguments

Handles the command-line arguments.

A child class of PHPUnit_TextUI_Command can hook into the argument parsing by adding the switch(es) to the $longOptions array and point to a callback method that handles the switch(es) in the child class like this <code> <?php class MyCommand extends PHPUnit_TextUI_Command { public function __construct() { // my-switch won't accept a value, it's an on/off $this->longOptions['my-switch'] = 'myHandler'; // my-secondswitch will accept a value - note the equals sign $this->longOptions['my-secondswitch='] = 'myOtherHandler'; } // --my-switch -> myHandler() protected function myHandler() { } // --my-secondswitch foo -> myOtherHandler('foo') protected function myOtherHandler ($value) { } // You will also need this - the static keyword in the // PHPUnit_TextUI_Command will mean that it'll be // PHPUnit_TextUI_Command that gets instantiated, // not MyCommand public static function main($exit = true) { $command = new static; return $command->run($_SERVER['argv'], $exit); } } </code>