/** * Add a skipif section to the test case * */ public function addSkipif() { $this->testCase[] = "--SKIPIF--"; $this->testCase[] = "<?php"; if ($this->optionalSections->hasSkipifKey()) { $key = $this->optionalSections->getSkipifKey(); //test standard skipif sections if ($key == 'win') { $this->testCase = gtCodeSnippet::append('skipifwin', $this->testCase); } if ($key == 'notwin') { $this->testCase = gtCodeSnippet::append('skipifnotwin', $this->testCase); } if ($key == '64b') { $this->testCase = gtCodeSnippet::append('skipif64b', $this->testCase); } if ($key == 'not64b') { $this->testCase = gtCodeSnippet::append('skipifnot64b', $this->testCase); } } if ($this->optionalSections->hasSkipifExt()) { $ext = $this->optionalSections->getSkipifExt(); $this->testCase[] = "if (!extension_loaded('{$ext}')) die ('skip {$ext} extension not available in this build');"; } $this->testCase[] = "?>"; }
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()); }