From aab86a6b0810d211c5dc33bb52de85c92f161891 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Wed, 5 Jun 2013 14:17:28 +0200 Subject: [PATCH] More verbose fixture step definitions Too many clashes with other steps otherwise, e.g. with 'And the preview contains "You can fill"' --- README.md | 16 +++++----- .../BehatExtension/Context/FixtureContext.php | 32 +++++++++---------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 7d19481..73bc88c 100644 --- a/README.md +++ b/README.md @@ -166,23 +166,23 @@ use the inline definition syntax. The following example shows some syntax variat Background: # Creates a new page without data. Can be accessed later under this identifier - Given a page "Page 1" + Given a "page" "Page 1" # Uses a custom RegistrationPage type - And a registration page "Register" + And an "error page" "Register" # Creates a page with inline properties - And a page "Page 2" with "URLSegment"="page-1" and "Content"="my page 1" + And a "page" "Page 2" with "URLSegment"="page-1" and "Content"="my page 1" # Field names can be tabular, and based on DataObject::$field_labels - And the page "Page 3" has the following data + And the "page" "Page 3" has the following data | Content | | | My Property | foo | | My Boolean | bar | # Pages are published by default, can be explicitly unpublished - And the page "Page 1" is not published + And the "page" "Page 1" is not published # Create a hierarchy, and reference a record created earlier - And the page "Page 1.1" is a child of a page "Page 1" + And the "page" "Page 1.1" is a child of a "page" "Page 1" # Specific page type step - And a page "My Redirect" which redirects to a page "Page 1" - And a member "Website User" with "FavouritePage"="=>Page.Page 1" + And a "page" "My Redirect" which redirects to a "page" "Page 1" + And a "member" "Website User" with "FavouritePage"="=>Page.Page 1" @javascript Scenario: View a page in the tree diff --git a/src/SilverStripe/BehatExtension/Context/FixtureContext.php b/src/SilverStripe/BehatExtension/Context/FixtureContext.php index 3ddf253..6911752 100644 --- a/src/SilverStripe/BehatExtension/Context/FixtureContext.php +++ b/src/SilverStripe/BehatExtension/Context/FixtureContext.php @@ -123,9 +123,9 @@ class FixtureContext extends BehatContext } /** - * Example: Given a page "Page 1" + * Example: Given a "page" "Page 1" * - * @Given /^(?:(an|a|the) )(?[^"]+)"(?[^"]+)"$/ + * @Given /^(?:(an|a|the) )"(?[^"]+)" "(?[^"]+)"$/ */ public function stepCreateRecord($type, $id) { @@ -139,9 +139,9 @@ class FixtureContext extends BehatContext } /** - * Example: Given a page "Page 1" with "URL"="page-1" and "Content"="my page 1" + * Example: Given a "page" "Page 1" with "URL"="page-1" and "Content"="my page 1" * - * @Given /^(?:(an|a|the) )(?[^"]+)"(?[^"]+)" with (?.*)$/ + * @Given /^(?:(an|a|the) )"(?[^"]+)" "(?[^"]+)" with (?.*)$/ */ public function stepCreateRecordWithData($type, $id, $data) { @@ -162,12 +162,12 @@ class FixtureContext extends BehatContext } /** - * Example: And the page "Page 2" has the following data + * Example: And the "page" "Page 2" has the following data * | Content | | * | My Property | foo | * | My Boolean | bar | * - * @Given /^(?:(an|a|the) )(?[^"]+)"(?[^"]+)" has the following data$/ + * @Given /^(?:(an|a|the) )"(?[^"]+)" "(?[^"]+)" has the following data$/ */ public function stepCreateRecordWithTable($type, $id, $null, TableNode $fieldsTable) { @@ -181,9 +181,9 @@ class FixtureContext extends BehatContext } /** - * Example: Given the page "Page 1.1" is a child of the page "Page1" + * Example: Given the "page" "Page 1.1" is a child of the "page" "Page1" * - * @Given /^(?:(an|a|the) )(?[^"]+)"(?[^"]+)" is a (?[^\s]*) of (?:(an|a|the) )(?[^"]+)"(?[^"]+)"/ + * @Given /^(?:(an|a|the) )"(?[^"]+)" "(?[^"]+)" is a (?[^\s]*) of (?:(an|a|the) )"(?[^"]+)" "(?[^"]+)"/ */ public function stepUpdateRecordRelation($type, $id, $relation, $relationType, $relationId) { @@ -213,9 +213,9 @@ class FixtureContext extends BehatContext } /** - * Example: Given the page "Page 1" is not published + * Example: Given the "page" "Page 1" is not published * - * @Given /^(?:(an|a|the) )(?[^"]+)"(?[^"]+)" is (?[^"]*)$/ + * @Given /^(?:(an|a|the) )"(?[^"]+)" "(?[^"]+)" is (?[^"]*)$/ */ public function stepUpdateRecordState($type, $id, $state) { @@ -271,9 +271,9 @@ class FixtureContext extends BehatContext } /** - * Example: Given a member "Admin" belonging to "Admin Group" + * Example: Given a "member" "Admin" belonging to "Admin Group" * - * @Given /^(?:(an|a|the) )member "(?[^"]+)" belonging to "(?[^"]+)"$/ + * @Given /^(?:(an|a|the) )"member" "(?[^"]+)" belonging to "(?[^"]+)"$/ */ public function stepCreateMemberWithGroup($id, $groupId) { @@ -285,9 +285,9 @@ class FixtureContext extends BehatContext } /** - * Example: Given a member "Admin" belonging to "Admin Group" with "Email"="test@test.com" + * Example: Given a "member" "Admin" belonging to "Admin Group" with "Email"="test@test.com" * - * @Given /^(?:(an|a|the) )member "(?[^"]+)" belonging to "(?[^"]+)" with (?.*)$/ + * @Given /^(?:(an|a|the) )"member" "(?[^"]+)" belonging to "(?[^"]+)" with (?.*)$/ */ public function stepCreateMemberWithGroupAndData($id, $groupId, $data) { @@ -310,9 +310,9 @@ class FixtureContext extends BehatContext } /** - * Example: Given a group "Admin" with permissions "Access to 'Pages' section" and "Access to 'Files' section" + * Example: Given a "group" "Admin" with permissions "Access to 'Pages' section" and "Access to 'Files' section" * - * @Given /^(?:(an|a|the) )group "(?[^"]+)" (?:(with|has)) permissions (?.*)$/ + * @Given /^(?:(an|a|the) )"group" "(?[^"]+)" (?:(with|has)) permissions (?.*)$/ */ public function stepCreateGroupWithPermissions($id, $permissionStr) {