Skip to content

Commit 0fc63bc

Browse files
committed
[#212] Fixed When I go to my profile edit page.
1 parent f1db4ad commit 0fc63bc

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/UserTrait.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,19 @@ public function userVisitProfile(string $name): void {
2828
/**
2929
* Visit edit page of the current user.
3030
*
31-
* @When I go to my edit profile page
31+
* @When I go to my profile edit page
3232
*/
3333
public function userVisitOwnProfile(): void {
34-
/** @var \Drupal\user\UserInterface $user */
3534
$user = $this->getUserManager()->getCurrentUser();
3635

37-
if (!$user instanceof UserInterface) {
36+
if ($user instanceof \stdClass) {
37+
$id = $user->uid;
38+
}
39+
else {
3840
throw new \RuntimeException('Require user to login before visiting profile page.');
3941
}
4042

41-
$this->userVisitProfile($user->getAccountName());
43+
$this->visitPath("/user/$id/edit");
4244
}
4345

4446
/**

tests/behat/features/user.feature

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ Feature: Check that UserTrait works for or D9
1919
When I edit user "authenticated_user" profile
2020
Then I should get a 200 HTTP response
2121

22+
@api
23+
Scenario: Assert "When I go to my profile edit page"
24+
Given I am logged in as a user with the "administrator" role
25+
When I go to my profile edit page
26+
Then I should get a 200 HTTP response
27+
2228
@api
2329
Scenario: Assert "Given no users:" by name
2430
Given I am logged in as a user with the "administrator" role

0 commit comments

Comments
 (0)