OSDN Git Service

add some Behat tests for `wp user *-role`
authorscribu <mail@scribu.net>
Sun, 28 Jul 2013 16:42:13 +0000 (19:42 +0300)
committerscribu <mail@scribu.net>
Sun, 28 Jul 2013 16:42:14 +0000 (19:42 +0300)
see #594

features/user.feature

index cb70e36..ced0e41 100644 (file)
@@ -61,3 +61,34 @@ Feature: Manage WordPress users
     """
     [{"user_login":"admin","display_name":"Existing User","user_email":"admin@domain.com","roles":"administrator"}]
     """
+
+  Scenario: Managing user roles
+    Given a WP install
+
+    When I run `wp user add-role 1 editor`
+    Then STDOUT should not be empty
+    And I run `wp user get 1`
+    Then STDOUT should be a table containing rows:
+      | Field | Value                 |
+      | roles | administrator, editor |
+
+    When I run `wp user set-role 1 author`
+    Then STDOUT should not be empty
+    And I run `wp user get 1`
+    Then STDOUT should be a table containing rows:
+      | Field | Value  |
+      | roles | author |
+
+    When I run `wp user remove-role 1 editor`
+    Then STDOUT should not be empty
+    And I run `wp user get 1`
+    Then STDOUT should be a table containing rows:
+      | Field | Value  |
+      | roles | author |
+
+    When I run `wp user remove-role 1`
+    Then STDOUT should not be empty
+    And I run `wp user get 1`
+    Then STDOUT should be a table containing rows:
+      | Field | Value |
+      | roles |       |