| Total Complexity | 3 | 
| Total Lines | 46 | 
| Duplicated Lines | 0 % | 
| Changes | 0 | ||
| 1 | <?php | ||
| 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 | } | ||
| 58 |