Skip to content

Commit

Permalink
Fix update password behat context
Browse files Browse the repository at this point in the history
  • Loading branch information
mpysiak committed Oct 25, 2024
1 parent 8708ea4 commit 1201cab
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/Sylius/Behat/Client/ApiClientInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ public function buildCreateRequest(string $url): self;
/** @param ?string $id Deprecated, pass the id as a part of the uri */
public function buildUpdateRequest(string $uri, ?string $id = null): self;

public function buildCustomUpdateRequest(string $uri, ?string $id = null): self;

/** @param array<string, mixed> $data */
public function setRequestData(array $data): self;

Expand Down
7 changes: 4 additions & 3 deletions src/Sylius/Behat/Client/ApiPlatformClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,15 +188,16 @@ public function buildUpdateRequest(string $uri, ?string $id = null): self
return $this;
}

public function buildCustomUpdateRequest(string $resource, string $id, string $customSuffix): void
public function buildCustomUpdateRequest(string $uri, ?string $id = null): self
{
$this->request = $this->requestFactory->update(
$this->section,
$resource,
sprintf('%s/%s', $id, $customSuffix),
$uri,
$this->authorizationHeader,
$this->getToken(),
);

return $this;
}

public function addParameter(string $key, bool|int|string $value): self
Expand Down
2 changes: 1 addition & 1 deletion src/Sylius/Behat/Context/Api/Shop/CustomerContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function iWantToChangeMyPassword(): void
/** @var CustomerInterface $customer */
$customer = $shopUser->getCustomer();

$this->client->buildUpdateRequest(sprintf('customers/%s/password', $customer->getId()));
$this->client->buildCustomUpdateRequest(sprintf('customers/%s/password', $customer->getId()));
}

/**
Expand Down

0 comments on commit 1201cab

Please sign in to comment.