forked from wp-cli/wp-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request wp-cli#5950 from wp-cli/fix/unit-tests
Fix unit tests
- Loading branch information
Showing
18 changed files
with
48 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,5 @@ phpunit.xml | |
phpcs.xml | ||
.phpcs.xml | ||
composer.lock | ||
.phpunit.result.cache | ||
.phpunit.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,20 @@ | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.8/phpunit.xsd" | ||
bootstrap="tests/bootstrap.php" | ||
colors="always" | ||
beStrictAboutTestsThatDoNotTestAnything="true" | ||
beStrictAboutOutputDuringTests="true" | ||
beStrictAboutTestSize="true" | ||
beStrictAboutChangesToGlobalState="false"> | ||
<testsuites> | ||
<testsuite> | ||
<directory prefix="spec-" suffix=".php">tests/</directory> | ||
<directory prefix="test-" suffix=".php">tests/</directory> | ||
<directory suffix="Test.php">tests/</directory> | ||
</testsuite> | ||
</testsuites> | ||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/4.8/phpunit.xsd" | ||
bootstrap="tests/bootstrap.php" | ||
backupGlobals="false" | ||
beStrictAboutCoversAnnotation="true" | ||
beStrictAboutOutputDuringTests="true" | ||
beStrictAboutTestsThatDoNotTestAnything="true" | ||
beStrictAboutTodoAnnotatedTests="true" | ||
colors="true" | ||
verbose="true"> | ||
<testsuite name="wp-cli/wp-cli tests"> | ||
<directory suffix="Test.php">tests</directory> | ||
</testsuite> | ||
|
||
<filter> | ||
<whitelist processUncoveredFilesFromWhitelist="true"> | ||
<directory suffix=".php">src</directory> | ||
</whitelist> | ||
</filter> | ||
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -272,7 +272,7 @@ public function testParseSSHUrl() { | |
$this->assertEquals( null, Utils\parse_ssh_url( $testcase, PHP_URL_PATH ) ); | ||
} | ||
|
||
public function parseStrToArgvData() { | ||
public static function parseStrToArgvData() { | ||
return [ | ||
[ [], '' ], | ||
[ [ 'option', 'get', 'home' ], 'option get home' ], | ||
|
@@ -414,7 +414,7 @@ public function testNormalizePath( $path, $expected ) { | |
$this->assertEquals( $expected, Utils\normalize_path( $path ) ); | ||
} | ||
|
||
public function dataNormalizePath() { | ||
public static function dataNormalizePath() { | ||
return [ | ||
[ '', '' ], | ||
// Windows paths. | ||
|
@@ -476,7 +476,7 @@ public function testHttpRequestBadAddress() { | |
WP_CLI::set_logger( $prev_logger ); | ||
} | ||
|
||
public function dataHttpRequestBadCAcert() { | ||
public static function dataHttpRequestBadCAcert() { | ||
return [ | ||
'default request' => [ | ||
[], | ||
|
@@ -552,7 +552,7 @@ public function testHttpRequestVerify( $expected, $options ) { | |
$this->assertEquals( $expected, $transport_spy->requests[0]['options']['verify'] ); | ||
} | ||
|
||
public function dataHttpRequestVerify() { | ||
public static function dataHttpRequestVerify() { | ||
return [ | ||
'not passed' => [ | ||
true, | ||
|
@@ -589,7 +589,7 @@ public function testPastTenseVerb( $verb, $expected ) { | |
$this->assertSame( $expected, Utils\past_tense_verb( $verb ) ); | ||
} | ||
|
||
public function dataPastTenseVerb() { | ||
public static function dataPastTenseVerb() { | ||
return [ | ||
// Known to be used by commands. | ||
[ 'activate', 'activated' ], | ||
|
@@ -645,7 +645,7 @@ public function testExpandGlobs( $path, $expected ) { | |
putenv( false === $expand_globs_no_glob_brace ? 'WP_CLI_TEST_EXPAND_GLOBS_NO_GLOB_BRACE' : "WP_CLI_TEST_EXPAND_GLOBS_NO_GLOB_BRACE=$expand_globs_no_glob_brace" ); | ||
} | ||
|
||
public function dataExpandGlobs() { | ||
public static function dataExpandGlobs() { | ||
// Files in "data/expand_globs": foo.ab1, foo.ab2, foo.efg1, foo.efg2, bar.ab1, bar.ab2, baz.ab1, baz.ac1, baz.efg2. | ||
return [ | ||
[ 'foo.ab1', [ 'foo.ab1' ] ], | ||
|
@@ -695,7 +695,7 @@ public function testReportBatchOperationResults( $stdout, $stderr, $noun, $verb, | |
WP_CLI::set_logger( $prev_logger ); | ||
} | ||
|
||
public function dataReportBatchOperationResults() { | ||
public static function dataReportBatchOperationResults() { | ||
return [ | ||
[ "Success: Noun already verbed.\n", '', 'noun', 'verb', 1, 0, 0, null ], | ||
[ "Success: Verbed 1 of 1 nouns.\n", '', 'noun', 'verb', 1, 1, 0, null ], | ||
|
@@ -754,7 +754,7 @@ public function testProcOpenCompatWinEnv( $cmd, $env, $expected_cmd, $expected_e | |
putenv( false === $env_is_windows ? 'WP_CLI_TEST_IS_WINDOWS' : "WP_CLI_TEST_IS_WINDOWS=$env_is_windows" ); | ||
} | ||
|
||
public function dataProcOpenCompatWinEnv() { | ||
public static function dataProcOpenCompatWinEnv() { | ||
return [ | ||
[ 'echo', [], 'echo', [] ], | ||
[ 'ENV=blah echo', [], 'echo', [ 'ENV' => 'blah' ] ], | ||
|
@@ -806,7 +806,7 @@ public function testIsJson( $argument, $ignore_scalars, $expected ) { | |
$this->assertEquals( $expected, Utils\is_json( $argument, $ignore_scalars ) ); | ||
} | ||
|
||
public function dataIsJson() { | ||
public static function dataIsJson() { | ||
return [ | ||
[ '42', true, false ], | ||
[ '42', false, true ], | ||
|
@@ -830,7 +830,7 @@ public function testParseShellArray( $assoc_args, $array_arguments, $expected ) | |
$this->assertEquals( $expected, Utils\parse_shell_arrays( $assoc_args, $array_arguments ) ); | ||
} | ||
|
||
public function dataParseShellArray() { | ||
public static function dataParseShellArray() { | ||
return [ | ||
[ [ 'alpha' => '{"key":"value"}' ], [], [ 'alpha' => '{"key":"value"}' ] ], | ||
[ [ 'alpha' => '{"key":"value"}' ], [ 'alpha' ], [ 'alpha' => [ 'key' => 'value' ] ] ], | ||
|
@@ -845,7 +845,7 @@ public function testPluralize( $singular, $count, $expected ) { | |
$this->assertEquals( $expected, Utils\pluralize( $singular, $count ) ); | ||
} | ||
|
||
public function dataPluralize() { | ||
public static function dataPluralize() { | ||
return [ | ||
[ 'string', 1, 'string' ], | ||
[ 'string', 2, 'strings' ], | ||
|
@@ -860,7 +860,7 @@ public function testPickFields( $data, $fields, $expected ) { | |
$this->assertEquals( $expected, Utils\pick_fields( $data, $fields ) ); | ||
} | ||
|
||
public function dataPickFields() { | ||
public static function dataPickFields() { | ||
return [ | ||
[ [ 'keyA' => 'valA', 'keyB' => 'valB', 'keyC' => 'valC' ], [ 'keyB' ], [ 'keyB' => 'valB' ] ], | ||
[ [ '1' => 'valA', '2' => 'valB', '3' => 'valC' ], [ '2' ], [ '2' => 'valB' ] ], | ||
|
@@ -879,7 +879,7 @@ public function testParseUrl( $url, $component, $auto_add_scheme, $expected ) { | |
$this->assertEquals( $expected, Utils\parse_url( $url, $component, $auto_add_scheme ) ); | ||
} | ||
|
||
public function dataParseUrl() { | ||
public static function dataParseUrl() { | ||
return [ | ||
[ 'http://user:[email protected]:9090/path?arg=value#anchor', -1, true, [ 'scheme' => 'http', 'host' => 'example.com', 'port' => 9090, 'user' => 'user', 'pass' => 'pass', 'path' => '/path', 'query' => 'arg=value', 'fragment' => 'anchor' ] ], | ||
[ 'example.com:9090/path?arg=value#anchor', -1, true, [ 'scheme' => 'http', 'host' => 'example.com', 'port' => 9090, 'path' => '/path', 'query' => 'arg=value', 'fragment' => 'anchor' ] ], | ||
|
@@ -902,7 +902,7 @@ public function testValidClassAndMethodPair( $pair, $is_valid ) { | |
$this->assertEquals( $is_valid, Utils\is_valid_class_and_method_pair( $pair ) ); | ||
} | ||
|
||
public function dataValidClassAndMethodPair() { | ||
public static function dataValidClassAndMethodPair() { | ||
return [ | ||
[ 'string', false ], | ||
[ [], false ], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.