OSDN Git Service

add Behat tests for `db export` and `db import`
authorscribu <mail@scribu.net>
Fri, 9 Aug 2013 18:57:27 +0000 (21:57 +0300)
committerscribu <mail@scribu.net>
Fri, 9 Aug 2013 18:57:29 +0000 (21:57 +0300)
features/db.feature

index 6bef959..61bd9f5 100644 (file)
@@ -11,9 +11,6 @@ Feature: Perform database operations
     When I try the previous command again
     Then the return code should be 1
 
-    When I run `wp db reset --yes`
-    Then STDOUT should not be empty
-
     When I run `wp db optimize`
     Then STDOUT should not be empty
 
@@ -38,3 +35,39 @@ Feature: Perform database operations
     """
     total
     """
+
+  Scenario: DB export/import
+    Given a WP install
+
+    When I run `wp post list --format=count`
+    Then STDOUT should be:
+      """
+      1
+      """
+
+    When I run `wp db export /tmp/wp-cli-behat.sql`
+    Then STDOUT should contain:
+      """
+      Success: Exported
+      """
+
+    When I run `wp db reset --yes`
+    Then STDOUT should contain:
+      """
+      Success: Database reset.
+      """
+
+    When I try `wp post list --format=count`
+    Then STDERR should not be empty
+
+    When I run `wp db import /tmp/wp-cli-behat.sql`
+    Then STDOUT should contain:
+      """
+      Success: Imported
+      """
+
+    When I run `wp post list --format=count`
+    Then STDOUT should contain:
+      """
+      1
+      """