mirror of
https://github.com/silverstripe/silverstripe-behat-extension
synced 2024-10-22 17:05:32 +02:00
More verbose fixture step definitions
Too many clashes with other steps otherwise, e.g. with 'And the preview contains "You can fill"'
This commit is contained in:
parent
55c7f578fd
commit
aab86a6b08
16
README.md
16
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 | <blink> |
|
||||
| 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
|
||||
|
@ -123,9 +123,9 @@ class FixtureContext extends BehatContext
|
||||
}
|
||||
|
||||
/**
|
||||
* Example: Given a page "Page 1"
|
||||
* Example: Given a "page" "Page 1"
|
||||
*
|
||||
* @Given /^(?:(an|a|the) )(?<type>[^"]+)"(?<id>[^"]+)"$/
|
||||
* @Given /^(?:(an|a|the) )"(?<type>[^"]+)" "(?<id>[^"]+)"$/
|
||||
*/
|
||||
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) )(?<type>[^"]+)"(?<id>[^"]+)" with (?<data>.*)$/
|
||||
* @Given /^(?:(an|a|the) )"(?<type>[^"]+)" "(?<id>[^"]+)" with (?<data>.*)$/
|
||||
*/
|
||||
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 | <blink> |
|
||||
* | My Property | foo |
|
||||
* | My Boolean | bar |
|
||||
*
|
||||
* @Given /^(?:(an|a|the) )(?<type>[^"]+)"(?<id>[^"]+)" has the following data$/
|
||||
* @Given /^(?:(an|a|the) )"(?<type>[^"]+)" "(?<id>[^"]+)" 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) )(?<type>[^"]+)"(?<id>[^"]+)" is a (?<relation>[^\s]*) of (?:(an|a|the) )(?<relationType>[^"]+)"(?<relationId>[^"]+)"/
|
||||
* @Given /^(?:(an|a|the) )"(?<type>[^"]+)" "(?<id>[^"]+)" is a (?<relation>[^\s]*) of (?:(an|a|the) )"(?<relationType>[^"]+)" "(?<relationId>[^"]+)"/
|
||||
*/
|
||||
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) )(?<type>[^"]+)"(?<id>[^"]+)" is (?<state>[^"]*)$/
|
||||
* @Given /^(?:(an|a|the) )"(?<type>[^"]+)" "(?<id>[^"]+)" is (?<state>[^"]*)$/
|
||||
*/
|
||||
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 "(?<id>[^"]+)" belonging to "(?<groupId>[^"]+)"$/
|
||||
* @Given /^(?:(an|a|the) )"member" "(?<id>[^"]+)" belonging to "(?<groupId>[^"]+)"$/
|
||||
*/
|
||||
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 "(?<id>[^"]+)" belonging to "(?<groupId>[^"]+)" with (?<data>.*)$/
|
||||
* @Given /^(?:(an|a|the) )"member" "(?<id>[^"]+)" belonging to "(?<groupId>[^"]+)" with (?<data>.*)$/
|
||||
*/
|
||||
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 "(?<id>[^"]+)" (?:(with|has)) permissions (?<permissionStr>.*)$/
|
||||
* @Given /^(?:(an|a|the) )"group" "(?<id>[^"]+)" (?:(with|has)) permissions (?<permissionStr>.*)$/
|
||||
*/
|
||||
public function stepCreateGroupWithPermissions($id, $permissionStr)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user