Skip to content

Commit

Permalink
Also test --filter option with both configuration and argument
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed May 28, 2023
1 parent 6420191 commit 72c58ad
Show file tree
Hide file tree
Showing 9 changed files with 153 additions and 26 deletions.
21 changes: 0 additions & 21 deletions tests/end-to-end/cli/filter-class-isolation.phpt

This file was deleted.

27 changes: 27 additions & 0 deletions tests/end-to-end/cli/filter-class-match-argument.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
--TEST--
phpunit --filter FooTest tests/FooTest.php
--FILE--
<?php declare(strict_types=1);
$_SERVER['argv'][] = '--debug';
$_SERVER['argv'][] = '--do-not-cache-result';
$_SERVER['argv'][] = '--no-configuration';
$_SERVER['argv'][] = '--filter';
$_SERVER['argv'][] = 'FooTest';
$_SERVER['argv'][] = __DIR__ . '/../_files/groups/tests/FooTest.php';

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

Test 'PHPUnit\TestFixture\Groups\FooTest::testOne' started
Test 'PHPUnit\TestFixture\Groups\FooTest::testOne' ended
Test 'PHPUnit\TestFixture\Groups\FooTest::testTwo' started
Test 'PHPUnit\TestFixture\Groups\FooTest::testTwo' ended
Test 'PHPUnit\TestFixture\Groups\FooTest::testThree' started
Test 'PHPUnit\TestFixture\Groups\FooTest::testThree' ended


Time: %s, Memory: %s

OK (3 tests, 3 assertions)
27 changes: 27 additions & 0 deletions tests/end-to-end/cli/filter-class-match-configuration.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
--TEST--
phpunit --filter FooTest
--FILE--
<?php declare(strict_types=1);
$_SERVER['argv'][] = '--debug';
$_SERVER['argv'][] = '--do-not-cache-result';
$_SERVER['argv'][] = '--configuration';
$_SERVER['argv'][] = __DIR__ . '/../_files/groups';
$_SERVER['argv'][] = '--filter';
$_SERVER['argv'][] = 'FooTest';

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

Test 'PHPUnit\TestFixture\Groups\FooTest::testOne' started
Test 'PHPUnit\TestFixture\Groups\FooTest::testOne' ended
Test 'PHPUnit\TestFixture\Groups\FooTest::testTwo' started
Test 'PHPUnit\TestFixture\Groups\FooTest::testTwo' ended
Test 'PHPUnit\TestFixture\Groups\FooTest::testThree' started
Test 'PHPUnit\TestFixture\Groups\FooTest::testThree' ended


Time: %s, Memory: %s

OK (3 tests, 3 assertions)
17 changes: 17 additions & 0 deletions tests/end-to-end/cli/filter-class-nomatch-argument.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
--TEST--
phpunit --filter BarTest tests/FooTest.php
--FILE--
<?php declare(strict_types=1);
$_SERVER['argv'][] = '--debug';
$_SERVER['argv'][] = '--do-not-cache-result';
$_SERVER['argv'][] = '--no-configuration';
$_SERVER['argv'][] = '--filter';
$_SERVER['argv'][] = 'BarTest';
$_SERVER['argv'][] = __DIR__ . '/../_files/groups/tests/FooTest.php';

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

No tests executed!
17 changes: 17 additions & 0 deletions tests/end-to-end/cli/filter-class-nomatch-configuration.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
--TEST--
phpunit --filter BarTest
--FILE--
<?php declare(strict_types=1);
$_SERVER['argv'][] = '--debug';
$_SERVER['argv'][] = '--do-not-cache-result';
$_SERVER['argv'][] = '--configuration';
$_SERVER['argv'][] = __DIR__ . '/../_files/groups';
$_SERVER['argv'][] = '--filter';
$_SERVER['argv'][] = 'BarTest';

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

No tests executed!
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
--TEST--
phpunit --filter BankAccountTest ../../_files/BankAccountTest.php
phpunit --filter testOne tests/FooTest.php
--FILE--
<?php declare(strict_types=1);
$_SERVER['argv'][] = '--debug';
$_SERVER['argv'][] = '--do-not-cache-result';
$_SERVER['argv'][] = '--no-configuration';
$_SERVER['argv'][] = '--filter';
$_SERVER['argv'][] = 'BankAccountTest';
$_SERVER['argv'][] = __DIR__ . '/../../_files/BankAccountTest.php';
$_SERVER['argv'][] = 'testOne';
$_SERVER['argv'][] = __DIR__ . '/../_files/groups/tests/FooTest.php';

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

... 3 / 3 (100%)
Test 'PHPUnit\TestFixture\Groups\FooTest::testOne' started
Test 'PHPUnit\TestFixture\Groups\FooTest::testOne' ended


Time: %s, Memory: %s

OK (3 tests, 3 assertions)
OK (1 test, 1 assertion)
23 changes: 23 additions & 0 deletions tests/end-to-end/cli/filter-method-match-configuration.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
--TEST--
phpunit --filter testOne
--FILE--
<?php declare(strict_types=1);
$_SERVER['argv'][] = '--debug';
$_SERVER['argv'][] = '--do-not-cache-result';
$_SERVER['argv'][] = '--configuration';
$_SERVER['argv'][] = __DIR__ . '/../_files/groups';
$_SERVER['argv'][] = '--filter';
$_SERVER['argv'][] = 'testOne';

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

Test 'PHPUnit\TestFixture\Groups\FooTest::testOne' started
Test 'PHPUnit\TestFixture\Groups\FooTest::testOne' ended


Time: %s, Memory: %s

OK (1 test, 1 assertion)
17 changes: 17 additions & 0 deletions tests/end-to-end/cli/filter-method-nomatch-argument.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
--TEST--
phpunit --filter testFoo tests/FooTest.php
--FILE--
<?php declare(strict_types=1);
$_SERVER['argv'][] = '--debug';
$_SERVER['argv'][] = '--do-not-cache-result';
$_SERVER['argv'][] = '--no-configuration';
$_SERVER['argv'][] = '--filter';
$_SERVER['argv'][] = 'testFoo';
$_SERVER['argv'][] = __DIR__ . '/../_files/groups/tests/FooTest.php';

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

No tests executed!
17 changes: 17 additions & 0 deletions tests/end-to-end/cli/filter-method-nomatch-configuration.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
--TEST--
phpunit --filter testFoo
--FILE--
<?php declare(strict_types=1);
$_SERVER['argv'][] = '--debug';
$_SERVER['argv'][] = '--do-not-cache-result';
$_SERVER['argv'][] = '--configuration';
$_SERVER['argv'][] = __DIR__ . '/../_files/groups';
$_SERVER['argv'][] = '--filter';
$_SERVER['argv'][] = 'testFoo';

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

No tests executed!

0 comments on commit 72c58ad

Please sign in to comment.