8000 [#212] Fixed `When I go to my profile edit page`. by AlexSkrypnyk · Pull Request #219 · drevops/behat-steps · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[#212] Fixed When I go to my profile edit page. #219

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/UserTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,19 @@ public function userVisitProfile(string $name): void {
/**
* Visit edit page of the current user.
*
* @When I go to my edit profile page
* @When I go to my profile edit page
*/
public function userVisitOwnProfile(): void {
/** @var \Drupal\user\UserInterface $user */
$user = $this->getUserManager()->getCurrentUser();

if (!$user instanceof UserInterface) {
if ($user instanceof \stdClass) {
$id = $user->uid;
}
else {
throw new \RuntimeException('Require user to login before visiting profile page.');
}

$this->userVisitProfile($user->getAccountName());
$this->visitPath("/user/$id/edit");
}

/**
Expand Down
6 changes: 6 additions & 0 deletions tests/behat/features/user.feature
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ Feature: Check that UserTrait works for or D9
When I edit user "authenticated_user" profile
Then I should get a 200 HTTP response

@api
Scenario: Assert "When I go to my profile edit page"
Given I am logged in as a user with the "administrator" role
When I go to my profile edit page
Then I should get a 200 HTTP response

@api
Scenario: Assert "Given no users:" by name
Given I am logged in as a user with the "administrator" role
Expand Down
0