Skip to content

Commit edf691c

Browse files
authored
Merge pull request #106 from wp-cli/fix/add-yet-more-missing-imports
Add yet more missing imports
2 parents 7c1e9ad + 76da217 commit edf691c

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed

src/Context/GivenStepDefinitions.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44

55
use Behat\Gherkin\Node\PyStringNode;
66
use Behat\Gherkin\Node\TableNode;
7+
use RuntimeException;
78
use WP_CLI\Process;
9+
use WP_CLI\Utils;
810

911
trait GivenStepDefinitions {
1012

@@ -20,7 +22,7 @@ public function given_an_empty_directory() {
2022
*/
2123
public function given_a_specific_directory( $empty_or_nonexistent, $dir ) {
2224
$dir = $this->replace_variables( $dir );
23-
if ( ! WP_CLI\Utils\is_path_absolute( $dir ) ) {
25+
if ( ! Utils\is_path_absolute( $dir ) ) {
2426
$dir = $this->variables['RUN_DIR'] . "/$dir";
2527
}
2628

@@ -187,7 +189,7 @@ public function given_a_download( TableNode $table ) {
187189
continue;
188190
}
189191

190-
Process::create( \WP_CLI\Utils\esc_cmd( 'curl -sSL %s > %s', $row['url'], $path ) )->run_check();
192+
Process::create( \Utils\esc_cmd( 'curl -sSL %s > %s', $row['url'], $path ) )->run_check();
191193
}
192194
}
193195

src/Context/Support.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,13 @@ protected function compare_contents( $expected, $actual ) {
9898

9999
if ( is_object( $expected ) ) {
100100
foreach ( get_object_vars( $expected ) as $name => $value ) {
101-
if ( ! compare_contents( $value, $actual->$name ) ) {
101+
if ( ! $this->compare_contents( $value, $actual->$name ) ) {
102102
return false;
103103
}
104104
}
105105
} elseif ( is_array( $expected ) ) {
106106
foreach ( $expected as $key => $value ) {
107-
if ( ! compare_contents( $value, $actual[ $key ] ) ) {
107+
if ( ! $this->compare_contents( $value, $actual[ $key ] ) ) {
108108
return false;
109109
}
110110
}
@@ -154,7 +154,7 @@ protected function check_that_json_string_contains_json_string( $actual_json, $e
154154
return false;
155155
}
156156

157-
return compare_contents( $expected_value, $actual_value );
157+
return $this->compare_contents( $expected_value, $actual_value );
158158
}
159159

160160
/**
@@ -220,6 +220,6 @@ protected function check_that_yaml_string_contains_yaml_string( $actual_yaml, $e
220220
return false;
221221
}
222222

223-
return compare_contents( $expected_value, $actual_value );
223+
return $this->compare_contents( $expected_value, $actual_value );
224224
}
225225
}

src/Context/ThenStepDefinitions.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
use Behat\Gherkin\Node\PyStringNode;
66
use Behat\Gherkin\Node\TableNode;
7+
use Exception;
8+
use Requests;
9+
use RuntimeException;
710

811
trait ThenStepDefinitions {
912

src/Context/WhenStepDefinitions.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace WP_CLI\Tests\Context;
44

55
use WP_CLI\Process;
6+
use Exception;
67

78
trait WhenStepDefinitions {
89

@@ -36,7 +37,7 @@ public function when_i_launch_in_the_background( $cmd ) {
3637
public function when_i_run( $mode, $cmd ) {
3738
$cmd = $this->replace_variables( $cmd );
3839
$this->result = $this->wpcli_tests_invoke_proc( $this->proc( $cmd ), $mode );
39-
list($this->result->stdout, $this->email_sends) = $this->wpcli_tests_capture_email_sends( $this->result->stdout );
40+
list( $this->result->stdout, $this->email_sends ) = $this->wpcli_tests_capture_email_sends( $this->result->stdout );
4041
}
4142

4243
/**
@@ -45,20 +46,20 @@ public function when_i_run( $mode, $cmd ) {
4546
public function when_i_run_from_a_subfolder( $mode, $cmd, $subdir ) {
4647
$cmd = $this->replace_variables( $cmd );
4748
$this->result = $this->wpcli_tests_invoke_proc( $this->proc( $cmd, array(), $subdir ), $mode );
48-
list($this->result->stdout, $this->email_sends) = $this->wpcli_tests_capture_email_sends( $this->result->stdout );
49+
list( $this->result->stdout, $this->email_sends ) = $this->wpcli_tests_capture_email_sends( $this->result->stdout );
4950
}
5051

5152
/**
5253
* @When /^I (run|try) the previous command again$/
5354
*/
5455
public function when_i_run_the_previous_command_again( $mode ) {
5556
if ( ! isset( $this->result ) ) {
56-
throw new \Exception( 'No previous command.' );
57+
throw new Exception( 'No previous command.' );
5758
}
5859

5960
$proc = Process::create( $this->result->command, $this->result->cwd, $this->result->env );
6061
$this->result = $this->wpcli_tests_invoke_proc( $proc, $mode );
61-
list($this->result->stdout, $this->email_sends) = $this->wpcli_tests_capture_email_sends( $this->result->stdout );
62+
list( $this->result->stdout, $this->email_sends ) = $this->wpcli_tests_capture_email_sends( $this->result->stdout );
6263
}
6364
}
6465

0 commit comments

Comments
 (0)