Skip to content

Commit

Permalink
fixed calling with directory leads to deprecation warning
Browse files Browse the repository at this point in the history
  • Loading branch information
realFlowControl authored and sebastianbergmann committed Dec 5, 2019
1 parent 5cf2f25 commit d38c327
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/TextUI/Command.php
Expand Up @@ -781,7 +781,8 @@ protected function handleArguments(array $argv): void

if (isset($this->options[1][0]) &&
\substr($this->options[1][0], -5, 5) !== '.phpt' &&
\substr($this->options[1][0], -4, 4) !== '.php'
\substr($this->options[1][0], -4, 4) !== '.php' &&
\substr($this->options[1][0], -1, 1) !== '/'
) {
print 'Warning: Calling PHPUnit with a class name is deprecated and will be removed in PHPUnit 9.' . \PHP_EOL;
}
Expand Down
4 changes: 3 additions & 1 deletion tests/end-to-end/abstract-test-class.phpt
Expand Up @@ -3,11 +3,13 @@ phpunit ../../_files/AbstractTest.php
--FILE--
<?php declare(strict_types=1);
$_SERVER['argv'][1] = '--no-configuration';
$_SERVER['argv'][2] = __DIR__ . '/../_files/AbstractTest.php';
$_SERVER['argv'][2] = 'AbstractTest';
$_SERVER['argv'][3] = __DIR__ . '/../_files/AbstractTest.php';

require __DIR__ . '/../bootstrap.php';
PHPUnit\TextUI\Command::main();
--EXPECTF--
Warning: Calling PHPUnit with a class name is deprecated and will be removed in PHPUnit 9.
PHPUnit %s by Sebastian Bergmann and contributors.

W 1 / 1 (100%)
Expand Down
1 change: 1 addition & 0 deletions tests/end-to-end/regression/GitHub/3904.phpt
Expand Up @@ -10,6 +10,7 @@ require __DIR__ . '/../../../bootstrap.php';

PHPUnit\TextUI\Command::main();
--EXPECTF--
Warning: Calling PHPUnit with a class name is deprecated and will be removed in PHPUnit 9.
PHPUnit %s by Sebastian Bergmann and contributors.

. 1 / 1 (100%)
Expand Down
1 change: 1 addition & 0 deletions tests/end-to-end/regression/GitHub/3904_2.phpt
Expand Up @@ -15,4 +15,5 @@ try {
}
?>
--EXPECTF--
Warning: Calling PHPUnit with a class name is deprecated and will be removed in PHPUnit 9.
Class 'Issue3904' could not be found in '%s'.

0 comments on commit d38c327

Please sign in to comment.