Skip to content

Commit

Permalink
Update scaffolded tests to latest
Browse files Browse the repository at this point in the history
  • Loading branch information
danielbachhuber committed Sep 29, 2017
1 parent aead81d commit f5a2d58
Show file tree
Hide file tree
Showing 5 changed files with 213 additions and 74 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wp-cli/shell-command",
"description": "Interactive PHP console.",
"description": "Opens an interactive PHP console for running and testing PHP code.",
"type": "wp-cli-package",
"homepage": "https://github.com/wp-cli/shell-command",
"support": {
Expand Down
8 changes: 6 additions & 2 deletions features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -699,11 +699,15 @@ public function get_php_binary() {
return 'php';
}

public function start_php_server() {
public function start_php_server( $subdir = '' ) {
$dir = $this->variables['RUN_DIR'] . '/';
if ( $subdir ) {
$dir .= trim( $subdir, '/' ) . '/';
}
$cmd = Utils\esc_cmd( '%s -S %s -t %s -c %s %s',
$this->get_php_binary(),
'localhost:8080',
$this->variables['RUN_DIR'] . '/wordpress/',
$dir,
get_cfg_var( 'cfg_file_path' ),
$this->variables['RUN_DIR'] . '/vendor/wp-cli/server-command/router.php'
);
Expand Down
22 changes: 12 additions & 10 deletions features/bootstrap/Process.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,17 @@ public function run() {
self::$run_times[ $this->command ][1]++;
}

return new ProcessRun( array(
'stdout' => $stdout,
'stderr' => $stderr,
'return_code' => $return_code,
'command' => $this->command,
'cwd' => $this->cwd,
'env' => $this->env,
'run_time' => $run_time,
) );
return new ProcessRun(
array(
'stdout' => $stdout,
'stderr' => $stderr,
'return_code' => $return_code,
'command' => $this->command,
'cwd' => $this->cwd,
'env' => $this->env,
'run_time' => $run_time,
)
);
}

/**
Expand All @@ -107,7 +109,7 @@ public function run_check() {
$r = $this->run();

// $r->STDERR is incorrect, but kept incorrect for backwards-compat
if ( $r->return_code || !empty( $r->STDERR ) ) {
if ( $r->return_code || ! empty( $r->STDERR ) ) {
throw new \RuntimeException( $r );
}

Expand Down
Loading

0 comments on commit f5a2d58

Please sign in to comment.