Skip to content

Commit 2cf9ec8

Browse files
authored
Merge pull request #5950 from wp-cli/fix/unit-tests
Fix unit tests
2 parents 6d78633 + 1a8f104 commit 2cf9ec8

18 files changed

+48
-42
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ phpunit.xml
1111
phpcs.xml
1212
.phpcs.xml
1313
composer.lock
14+
.phpunit.result.cache
15+
.phpunit.cache

phpcs.xml.dist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,12 @@
9898

9999
<!-- These are all to do with file-system related tests. Just ignore them. -->
100100
<rule ref="WordPress.WP.CapitalPDangit">
101-
<exclude-pattern>*/tests/test-(extractor|utils)\.php$</exclude-pattern>
101+
<exclude-pattern>*/tests/(Extractor|Utils)Test\.php$</exclude-pattern>
102102
</rule>
103103

104104
<!-- Allow for select data providers for tests to use single-line associative arrays. -->
105105
<rule ref="WordPress.Arrays.ArrayDeclarationSpacing.AssociativeArrayFound">
106-
<exclude-pattern>*/tests/test-(process|utils)\.php$</exclude-pattern>
106+
<exclude-pattern>*/tests/(Process|Utils)Test\.php$</exclude-pattern>
107107
</rule>
108108

109109
<!-- This is a procedural stand-alone file that is never loaded in a WordPress context,

phpunit.xml.dist

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2-
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.8/phpunit.xsd"
3-
bootstrap="tests/bootstrap.php"
4-
colors="always"
5-
beStrictAboutTestsThatDoNotTestAnything="true"
6-
beStrictAboutOutputDuringTests="true"
7-
beStrictAboutTestSize="true"
8-
beStrictAboutChangesToGlobalState="false">
9-
<testsuites>
10-
<testsuite>
11-
<directory prefix="spec-" suffix=".php">tests/</directory>
12-
<directory prefix="test-" suffix=".php">tests/</directory>
13-
<directory suffix="Test.php">tests/</directory>
14-
</testsuite>
15-
</testsuites>
2+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/4.8/phpunit.xsd"
3+
bootstrap="tests/bootstrap.php"
4+
backupGlobals="false"
5+
beStrictAboutCoversAnnotation="true"
6+
beStrictAboutOutputDuringTests="true"
7+
beStrictAboutTestsThatDoNotTestAnything="true"
8+
beStrictAboutTodoAnnotatedTests="true"
9+
colors="true"
10+
verbose="true">
11+
<testsuite name="wp-cli/wp-cli tests">
12+
<directory suffix="Test.php">tests</directory>
13+
</testsuite>
14+
15+
<filter>
16+
<whitelist processUncoveredFilesFromWhitelist="true">
17+
<directory suffix=".php">src</directory>
18+
</whitelist>
19+
</filter>
1620
</phpunit>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use WP_CLI\SynopsisValidator;
44
use WP_CLI\Tests\TestCase;
55

6-
class ArgValidationTests extends TestCase {
6+
class ArgValidationTest extends TestCase {
77

88
public function testMissingPositional() {
99
$validator = new SynopsisValidator( '<foo> <bar> [<baz>]' );
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
require_once dirname( __DIR__ ) . '/php/class-wp-cli-command.php';
66

7-
class CommandFactoryTests extends TestCase {
7+
class CommandFactoryTest extends TestCase {
88

99
/**
1010
* @dataProvider dataProviderExtractLastDocComment
@@ -48,7 +48,7 @@ public function testExtractLastDocCommentWin( $content, $expected ) {
4848
putenv( false === $is_windows ? 'WP_CLI_TEST_IS_WINDOWS' : "WP_CLI_TEST_IS_WINDOWS=$is_windows" );
4949
}
5050

51-
public function dataProviderExtractLastDocComment() {
51+
public static function dataProviderExtractLastDocComment() {
5252
return [
5353
[ '', false ],
5454
[ '*/', false ],
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use WP_CLI\DocParser;
44
use WP_CLI\Tests\TestCase;
55

6-
class DocParserTests extends TestCase {
6+
class DocParserTest extends TestCase {
77

88
public function test_empty() {
99
$doc = new DocParser( '' );
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use WP_CLI\Tests\TestCase;
66
use WP_CLI\Utils;
77

8-
class Extractor_Test extends TestCase {
8+
class ExtractorTest extends TestCase {
99

1010
public static $copy_overwrite_files_prefix = 'wp-cli-test-utils-copy-overwrite-files-';
1111

File renamed without changes.

0 commit comments

Comments
 (0)