aboutsummaryrefslogtreecommitdiff
path: root/vendors/simpletest/test/command_line_test.php
blob: 5baabff33c6794916815ed8ade8265677e1aa76b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
require_once(dirname(__FILE__) . '/../autorun.php');
require_once(dirname(__FILE__) . '/../default_reporter.php');

class TestOfCommandLineParsing extends UnitTestCase {
    
    function testDefaultsToEmptyStringToMeanNullToTheSelectiveReporter() {
        $parser = new SimpleCommandLineParser(array());
        $this->assertIdentical($parser->getTest(), '');
        $this->assertIdentical($parser->getTestCase(), '');
    }
    
    function testNotXmlByDefault() {
        $parser = new SimpleCommandLineParser(array());
        $this->assertFalse($parser->isXml());
    }
    
    function testCanDetectRequestForXml() {
        $parser = new SimpleCommandLineParser(array('--xml'));
        $this->assertTrue($parser->isXml());
    }
    
    function testCanReadAssignmentSyntax() {
        $parser = new SimpleCommandLineParser(array('--test=myTest'));
        $this->assertEqual($parser->getTest(), 'myTest');
    }
    
    function testCanReadFollowOnSyntax() {
        $parser = new SimpleCommandLineParser(array('--test', 'myTest'));
        $this->assertEqual($parser->getTest(), 'myTest');
    }
    
    function testCanReadShortForms() {
        $parser = new SimpleCommandLineParser(array('-t', 'myTest', '-c', 'MyClass', '-x'));
        $this->assertEqual($parser->getTest(), 'myTest');
        $this->assertEqual($parser->getTestCase(), 'MyClass');
        $this->assertTrue($parser->isXml());
    }
}
?>