Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions php/WP_CLI/Extractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ private static function extract_zip( $zipfile, $dest ) {
throw new Exception( "Could not create folder '{$dest}'." );
}

if ( ! file( $zipfile )
if ( ! file_exists( $zipfile )
|| ! is_readable( $zipfile )
|| filesize( $zipfile ) <= 0 ) {
throw new Exception( "Invalid zip file '{$zipfile}'." );
Expand Down Expand Up @@ -127,7 +127,7 @@ private static function extract_tarball( $tarball, $dest ) {
$tarball = "./{$tarball}";
}

if ( ! file( $tarball )
if ( ! file_exists( $tarball )
|| ! is_readable( $tarball )
|| filesize( $tarball ) <= 0 ) {
throw new Exception( "Invalid zip file '{$tarball}'." );
Expand Down
6 changes: 4 additions & 2 deletions tests/CommandFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

use WP_CLI\Tests\TestCase;

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

class CommandFactoryTest extends TestCase {

public static function set_up_before_class() {
require_once dirname( __DIR__ ) . '/php/class-wp-cli-command.php';
}

/**
* @dataProvider dataProviderExtractLastDocComment
*/
Expand Down
6 changes: 4 additions & 2 deletions tests/FileCacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
use WP_CLI\Tests\TestCase;
use WP_CLI\Utils;

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

class FileCacheTest extends TestCase {

public static function set_up_before_class() {
require_once dirname( __DIR__ ) . '/php/class-wp-cli.php';
}

/**
* Test get_root() deals with backslashed directory.
*/
Expand Down
10 changes: 6 additions & 4 deletions tests/HelpTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@

use WP_CLI\Tests\TestCase;

require_once dirname( __DIR__ ) . '/php/class-wp-cli.php';
require_once dirname( __DIR__ ) . '/php/class-wp-cli-command.php';
require_once dirname( __DIR__ ) . '/php/commands/help.php';

class HelpTest extends TestCase {

public static function set_up_before_class() {
require_once dirname( __DIR__ ) . '/php/class-wp-cli.php';
require_once dirname( __DIR__ ) . '/php/class-wp-cli-command.php';
require_once dirname( __DIR__ ) . '/php/commands/help.php';
}

public function test_parse_reference_links() {
$test_class = new ReflectionClass( 'Help_Command' );
$method = $test_class->getMethod( 'parse_reference_links' );
Expand Down
8 changes: 5 additions & 3 deletions tests/UtilsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
use WP_CLI\Tests\TestCase;
use WP_CLI\Utils;

require_once dirname( __DIR__ ) . '/php/class-wp-cli.php';
require_once __DIR__ . '/mock-requests-transport.php';

class UtilsTest extends TestCase {

public static function set_up_before_class() {
require_once dirname( __DIR__ ) . '/php/class-wp-cli.php';
require_once __DIR__ . '/mock-requests-transport.php';
}

public function testIncrementVersion() {
// Keyword increments.
$this->assertEquals(
Expand Down
6 changes: 4 additions & 2 deletions tests/WP_CLI/WpOrgApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
use WP_CLI\Tests\TestCase;
use WP_CLI\WpOrgApi;

require_once dirname( __DIR__ ) . '/mock-requests-transport.php';

class WpOrgApiTest extends TestCase {

public static function set_up_before_class() {
require_once dirname( __DIR__ ) . '/mock-requests-transport.php';
}

public static function data_http_request_verify() {
return [
'can retrieve core checksums' => [
Expand Down