mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 17:10:53 +00:00
[ApiBundle] ManagingCustomersContext - refactor methods for simplicity
This commit is contained in:
parent
d53ed1413e
commit
0ccbcf8943
1 changed files with 6 additions and 28 deletions
|
|
@ -139,22 +139,12 @@ final class ManagingCustomersContext implements Context
|
|||
}
|
||||
|
||||
/**
|
||||
* @When I enable their account
|
||||
* @When /^I (enable|disable) their account$/
|
||||
*/
|
||||
public function iEnableIt(): void
|
||||
public function iEnableIt(string $toggleAction): void
|
||||
{
|
||||
$this->client->addRequestData('user', [
|
||||
'enabled' => true,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I disable their account
|
||||
*/
|
||||
public function iDisableIt(): void
|
||||
{
|
||||
$this->client->addRequestData('user', [
|
||||
'enabled' => false,
|
||||
'enabled' => 'enable' === $toggleAction,
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
@ -448,27 +438,15 @@ final class ManagingCustomersContext implements Context
|
|||
}
|
||||
|
||||
/**
|
||||
* @Then /^(this customer) should be enabled$/
|
||||
* @Then /^(this customer) should be (enabled|disabled)$/
|
||||
*/
|
||||
public function thisCustomerShouldBeEnabled(CustomerInterface $customer): void
|
||||
public function thisCustomerShouldBeEnabled(CustomerInterface $customer, string $toggleAction): void
|
||||
{
|
||||
$user = $this->responseChecker->getValue(
|
||||
$this->client->show(Resources::CUSTOMERS, (string) $customer->getId()),
|
||||
'user',
|
||||
);
|
||||
Assert::true($user['enabled']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^(this customer) should be disabled$/
|
||||
*/
|
||||
public function thisCustomerShouldBeDisabled(CustomerInterface $customer): void
|
||||
{
|
||||
$user = $this->responseChecker->getValue(
|
||||
$this->client->show(Resources::CUSTOMERS, (string) $customer->getId()),
|
||||
'user',
|
||||
);
|
||||
Assert::false($user['enabled']);
|
||||
Assert::same($user['enabled'], 'enabled' === $toggleAction);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue