From a077fee11c22ec893d05734e39ec6c9113d37683 Mon Sep 17 00:00:00 2001 From: scribu Date: Sun, 17 Feb 2013 04:59:50 +0200 Subject: [PATCH] add test for --debug flag --- features/bootstrap/FeatureContext.php | 10 ++++++++++ features/flags.feature | 17 +++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/features/bootstrap/FeatureContext.php b/features/bootstrap/FeatureContext.php index 7eefe89b..31bff785 100644 --- a/features/bootstrap/FeatureContext.php +++ b/features/bootstrap/FeatureContext.php @@ -164,6 +164,16 @@ class FeatureContext extends BehatContext } /** + * @Then /^(STDOUT|STDERR) should contain:$/ + */ + public function outputShouldContain( $stream, PyStringNode $output ) + { + if ( false === strpos( $this->result->$stream, (string) $output ) ) { + throw new \Exception( $this->result->$stream ); + } + } + + /** * @Then /^(STDOUT|STDERR) should match \'([^\']+)\'$/ */ public function outputShouldMatch( $stream, $format ) diff --git a/features/flags.feature b/features/flags.feature index 684b370f..82ec10ae 100644 --- a/features/flags.feature +++ b/features/flags.feature @@ -17,3 +17,20 @@ Feature: Global flags """ Error: 'non-existing-command' is not a registered wp command. See 'wp help'. """ + + Scenario: Debug run + Given WP install + + When I run `wp eval 'echo CONST_WITHOUT_QUOTES;'` + Then it should run without errors + And STDOUT should be: + """ + CONST_WITHOUT_QUOTES + """ + + When I run `wp --debug eval 'echo CONST_WITHOUT_QUOTES;'` + Then the return code should be 0 + And STDOUT should contain: + """ + Notice: Use of undefined constant CONST_WITHOUT_QUOTES + """ -- 2.11.0