OSDN Git Service

behat: add newline to generated files
authorscribu <mail@scribu.net>
Tue, 30 Apr 2013 14:26:51 +0000 (17:26 +0300)
committerscribu <mail@scribu.net>
Tue, 30 Apr 2013 14:35:20 +0000 (17:35 +0300)
`wp shell` expects it

features/shell.feature
features/steps/basic_steps.php

index 924f84f..2131772 100644 (file)
@@ -9,3 +9,23 @@ Feature: WordPress REPL
     """
     Type "exit" to close session.
     """
+
+  Scenario: Basic session
+    Given a WP install
+    And a session file:
+    """
+    WP_ADMIN
+    $_
+    get_current_user_id()
+    $_
+    """
+
+    When I run `wp shell --quiet < session`
+    Then it should run without errors
+    And STDOUT should be:
+    """
+    true
+    true
+    0
+    0
+    """
index 1d10594..0002a6c 100644 (file)
@@ -12,7 +12,8 @@ $steps->Given( '/^an empty directory$/',
 
 $steps->Given( '/^a ([^\s]+) file:$/',
        function ( $world, $path, PyStringNode $content ) {
-               file_put_contents( $world->get_path( $path ), (string) $content );
+               $content = (string) $content . "\n";
+               file_put_contents( $world->get_path( $path ), $content );
        }
 );