public function testMessage()
 {
     $clo = new gtCommandLineOptions();
     $clo->parse(array('generate-phpt.php', '-c', 'blah'));
     $ch = new gtIsvalidMethod();
     $this->assertEquals($ch->getMessage(), gtText::get('unknownMethod'));
 }
 public function testMessage()
 {
     $clo = new gtCommandLineOptions();
     $clo->parse(array('generate-phpt.php', '-c', 'blah'));
     $ch = new gtIsSpecifiedFunctionOrMethod();
     $this->assertEquals($ch->getMessage(), gtText::get('functionOrMethodNotSpecified'));
 }
 public function testSkipKey()
 {
     $clo = new gtCommandLineOptions();
     $clo->parse(array('generate-phpt.php', '-s', 'skipif', '-k', 'win'));
     $opt = new gtOptionalSections();
     $opt->setOptions($clo);
     $opt = new gtOptionalSections();
     $opt->setOptions($clo);
     $this->assertEquals('win', $opt->getSkipifKey());
 }
Beispiel #4
0
/**
 * Main code for test case generation
 */
require_once dirname(__FILE__) . '/gtAutoload.php';
//Version check. Will not run on less than PHP53;
list($major, $minor, $bug) = explode(".", phpversion(), 3);
if ($major == 5) {
    if ($minor < 3) {
        die("Sorry, you need PHP version 5.3 or greater to run this.\n");
    }
}
if ($major < 5) {
    die("Seriously, you need to upgrade you PHP level\n");
}
$options = new gtCommandLineOptions();
$optionalSections = new gtOptionalSections();
try {
    $options->parse($argv);
} catch (exception $e) {
    echo $e->getMessage() . "\n";
    die;
}
if ($options->hasOption('h')) {
    die(gtText::get('help'));
}
try {
    $preConditions = new gtPreConditionList();
    $preConditions->check($options);
} catch (exception $e) {
    echo $e->getMessage() . "\n";
 /**
  * @expectedException RuntimeException
  */
 public function testMissingArgument()
 {
     $clo = new gtCommandLineOptions();
     $clo->parse(array('generate-phpt.php', '-f'));
 }