1<?php
2require_once 'PHPUnit/Framework.php';
3require_once dirname(__FILE__) . '/../src/gtAutoload.php';
4
5
6class gtOptionalSectionsTest extends PHPUnit_Framework_TestCase
7{
8  public function testBasic() {
9
10    $clo = new gtCommandLineOptions();
11    $clo->parse(array('generate-phpt.php', '-s', 'skipif:ini'));
12
13    $opt = new gtOptionalSections();
14    $opt->setOptions($clo);
15    $a = $opt->getOptions();
16    $this->assertEquals(true, $a['skipif']);
17    $this->assertEquals(true, $a['ini']);
18    $this->assertEquals(false, $a['clean']);
19  }
20
21  /**
22   * @expectedException RuntimeException
23   */
24  public function testException() {
25    $clo = new gtCommandLineOptions();
26    $clo->parse(array('generate-phpt.php', '-s', 'blah'));
27    $opt = new gtOptionalSections();
28    $opt->setOptions($clo);
29  }
30
31  public function testSkip() {
32    $clo = new gtCommandLineOptions();
33    $clo->parse(array('generate-phpt.php', '-s', 'skipif', '-x', 'standard'));
34    $opt = new gtOptionalSections();
35    $opt->setOptions($clo);
36
37    $opt = new gtOptionalSections();
38    $opt->setOptions($clo);
39
40    $this->assertEquals('standard', $opt->getSkipifExt() );
41
42  }
43
44  public function testSkipKey() {
45    $clo = new gtCommandLineOptions();
46    $clo->parse(array('generate-phpt.php', '-s', 'skipif', '-k', 'win'));
47    $opt = new gtOptionalSections();
48    $opt->setOptions($clo);
49
50    $opt = new gtOptionalSections();
51    $opt->setOptions($clo);
52
53    $this->assertEquals('win', $opt->getSkipifKey() );
54
55  }
56
57}
58?>
59