Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add doc comments for behat's definitions.
  • Loading branch information
Joao Inacio committed Nov 25, 2014
1 parent 4d66aca commit 5d32ad5
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions Context/Object/User.php
Expand Up @@ -20,6 +20,8 @@ trait User
/**
* @Given there is a User with name :username
*
* Ensures a user with username ':username' exists, creating a new one if necessary.
*
* @return \eZ\Publish\API\Repository\Values\User\User
*/
public function iHaveUser( $username )
Expand All @@ -33,6 +35,8 @@ public function iHaveUser( $username )
/**
* @Given there is a User with name :username, email :email and password :password
*
* Ensures a user exists with given username/email/password, creating a new one if necessary.
*
* @return \eZ\Publish\API\Repository\Values\User\User
*/
public function iHaveUserWithUsernameEmailAndPassword( $username, $email, $password )
Expand All @@ -43,6 +47,8 @@ public function iHaveUserWithUsernameEmailAndPassword( $username, $email, $passw
/**
* @Given there is a User with name :username in :parentGroup group
*
* Ensures a user with username ':username' exists as a child of ':parentGroup' user group, can create either one.
*
* @return \eZ\Publish\API\Repository\Values\User\User
*/
public function iHaveUserInGroup( $username, $parentGroupName )
Expand All @@ -56,6 +62,8 @@ public function iHaveUserInGroup( $username, $parentGroupName )
/**
* @Given there is a User with name :username, email :email and password :password in :parentGroup group
*
* Ensures a user with given username/email/password as a child of ':parentGroup' user group, can create either one.
*
* @return \eZ\Publish\API\Repository\Values\User\User
*/
public function iHaveUserWithUsernameEmailAndPasswordInGroup( $username, $email, $password, $parentGroupName )
Expand All @@ -66,6 +74,13 @@ public function iHaveUserWithUsernameEmailAndPasswordInGroup( $username, $email,
/**
* @Given there is a User with name :username with the following fields:
*
* Ensures a user exists with the values provided in the fields/value table. example:
* | Name | value |
* | email | testuser@ez.no |
* | password | testuser |
* | first_name | Test |
* | last_name | User |
*
* @return \eZ\Publish\API\Repository\Values\User\User
*/
public function iHaveUserWithFields( $username, TableNode $table )
Expand All @@ -90,6 +105,8 @@ public function iHaveUserWithFields( $username, TableNode $table )

/**
* @Given there isn't a User with name :username
*
* Makes sure a user with username ':username' doesn't exist, removing it if necessary
*/
public function iDontHaveUser( $username )
{
Expand All @@ -98,6 +115,8 @@ public function iDontHaveUser( $username )

/**
* @Given there isn't a User with name :username in :parentGroup group
*
* Makes sure a user with username ':username' doesn't exist as a chield of group ':parentGroup', removing it if necessary.
*/
public function iDontHaveUserInGroup( $username, $parentGroup )
{
Expand All @@ -106,6 +125,8 @@ public function iDontHaveUserInGroup( $username, $parentGroup )

/**
* @Given there is a User with id :id
*
* Makes user a user with (mapped) id ':id' exists
*/
public function iHaveUserWithId( $id )
{
Expand All @@ -116,6 +137,8 @@ public function iHaveUserWithId( $id )

/**
* @Given there isn't a User with id :id
*
*Makes user a user with (mapped) id ':id' does not exist
*/
public function iDontHaveUserWithId( $id )
{
Expand All @@ -125,6 +148,8 @@ public function iDontHaveUserWithId( $id )

/**
* @Given there is a User with name :username with id :id in :parentGroup group
*
* Ensures a user with username ':username' and id ':id' exists as a child of ':parentGroup' user group, can create either one.
*/
public function iHaveUserWithIdInGroup( $username, $id, $parentGroup )
{
Expand All @@ -134,6 +159,12 @@ public function iHaveUserWithIdInGroup( $username, $id, $parentGroup )

/**
* @Given there are the following Users:
*
* Make sure that users in the provided table exist in their respective parent group. Example:
* | username | parentGroup |
* | testUser1 | Members |
* | testUser2 | Editors |
* | testUser3 | NewParent | # Both user and group should be created
*/
public function iHaveTheFollowingUsers( TableNode $table )
{
Expand All @@ -150,6 +181,8 @@ public function iHaveTheFollowingUsers( TableNode $table )
/**
* @Given a User with name :username already exists
* @Then User with name :username exists
*
* Checks that user ':username' exists
*/
public function assertUserWithNameExists( $username )
{
Expand All @@ -161,6 +194,8 @@ public function assertUserWithNameExists( $username )

/**
* @Then User with name :username doesn't exist
*
* * Checks that user ':username' does not exist
*/
public function assertUserWithNameDoesntExist( $username )
{
Expand All @@ -173,6 +208,8 @@ public function assertUserWithNameDoesntExist( $username )
/**
* @Then User with name :username exists in group :parentGroup
* @Then User with name :username exists in :parentGroup group
*
* Checks that user ':username' exists as a child of group ':parentGroup'
*/
public function assertUserWithNameExistsInGroup( $username, $parentGroup )
{
Expand All @@ -185,6 +222,8 @@ public function assertUserWithNameExistsInGroup( $username, $parentGroup )
/**
* @Then User with name :username doesn't exist in group :parentGroup
* @Then User with name :username doesn't exist in :parentGroup group
*
* Checks that user ':username' does not exist as a child of group ':parentGroup'
*/
public function assertUserWithNameDoesntExistInGroup( $username, $parentGroup )
{
Expand All @@ -196,6 +235,13 @@ public function assertUserWithNameDoesntExistInGroup( $username, $parentGroup )

/**
* @Then User with name :username doesn't exist in the following groups:
*
* Checks that user ':username' does not exist in any of the provided groups. Example:
* | parentGroup |
* | Partners |
* | Anonymous Users |
* | Editors |
* | Administrator users |
*/
public function assertUserWithNameDoesntExistInGroups( $username, TableNode $table )
{
Expand All @@ -214,6 +260,13 @@ public function assertUserWithNameDoesntExistInGroups( $username, TableNode $tab
/**
* @Then User with name :username has the following fields:
* @Then User with name :username exists with the following fields:
*
* Checks that user ':username' exists with the values provided in the field/value table. example:
* | Name | value |
* | email | testuser@ez.no |
* | password | testuser |
* | first_name | Test |
* | last_name | User |
*/
public function assertUserWithNameExistsWithFields( $username, TableNode $table )
{
Expand Down

0 comments on commit 5d32ad5

Please sign in to comment.