1<?php
2require_once 'PHPUnit/Framework.php';
3require_once dirname(__FILE__) . '/../src/gtAutoload.php';
4
5
6class gtIsValidMethodTest extends PHPUnit_Framework_TestCase {
7
8  public function testValid() {
9
10    $clo = new gtCommandLineOptions();
11    $clo->parse(array('generate-phpt.php', '-c', 'DOMDocument', '-m', 'createAttribute'));
12    $ch = new gtIsValidMethod();
13    $this->assertTrue($ch->check($clo));
14  }
15
16  public function testNotValid() {
17
18    $clo = new gtCommandLineOptions();
19    $clo->parse(array('generate-phpt.php', '-c', 'DOMDocument', '-m', 'blah'));
20    $ch = new gtIsValidMethod();
21    $this->assertFalse($ch->check($clo));
22  }
23
24  public function testNotGiven() {
25
26    $clo = new gtCommandLineOptions();
27    $clo->parse(array('generate-phpt.php','-b'));
28    $ch = new gtIsValidMethod();
29    $this->assertTrue($ch->check($clo));
30  }
31
32  public function testMessage() {
33
34    $clo = new gtCommandLineOptions();
35    $clo->parse(array('generate-phpt.php', '-c', 'blah'));
36    $ch = new gtIsvalidMethod();
37    $this->assertEquals($ch->getMessage(), gtText::get('unknownMethod'));
38  }
39}
40?>