Skip to content

Commit 0eecadc

Browse files
authored
Merge branch 'main' into feature/php-8.4-fix-csv-deprecation
2 parents 7514cef + 82ce7d9 commit 0eecadc

File tree

7 files changed

+27
-16
lines changed

7 files changed

+27
-16
lines changed

features/requests.feature

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
Feature: Requests integration with both v1 and v2
22

33
# This test downgrades to WordPress 5.8, but the SQLite plugin requires 6.0+
4-
@require-mysql
4+
# WP-CLI 2.7 causes deprecation warnings on PHP 8.2
5+
@require-mysql @less-than-php-8.2
56
Scenario: Composer stack with Requests v1
67
Given an empty directory
78
And a composer.json file:

php/WP_CLI/Extractor.php

+2-2
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

+4-2
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

+4-2
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

+6-4
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

+5-3
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

+4-2
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)