| @@ 5-42 (lines=38) @@ | ||
| 2 | ||
| 3 | namespace Spatie\PhpUnitWatcher\Screens; |
|
| 4 | ||
| 5 | class FilterFileName extends Screen |
|
| 6 | { |
|
| 7 | public function draw() |
|
| 8 | { |
|
| 9 | $this->terminal |
|
| 10 | ->comment('Pattern mode usage') |
|
| 11 | ->write('Type a pattern and press Enter to only run tests in the giving path or file.') |
|
| 12 | ->write('Press Enter with an empty pattern to execute all tests in all files.') |
|
| 13 | ->emptyLine() |
|
| 14 | ->comment('Start typing to filter by a test name.') |
|
| 15 | ->prompt('pattern > '); |
|
| 16 | ||
| 17 | return $this; |
|
| 18 | } |
|
| 19 | ||
| 20 | public function registerListeners() |
|
| 21 | { |
|
| 22 | $this->terminal->on('data', function ($line) { |
|
| 23 | if ($line == '') { |
|
| 24 | $this->terminal->goBack(); |
|
| 25 | ||
| 26 | return; |
|
| 27 | } |
|
| 28 | ||
| 29 | $phpunitArguments = "{$line}"; |
|
| 30 | ||
| 31 | $phpunitScreen = $this->terminal->getPreviousScreen(); |
|
| 32 | ||
| 33 | $options = $phpunitScreen->options; |
|
| 34 | ||
| 35 | $options['phpunit']['arguments'] = $phpunitArguments; |
|
| 36 | ||
| 37 | $this->terminal->displayScreen(new Phpunit($options)); |
|
| 38 | }); |
|
| 39 | ||
| 40 | return $this; |
|
| 41 | } |
|
| 42 | } |
|
| 43 | ||
| @@ 5-42 (lines=38) @@ | ||
| 2 | ||
| 3 | namespace Spatie\PhpUnitWatcher\Screens; |
|
| 4 | ||
| 5 | class FilterTestName extends Screen |
|
| 6 | { |
|
| 7 | public function draw() |
|
| 8 | { |
|
| 9 | $this->terminal |
|
| 10 | ->comment('Pattern mode usage') |
|
| 11 | ->write('Type a pattern and press Enter to apply pattern to all tests.') |
|
| 12 | ->write('Press Enter with an empty pattern to keep the current pattern.') |
|
| 13 | ->emptyLine() |
|
| 14 | ->comment('Start typing to filter by a test name.') |
|
| 15 | ->prompt('pattern > '); |
|
| 16 | ||
| 17 | return $this; |
|
| 18 | } |
|
| 19 | ||
| 20 | public function registerListeners() |
|
| 21 | { |
|
| 22 | $this->terminal->on('data', function ($line) { |
|
| 23 | if ($line == '') { |
|
| 24 | $this->terminal->goBack(); |
|
| 25 | ||
| 26 | return; |
|
| 27 | } |
|
| 28 | ||
| 29 | $phpunitArguments = "--filter={$line}"; |
|
| 30 | ||
| 31 | $phpunitScreen = $this->terminal->getPreviousScreen(); |
|
| 32 | ||
| 33 | $options = $phpunitScreen->options; |
|
| 34 | ||
| 35 | $options['phpunit']['arguments'] = $phpunitArguments; |
|
| 36 | ||
| 37 | $this->terminal->displayScreen(new Phpunit($options)); |
|
| 38 | }); |
|
| 39 | ||
| 40 | return $this; |
|
| 41 | } |
|
| 42 | } |
|
| 43 | ||
| @@ 5-42 (lines=38) @@ | ||
| 2 | ||
| 3 | namespace Spatie\PhpUnitWatcher\Screens; |
|
| 4 | ||
| 5 | class FilterGroupName extends Screen |
|
| 6 | { |
|
| 7 | public function draw() |
|
| 8 | { |
|
| 9 | $this->terminal |
|
| 10 | ->comment('Pattern mode usage') |
|
| 11 | ->write('Type a pattern and press Enter to only run tests from a specific PHPUnit group.') |
|
| 12 | ->write('Press Enter with an empty pattern to execute all tests in all files.') |
|
| 13 | ->emptyLine() |
|
| 14 | ->comment('Start typing to filter by a test name.') |
|
| 15 | ->prompt('pattern > '); |
|
| 16 | ||
| 17 | return $this; |
|
| 18 | } |
|
| 19 | ||
| 20 | public function registerListeners() |
|
| 21 | { |
|
| 22 | $this->terminal->on('data', function ($line) { |
|
| 23 | if ($line == '') { |
|
| 24 | $this->terminal->goBack(); |
|
| 25 | ||
| 26 | return; |
|
| 27 | } |
|
| 28 | ||
| 29 | $phpunitArguments = "--group={$line}"; |
|
| 30 | ||
| 31 | $phpunitScreen = $this->terminal->getPreviousScreen(); |
|
| 32 | ||
| 33 | $options = $phpunitScreen->options; |
|
| 34 | ||
| 35 | $options['phpunit']['arguments'] = $phpunitArguments; |
|
| 36 | ||
| 37 | $this->terminal->displayScreen(new Phpunit($options)); |
|
| 38 | }); |
|
| 39 | ||
| 40 | return $this; |
|
| 41 | } |
|
| 42 | } |
|
| 43 | ||
| @@ 5-42 (lines=38) @@ | ||
| 2 | ||
| 3 | namespace Spatie\PhpUnitWatcher\Screens; |
|
| 4 | ||
| 5 | class FilterTestSuiteName extends Screen |
|
| 6 | { |
|
| 7 | public function draw() |
|
| 8 | { |
|
| 9 | $this->terminal |
|
| 10 | ->comment('Pattern mode usage') |
|
| 11 | ->write('Type a pattern and press Enter to only run tests from a specific PHPUnit test suite.') |
|
| 12 | ->write('Press Enter with an empty pattern to execute all tests in all files.') |
|
| 13 | ->emptyLine() |
|
| 14 | ->comment('Start typing to filter by a test suite name.') |
|
| 15 | ->prompt('pattern > '); |
|
| 16 | ||
| 17 | return $this; |
|
| 18 | } |
|
| 19 | ||
| 20 | public function registerListeners() |
|
| 21 | { |
|
| 22 | $this->terminal->on('data', function ($line) { |
|
| 23 | if ($line == '') { |
|
| 24 | $this->terminal->goBack(); |
|
| 25 | ||
| 26 | return; |
|
| 27 | } |
|
| 28 | ||
| 29 | $phpunitArguments = "--testsuite={$line}"; |
|
| 30 | ||
| 31 | $phpunitScreen = $this->terminal->getPreviousScreen(); |
|
| 32 | ||
| 33 | $options = $phpunitScreen->options; |
|
| 34 | ||
| 35 | $options['phpunit']['arguments'] = $phpunitArguments; |
|
| 36 | ||
| 37 | $this->terminal->displayScreen(new Phpunit($options)); |
|
| 38 | }); |
|
| 39 | ||
| 40 | return $this; |
|
| 41 | } |
|
| 42 | } |
|
| 43 | ||