@@ 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 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 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 |
@@ 5-39 (lines=35) @@ | ||
2 | ||
3 | namespace Spatie\PhpUnitWatcher\Screens; |
|
4 | ||
5 | class RandomSeed extends Screen |
|
6 | { |
|
7 | public function draw() |
|
8 | { |
|
9 | $this->terminal |
|
10 | ->comment('Random seed usage') |
|
11 | ->write('Type a seed and press Enter to run tests in random order but with a specific seed.') |
|
12 | ->write('Press Enter with an empty pattern to execute all tests in random order.') |
|
13 | ->emptyLine() |
|
14 | ->comment('Start typing to add a random seed') |
|
15 | ->prompt('seed > '); |
|
16 | ||
17 | return $this; |
|
18 | } |
|
19 | ||
20 | public function registerListeners() |
|
21 | { |
|
22 | $this->terminal->on('data', function ($line) { |
|
23 | $phpunitArguments = '--order-by=random'; |
|
24 | if ($line !== '') { |
|
25 | $phpunitArguments .= " --random-order-seed={$line}"; |
|
26 | } |
|
27 | ||
28 | $phpunitScreen = $this->terminal->getPreviousScreen(); |
|
29 | ||
30 | $options = $phpunitScreen->options; |
|
31 | ||
32 | $options['phpunit']['arguments'] = $phpunitArguments; |
|
33 | ||
34 | $this->terminal->displayScreen(new Phpunit($options)); |
|
35 | }); |
|
36 | ||
37 | return $this; |
|
38 | } |
|
39 | } |
|
40 |