Skip to content

Commit

Permalink
Fixed userDelete() and add tests for removal by email.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Skrypnyk committed Dec 12, 2021
1 parent ad52104 commit df4fb50
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/UserTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function userDelete(TableNode $usersTable) {
$user = $this->userGetByMail($userHash['mail']);
}
elseif (isset($userHash['name'])) {
$user = $this->userGetByMail($userHash['name']);
$user = $this->userGetByName($userHash['name']);
}
}
catch (\Exception $exception) {
Expand Down
14 changes: 13 additions & 1 deletion tests/behat/features/user.feature
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Feature: Check that UserTrait works for D8
Then I should get a 200 HTTP response

@api
Scenario: Assert "Given no users:"
Scenario: Assert "Given no users:" by name
Given I am logged in as a user with the "administrator" role
When I visit user "authenticated_user" profile
Then I should get a 200 HTTP response
Expand All @@ -26,6 +26,18 @@ Feature: Check that UserTrait works for D8

Then user "authenticated_user" does not exists

@api
Scenario: Assert "Given no users:" by email
Given I am logged in as a user with the "administrator" role
When I visit user "authenticated_user" profile
Then I should get a 200 HTTP response

When no users:
| mail |
| authenticated_user@myexample.com |

Then user "authenticated_user" does not exists

@api
Scenario: Assert "Then user :name has :roles role(s) assigned"
Given user "authenticated_user" has "authenticated" role assigned
Expand Down

0 comments on commit df4fb50

Please sign in to comment.