Skip to content

Commit

Permalink
Showing 4 changed files with 29 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ Feature: Adding a new administrator
When I specify its email as "l.skywalker@gmail.com"
And I specify its name as "Luke"
And I specify its password as "lightsaber"
And I specify its locale to "English (United States)"
And I specify its locale as "English (United States)"
And I add it
Then I should be notified that it has been successfully created
And the administrator "l.skywalker@gmail.com" should appear in the store
@@ -25,7 +25,7 @@ Feature: Adding a new administrator
When I specify its email as "l.skywalker@gmail.com"
And I specify its name as "Luke"
And I specify its password as "lightsaber"
And I specify its locale to "English (United States)"
And I specify its locale as "English (United States)"
And I enable it
And I add it
Then I should be able to log in as "l.skywalker@gmail.com" authenticated by "lightsaber" password
30 changes: 17 additions & 13 deletions features/user/managing_administrators/editing_administrator.feature
Original file line number Diff line number Diff line change
@@ -7,31 +7,35 @@ Feature: Editing an administrator
Background:
Given the store operates on a single channel in "United States"
And I am logged in as an administrator
And there is an administrator "ted@example.com" identified by "bear"

@ui
Scenario: Changing name and email of an existing administrator
Given there is an administrator "ted@example.com" identified by "bear"
And I want to edit this administrator
When I change its name as "Jon Snow"
And I change its email as "jon@example.com"
When I want to edit this administrator
And I change its name to "Jon Snow"
And I change its email to "jon@example.com"
And I save my changes
Then I should be notified that it has been successfully edited
And this administrator with name "Jon Snow" should appear in the store

@ui
Scenario: Changing password of an existing administrator and trying sign in with old password
Given there is an administrator "ted@example.com" identified by "bear"
And I want to edit this administrator
When I change its name as "bear123"
And I change its password as "example"
When I want to edit this administrator
And I change its password to "example"
And I save my changes
Then I should not be able to log in as "ted@example.com" authenticated by "bear" password

@ui
Scenario: Changing password of an existing administrator and sign in again
Given there is an administrator "ted@example.com" identified by "bear"
And I want to edit this administrator
When I change its name as "bear123"
And I change its password as "example"
Scenario: Changing only a password of an existing administrator and sign in again
When I want to edit this administrator
And I change its password to "example"
And I save my changes
Then I should be able to log in as "ted@example.com" authenticated by "example" password

@ui
Scenario: Changing password and name of an existing administrator and sign in again
When I want to edit this administrator
And I change its name to "ted"
And I change its password to "example"
And I save my changes
Then I should be able to log in as "ted@example.com" authenticated by "example" password
Original file line number Diff line number Diff line change
@@ -74,8 +74,8 @@ public function iWantToCreateANewAdministrator()
}

/**
* @Given /^I want to edit (this administrator)$/
* @Given /^I am editing (my) details$/
* @When /^I want to edit (this administrator)$/
*/
public function iWantToEditThisAdministrator(AdminUserInterface $adminUser)
{
@@ -100,9 +100,9 @@ public function iSpecifyItsNameAs($username = null)
}

/**
* @When I change its name as :username
* @When I change its name to :username
*/
public function iChangeItsNameAs($username)
public function iChangeItsNameTo($username)
{
$this->updatePage->changeUsername($username);
}
@@ -117,17 +117,17 @@ public function iSpecifyItsEmailAs($email = null)
}

/**
* @When I change its email as :email
* @When I change its email to :email
*/
public function iChangeItsEmailAs($email)
public function iChangeItsEmailTo($email)
{
$this->updatePage->changeEmail($email);
}

/**
* @When I specify its locale to :localeCode
* @When I specify its locale as :localeCode
*/
public function iSpecifyItsLocaleTo($localeCode)
public function iSpecifyItsLocaleAs($localeCode)
{
$this->createPage->specifyLocale($localeCode);
}
@@ -151,9 +151,9 @@ public function iSpecifyItsPasswordAs($password = null)
}

/**
* @When I change its password as :password
* @When I change its password to :password
*/
public function iChangeItsPasswordAs($password)
public function iChangeItsPasswordTo($password)
{
$this->updatePage->changePassword($password);
}
Original file line number Diff line number Diff line change
@@ -52,6 +52,7 @@
<argument type="service" id="sylius.security.password_updater" />
<tag name="kernel.event_listener" event="sylius.user.pre_password_reset" method="genericEventUpdater" />
<tag name="kernel.event_listener" event="sylius.user.pre_password_change" method="genericEventUpdater" />
<tag name="kernel.event_listener" event="sylius.admin_user.pre_update" method="genericEventUpdater" />
<tag name="kernel.event_listener" event="sylius.customer.pre_update" method="customerUpdateEvent" />
<tag name="doctrine.event_listener" event="prePersist" />
<tag name="doctrine.event_listener" event="preUpdate" />

0 comments on commit 905abbd

Please sign in to comment.