From 78872a358b8458589dc36354f309085d1995118f Mon Sep 17 00:00:00 2001 From: Damian Mooyman Date: Thu, 12 Jan 2017 11:17:17 +1300 Subject: [PATCH] =?UTF-8?q?ENHANCEMENT:=20Remove=20redundant=20named=20gro?= =?UTF-8?q?ups=20from=20patterns=20Unfortunately,=20named=20groups=20break?= =?UTF-8?q?s=20all=20IDE=20autocompletion=20in=20PHPStorm,=20and=20the=20a?= =?UTF-8?q?ctual=20parser=20doesn=E2=80=99t=20benefit=20from=20them.=20Rem?= =?UTF-8?q?oving=20them=20makes=20it=20possible=20to=20navigate=20from=20g?= =?UTF-8?q?erkin=20fixtures=20to=20method=20implementations=20immediately.?= =?UTF-8?q?=20However,=20it=20does=20make=20reading=20the=20actual=20regex?= =?UTF-8?q?p=20a=20bit=20harder.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BehatExtension/Context/FixtureContext.php | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/SilverStripe/BehatExtension/Context/FixtureContext.php b/src/SilverStripe/BehatExtension/Context/FixtureContext.php index 306b6ce..0a5c216 100644 --- a/src/SilverStripe/BehatExtension/Context/FixtureContext.php +++ b/src/SilverStripe/BehatExtension/Context/FixtureContext.php @@ -136,7 +136,7 @@ class FixtureContext extends BehatContext /** * Example: Given a "page" "Page 1" * - * @Given /^(?:(an|a|the) )"(?[^"]+)" "(?[^"]+)"$/ + * @Given /^(?:an|a|the) "([^"]+)" "([^"]+)"$/ */ public function stepCreateRecord($type, $id) { @@ -148,7 +148,7 @@ class FixtureContext extends BehatContext /** * Example: Given a "page" "Page 1" has the "content" "My content" * - * @Given /^(?:(an|a|the) )"(?[^"]+)" "(?[^"]+)" has (?:(an|a|the) )"(?.*)" "(?.*)"$/ + * @Given /^(?:an|a|the) "([^"]+)" "([^"]+)" has (?:an|a|the) "(.*)" "(.*)"$/ */ public function stepCreateRecordHasField($type, $id, $field, $value) { @@ -173,7 +173,7 @@ class FixtureContext extends BehatContext * Example: Given a "page" "Page 1" with "URL"="page-1" and "Content"="my page 1" * Example: Given the "page" "Page 1" has "URL"="page-1" and "Content"="my page 1" * - * @Given /^(?:(an|a|the) )"(?[^"]+)" "(?[^"]+)" (?:(with|has)) (?".*)$/ + * @Given /^(?:an|a|the) "([^"]+)" "([^"]+)" (?:with|has) (".*)$/ */ public function stepCreateRecordWithData($type, $id, $data) { @@ -206,7 +206,7 @@ class FixtureContext extends BehatContext * | 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) { @@ -231,7 +231,7 @@ class FixtureContext extends BehatContext * Example: Given the "page" "Page 1.1" is a child of the "page" "Page1". * Note that this change is not published by default * - * @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) { @@ -277,7 +277,7 @@ class FixtureContext extends BehatContext * If the last part of the string (in the "X" relation) is omitted, then the first matching relation will be used. * * @example I assign the "TaxonomyTerm" "For customers" to the "Page" "Page1" - * @Given /^I assign (?:(an|a|the) )"(?[^"]+)" "(?[^"]+)" to (?:(an|a|the) )"(?[^"]+)" "(?[^"]+)"$/ + * @Given /^I assign (?:an|a|the) "([^"]+)" "([^"]+)" to (?:an|a|the) "([^"]+)" "([^"]+)"$/ */ public function stepIAssignObjToObj($type, $value, $relationType, $relationId) { @@ -290,7 +290,7 @@ class FixtureContext extends BehatContext * Assumption: one object has relationship (has_one, has_many or many_many ) with the other object * * @example I assign the "TaxonomyTerm" "For customers" to the "Page" "Page1" in the "Terms" relation - * @Given /^I assign (?:(an|a|the) )"(?[^"]+)" "(?[^"]+)" to (?:(an|a|the) )"(?[^"]+)" "(?[^"]+)" in the "(?[^"]+)" relation$/ + * @Given /^I assign (?:an|a|the) "([^"]+)" "([^"]+)" to (?:an|a|the) "([^"]+)" "([^"]+)" in the "([^"]+)" relation$/ */ public function stepIAssignObjToObjInTheRelation($type, $value, $relationType, $relationId, $relationName) { @@ -359,7 +359,7 @@ class FixtureContext extends BehatContext /** * 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) { @@ -422,7 +422,7 @@ class FixtureContext extends BehatContext /** * 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) { @@ -438,7 +438,7 @@ class FixtureContext extends BehatContext /** * 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) { @@ -465,7 +465,7 @@ class FixtureContext extends BehatContext /** * 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) { @@ -503,7 +503,7 @@ class FixtureContext extends BehatContext * using its RelativeLink() method to map the record to a URL. * Example: Given I go to the "page" "My Page" * - * @Given /^I go to (?:(an|a|the) )"(?[^"]+)" "(?[^"]+)"/ + * @Given /^I go to (?:an|a|the) "([^"]+)" "([^"]+)"/ */ public function stepGoToNamedRecord($type, $id) { @@ -527,7 +527,7 @@ class FixtureContext extends BehatContext * Checks that a file or folder exists in the webroot. * Example: There should be a file "assets/Uploads/test.jpg" * - * @Then /^there should be a (?(file|folder) )"(?[^"]*)"/ + * @Then /^there should be a ((file|folder) )"([^"]*)"/ */ public function stepThereShouldBeAFileOrFolder($type, $path) { @@ -539,7 +539,7 @@ class FixtureContext extends BehatContext * * Example: there should be a filename "Uploads/test.jpg" with hash "59de0c841f" * - * @Then /^there should be a filename "(?[^"]*)" with hash "(?[a-fA-Z0-9]+)"/ + * @Then /^there should be a filename "([^"]*)" with hash "([a-fA-Z0-9]+)"/ */ public function stepThereShouldBeAFileWithTuple($filename, $hash) { @@ -571,7 +571,7 @@ class FixtureContext extends BehatContext } /** - * @Given /^(?:(an|a|the) )"(?[^"]*)" "(?[^"]*)" was (?(created|last edited)) "(?