OSDN Git Service

behat: be more verbose when a command fails
authorscribu <mail@scribu.net>
Fri, 3 May 2013 22:00:07 +0000 (01:00 +0300)
committerscribu <mail@scribu.net>
Fri, 3 May 2013 22:09:53 +0000 (01:09 +0300)
features/steps/basic_steps.php

index 3b6905e..f0591ac 100644 (file)
@@ -154,8 +154,11 @@ $steps->Then( '/^the return code should be (\d+)$/',
 
 $steps->Then( '/^it should run without errors$/',
        function ( $world ) {
-               if ( !empty( $world->result->STDERR ) )
-                       throw new \Exception( $world->result->STDERR );
+               if ( !empty( $world->result->STDERR ) ) {
+                       $r = $world->result;
+                       throw new \Exception( sprintf( "%s: %s\ncwd: %s",
+                               $r->command, $r->STDERR, $r->cwd ) );
+               }
 
                if ( 0 != $world->result->return_code )
                        throw new \Exception( "Return code was $world->result->return_code" );