OSDN Git Service

test deleting the previously created user
authorscribu <mail@scribu.net>
Sat, 16 Feb 2013 23:58:49 +0000 (01:58 +0200)
committerscribu <mail@scribu.net>
Sun, 17 Feb 2013 02:10:14 +0000 (04:10 +0200)
features/bootstrap/FeatureContext.php
features/user.feature

index 4a077a2..0fde4e5 100644 (file)
@@ -85,6 +85,13 @@ class FeatureContext extends BehatContext
         */
        public function iRun( $cmd )
        {
+               if ( false !== strpos( $cmd, '<STDOUT>' ) ) {
+                       if ( !isset( $this->result ) )
+                               throw new \Exception( 'No previous command.' );
+
+                       $cmd = str_replace( '<STDOUT>', trim( $this->result->STDOUT ), $cmd );
+               }
+
                $cmd = ltrim( str_replace( 'wp', '', $cmd ) );
 
                $this->result = $this->runner->run( $cmd );
index 2523ef5..4f2530b 100644 (file)
@@ -7,5 +7,6 @@ Feature: Manage WordPress users
     Then the return code should be 0
     And STDOUT should match '%d'
 
-    When I run the previous command again
-    Then the return code should be 1
+    When I run `wp user delete <STDOUT>`
+    Then the return code should be 0
+    And STDOUT should not be empty