Skip to content

Commit 6191c85

Browse files
authored
Merge branch 'main' into update-phpunit-config
2 parents dc349db + 82ce7d9 commit 6191c85

File tree

6 files changed

+25
-15
lines changed

6 files changed

+25
-15
lines changed

php/WP_CLI/Extractor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ private static function extract_zip( $zipfile, $dest ) {
4848
throw new Exception( "Could not create folder '{$dest}'." );
4949
}
5050

51-
if ( ! file( $zipfile )
51+
if ( ! file_exists( $zipfile )
5252
|| ! is_readable( $zipfile )
5353
|| filesize( $zipfile ) <= 0 ) {
5454
throw new Exception( "Invalid zip file '{$zipfile}'." );
@@ -127,7 +127,7 @@ private static function extract_tarball( $tarball, $dest ) {
127127
$tarball = "./{$tarball}";
128128
}
129129

130-
if ( ! file( $tarball )
130+
if ( ! file_exists( $tarball )
131131
|| ! is_readable( $tarball )
132132
|| filesize( $tarball ) <= 0 ) {
133133
throw new Exception( "Invalid zip file '{$tarball}'." );

tests/CommandFactoryTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22

33
use WP_CLI\Tests\TestCase;
44

5-
require_once dirname( __DIR__ ) . '/php/class-wp-cli-command.php';
6-
75
class CommandFactoryTest extends TestCase {
86

7+
public static function set_up_before_class() {
8+
require_once dirname( __DIR__ ) . '/php/class-wp-cli-command.php';
9+
}
10+
911
/**
1012
* @dataProvider dataProviderExtractLastDocComment
1113
*/

tests/FileCacheTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@
55
use WP_CLI\Tests\TestCase;
66
use WP_CLI\Utils;
77

8-
require_once dirname( __DIR__ ) . '/php/class-wp-cli.php';
9-
108
class FileCacheTest extends TestCase {
119

10+
public static function set_up_before_class() {
11+
require_once dirname( __DIR__ ) . '/php/class-wp-cli.php';
12+
}
13+
1214
/**
1315
* Test get_root() deals with backslashed directory.
1416
*/

tests/HelpTest.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22

33
use WP_CLI\Tests\TestCase;
44

5-
require_once dirname( __DIR__ ) . '/php/class-wp-cli.php';
6-
require_once dirname( __DIR__ ) . '/php/class-wp-cli-command.php';
7-
require_once dirname( __DIR__ ) . '/php/commands/help.php';
8-
95
class HelpTest extends TestCase {
106

7+
public static function set_up_before_class() {
8+
require_once dirname( __DIR__ ) . '/php/class-wp-cli.php';
9+
require_once dirname( __DIR__ ) . '/php/class-wp-cli-command.php';
10+
require_once dirname( __DIR__ ) . '/php/commands/help.php';
11+
}
12+
1113
public function test_parse_reference_links() {
1214
$test_class = new ReflectionClass( 'Help_Command' );
1315
$method = $test_class->getMethod( 'parse_reference_links' );

tests/UtilsTest.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@
55
use WP_CLI\Tests\TestCase;
66
use WP_CLI\Utils;
77

8-
require_once dirname( __DIR__ ) . '/php/class-wp-cli.php';
9-
require_once __DIR__ . '/mock-requests-transport.php';
10-
118
class UtilsTest extends TestCase {
129

10+
public static function set_up_before_class() {
11+
require_once dirname( __DIR__ ) . '/php/class-wp-cli.php';
12+
require_once __DIR__ . '/mock-requests-transport.php';
13+
}
14+
1315
public function testIncrementVersion() {
1416
// Keyword increments.
1517
$this->assertEquals(

tests/WP_CLI/WpOrgApiTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
use WP_CLI\Tests\TestCase;
44
use WP_CLI\WpOrgApi;
55

6-
require_once dirname( __DIR__ ) . '/mock-requests-transport.php';
7-
86
class WpOrgApiTest extends TestCase {
97

8+
public static function set_up_before_class() {
9+
require_once dirname( __DIR__ ) . '/mock-requests-transport.php';
10+
}
11+
1012
public static function data_http_request_verify() {
1113
return [
1214
'can retrieve core checksums' => [

0 commit comments

Comments
 (0)