Skip to content

Commit

Permalink
Merge pull request #30 from wp-cli/update-test-scaffold
Browse files Browse the repository at this point in the history
Update scaffolded tests to latest
  • Loading branch information
schlessera authored Sep 29, 2017
2 parents 46f9174 + 9fe5005 commit 681797a
Show file tree
Hide file tree
Showing 4 changed files with 212 additions and 73 deletions.
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 681797a

Please sign in to comment.