OSDN Git Service

behat: remove temp files for scenarios that don't have failing steps
authorscribu <mail@scribu.net>
Sun, 19 May 2013 19:06:20 +0000 (22:06 +0300)
committerscribu <mail@scribu.net>
Sun, 19 May 2013 19:06:20 +0000 (22:06 +0300)
features/bootstrap/FeatureContext.php

index b48d8f7..76d2343 100644 (file)
@@ -69,6 +69,18 @@ class FeatureContext extends BehatContext implements ClosuredContextInterface {
        }
 
        /**
+        * @AfterScenario
+        */
+       public function afterScenario( $event ) {
+               if ( !$this->install_dir )
+                       return;
+
+               if ( $event->getResult() < 4 ) {
+                       Process::create( Utils\esc_cmd( 'rm -r %s', $this->install_dir ) )->run();
+               }
+       }
+
+       /**
         * Initializes context.
         * Every scenario gets it's own context object.
         *