Skip to content

Commit 72c58ad

Browse files
Also test --filter option with both configuration and argument
1 parent 6420191 commit 72c58ad

9 files changed

+153
-26
lines changed

tests/end-to-end/cli/filter-class-isolation.phpt

Lines changed: 0 additions & 21 deletions
This file was deleted.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
--TEST--
2+
phpunit --filter FooTest tests/FooTest.php
3+
--FILE--
4+
<?php declare(strict_types=1);
5+
$_SERVER['argv'][] = '--debug';
6+
$_SERVER['argv'][] = '--do-not-cache-result';
7+
$_SERVER['argv'][] = '--no-configuration';
8+
$_SERVER['argv'][] = '--filter';
9+
$_SERVER['argv'][] = 'FooTest';
10+
$_SERVER['argv'][] = __DIR__ . '/../_files/groups/tests/FooTest.php';
11+
12+
require_once __DIR__ . '/../../bootstrap.php';
13+
PHPUnit\TextUI\Command::main();
14+
--EXPECTF--
15+
PHPUnit %s by Sebastian Bergmann and contributors.
16+
17+
Test 'PHPUnit\TestFixture\Groups\FooTest::testOne' started
18+
Test 'PHPUnit\TestFixture\Groups\FooTest::testOne' ended
19+
Test 'PHPUnit\TestFixture\Groups\FooTest::testTwo' started
20+
Test 'PHPUnit\TestFixture\Groups\FooTest::testTwo' ended
21+
Test 'PHPUnit\TestFixture\Groups\FooTest::testThree' started
22+
Test 'PHPUnit\TestFixture\Groups\FooTest::testThree' ended
23+
24+
25+
Time: %s, Memory: %s
26+
27+
OK (3 tests, 3 assertions)
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
--TEST--
2+
phpunit --filter FooTest
3+
--FILE--
4+
<?php declare(strict_types=1);
5+
$_SERVER['argv'][] = '--debug';
6+
$_SERVER['argv'][] = '--do-not-cache-result';
7+
$_SERVER['argv'][] = '--configuration';
8+
$_SERVER['argv'][] = __DIR__ . '/../_files/groups';
9+
$_SERVER['argv'][] = '--filter';
10+
$_SERVER['argv'][] = 'FooTest';
11+
12+
require_once __DIR__ . '/../../bootstrap.php';
13+
PHPUnit\TextUI\Command::main();
14+
--EXPECTF--
15+
PHPUnit %s by Sebastian Bergmann and contributors.
16+
17+
Test 'PHPUnit\TestFixture\Groups\FooTest::testOne' started
18+
Test 'PHPUnit\TestFixture\Groups\FooTest::testOne' ended
19+
Test 'PHPUnit\TestFixture\Groups\FooTest::testTwo' started
20+
Test 'PHPUnit\TestFixture\Groups\FooTest::testTwo' ended
21+
Test 'PHPUnit\TestFixture\Groups\FooTest::testThree' started
22+
Test 'PHPUnit\TestFixture\Groups\FooTest::testThree' ended
23+
24+
25+
Time: %s, Memory: %s
26+
27+
OK (3 tests, 3 assertions)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
--TEST--
2+
phpunit --filter BarTest tests/FooTest.php
3+
--FILE--
4+
<?php declare(strict_types=1);
5+
$_SERVER['argv'][] = '--debug';
6+
$_SERVER['argv'][] = '--do-not-cache-result';
7+
$_SERVER['argv'][] = '--no-configuration';
8+
$_SERVER['argv'][] = '--filter';
9+
$_SERVER['argv'][] = 'BarTest';
10+
$_SERVER['argv'][] = __DIR__ . '/../_files/groups/tests/FooTest.php';
11+
12+
require_once __DIR__ . '/../../bootstrap.php';
13+
PHPUnit\TextUI\Command::main();
14+
--EXPECTF--
15+
PHPUnit %s by Sebastian Bergmann and contributors.
16+
17+
No tests executed!
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
--TEST--
2+
phpunit --filter BarTest
3+
--FILE--
4+
<?php declare(strict_types=1);
5+
$_SERVER['argv'][] = '--debug';
6+
$_SERVER['argv'][] = '--do-not-cache-result';
7+
$_SERVER['argv'][] = '--configuration';
8+
$_SERVER['argv'][] = __DIR__ . '/../_files/groups';
9+
$_SERVER['argv'][] = '--filter';
10+
$_SERVER['argv'][] = 'BarTest';
11+
12+
require_once __DIR__ . '/../../bootstrap.php';
13+
PHPUnit\TextUI\Command::main();
14+
--EXPECTF--
15+
PHPUnit %s by Sebastian Bergmann and contributors.
16+
17+
No tests executed!
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
11
--TEST--
2-
phpunit --filter BankAccountTest ../../_files/BankAccountTest.php
2+
phpunit --filter testOne tests/FooTest.php
33
--FILE--
44
<?php declare(strict_types=1);
5+
$_SERVER['argv'][] = '--debug';
56
$_SERVER['argv'][] = '--do-not-cache-result';
67
$_SERVER['argv'][] = '--no-configuration';
78
$_SERVER['argv'][] = '--filter';
8-
$_SERVER['argv'][] = 'BankAccountTest';
9-
$_SERVER['argv'][] = __DIR__ . '/../../_files/BankAccountTest.php';
9+
$_SERVER['argv'][] = 'testOne';
10+
$_SERVER['argv'][] = __DIR__ . '/../_files/groups/tests/FooTest.php';
1011

1112
require_once __DIR__ . '/../../bootstrap.php';
1213
PHPUnit\TextUI\Command::main();
1314
--EXPECTF--
1415
PHPUnit %s by Sebastian Bergmann and contributors.
1516

16-
... 3 / 3 (100%)
17+
Test 'PHPUnit\TestFixture\Groups\FooTest::testOne' started
18+
Test 'PHPUnit\TestFixture\Groups\FooTest::testOne' ended
19+
1720

1821
Time: %s, Memory: %s
1922

20-
OK (3 tests, 3 assertions)
23+
OK (1 test, 1 assertion)
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
--TEST--
2+
phpunit --filter testOne
3+
--FILE--
4+
<?php declare(strict_types=1);
5+
$_SERVER['argv'][] = '--debug';
6+
$_SERVER['argv'][] = '--do-not-cache-result';
7+
$_SERVER['argv'][] = '--configuration';
8+
$_SERVER['argv'][] = __DIR__ . '/../_files/groups';
9+
$_SERVER['argv'][] = '--filter';
10+
$_SERVER['argv'][] = 'testOne';
11+
12+
require_once __DIR__ . '/../../bootstrap.php';
13+
PHPUnit\TextUI\Command::main();
14+
--EXPECTF--
15+
PHPUnit %s by Sebastian Bergmann and contributors.
16+
17+
Test 'PHPUnit\TestFixture\Groups\FooTest::testOne' started
18+
Test 'PHPUnit\TestFixture\Groups\FooTest::testOne' ended
19+
20+
21+
Time: %s, Memory: %s
22+
23+
OK (1 test, 1 assertion)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
--TEST--
2+
phpunit --filter testFoo tests/FooTest.php
3+
--FILE--
4+
<?php declare(strict_types=1);
5+
$_SERVER['argv'][] = '--debug';
6+
$_SERVER['argv'][] = '--do-not-cache-result';
7+
$_SERVER['argv'][] = '--no-configuration';
8+
$_SERVER['argv'][] = '--filter';
9+
$_SERVER['argv'][] = 'testFoo';
10+
$_SERVER['argv'][] = __DIR__ . '/../_files/groups/tests/FooTest.php';
11+
12+
require_once __DIR__ . '/../../bootstrap.php';
13+
PHPUnit\TextUI\Command::main();
14+
--EXPECTF--
15+
PHPUnit %s by Sebastian Bergmann and contributors.
16+
17+
No tests executed!
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
--TEST--
2+
phpunit --filter testFoo
3+
--FILE--
4+
<?php declare(strict_types=1);
5+
$_SERVER['argv'][] = '--debug';
6+
$_SERVER['argv'][] = '--do-not-cache-result';
7+
$_SERVER['argv'][] = '--configuration';
8+
$_SERVER['argv'][] = __DIR__ . '/../_files/groups';
9+
$_SERVER['argv'][] = '--filter';
10+
$_SERVER['argv'][] = 'testFoo';
11+
12+
require_once __DIR__ . '/../../bootstrap.php';
13+
PHPUnit\TextUI\Command::main();
14+
--EXPECTF--
15+
PHPUnit %s by Sebastian Bergmann and contributors.
16+
17+
No tests executed!

0 commit comments

Comments
 (0)