Test Failed
Push — graphviz-refactoring ( 3f1b14 )
by Luis
02:18
created

PhUmlHelpOptionTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 46
rs 10
c 0
b 0
f 0
wmc 3
1
<?php
2
/**
3
 * PHP version 7.1
4
 *
5
 * This source file is subject to the license that is bundled with this package in the file LICENSE.
6
 */
7
8
use PHPUnit\Framework\TestCase;
9
10
class PhUmlHelpOptionTest extends TestCase
11
{
12
    private $help = <<<HELP
13
phUML Version 0.2 (Jakob Westhoff <[email protected]>)
14
Usage: phuml [-h|-l] [OPTIONS] <DIRECTORY> <PROCESSOR> [PROCESSOR OPTIONS] ... <OUTFILE>
15
16
Commands:
17
    -h      Display this help text
18
    -l      List all available processors
19
20
Options: 
21
    -r      Scan given directorie recursively
22
23
Example:
24
    phuml -r ./ -graphviz -createAssociations false -neato out.png
25
26
    This example will scan the current directory recursively for php files.
27
    Send them to the "dot" processor which will process them with the option
28
    "createAssociations" set to false. After that it will be send to the neato
29
    processor and saved to the file out.png
30
31
32
HELP;
33
34
    /** @test */
35
    function it_displays_help_if_option_h_is_provided()
36
    {
37
        passthru(sprintf('php %s -h', __DIR__ . '/../../src/app/phuml'));
38
39
        $this->expectOutputString($this->help);
40
    }
41
42
    /** @test */
43
    function it_displays_help_if_no_arguments_are_provided()
44
    {
45
        passthru(sprintf('php %s', __DIR__ . '/../../src/app/phuml'));
46
47
        $this->expectOutputString($this->help);
48
    }
49
50
    /** @test */
51
    function it_displays_help_if_an_invalid_directory_is_provided()
52
    {
53
        passthru(sprintf('php %s unknown_directory', __DIR__ . '/../../src/app/phuml'));
54
55
        $this->expectOutputString($this->help);
56
    }
57
}
58