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());
 }
Example #2
0
 /**
  * Add an EXPECTF section
  *
  */
 public function addExpectf()
 {
     $this->testCase[] = "--EXPECTF--";
     if ($this->optionalSections->hasDone()) {
         $this->testCase[] = '===DONE===';
     }
 }
Example #3
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";
    die;