mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 17:10:53 +00:00
[ApiBundle] Add behat tests for customer resources
This commit is contained in:
parent
df266cc161
commit
1549c9d4b8
11 changed files with 399 additions and 41 deletions
|
|
@ -17,14 +17,14 @@ Feature: Browsing orders of a customer
|
|||
And the customer chose "Free" shipping method to "United States" with "Cash on Delivery" payment
|
||||
And I am logged in as an administrator
|
||||
|
||||
@api
|
||||
@ui @api
|
||||
Scenario: Browsing orders of a specific customer in the list
|
||||
When I browse orders of a customer "logan@wolverine.com"
|
||||
Then I should see a single order in the list
|
||||
And I should see the order with number "#00000007" in the list
|
||||
And I should not see the order with number "#00000008" in the list
|
||||
|
||||
@api
|
||||
@ui @api
|
||||
Scenario: Browsing orders of a specific customer in the list
|
||||
When I browse orders of a customer "logan@wolverine.com"
|
||||
And I sort them by channel
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ Feature: Changing an email of an existing customer
|
|||
And there is a customer "Frodo Baggins" with an email "f.baggins@example.com" and a password "ring"
|
||||
And I am logged in as an administrator
|
||||
|
||||
@ui
|
||||
@ui @api
|
||||
Scenario: Changing an email of an existing customer
|
||||
When I want to edit this customer
|
||||
And I change their email to "strawberry@example.com"
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ Feature: Customer uniqueness of email validation
|
|||
Background:
|
||||
Given I am logged in as an administrator
|
||||
|
||||
@ui
|
||||
@ui @api
|
||||
Scenario: Trying to add a new customer with taken email
|
||||
Given the store has customer "f.baggins@example.com"
|
||||
When I want to create a new customer
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ Feature: Customer validation
|
|||
Background:
|
||||
Given I am logged in as an administrator
|
||||
|
||||
@ui
|
||||
@ui @api
|
||||
Scenario: Trying to add a new customer without an email
|
||||
When I want to create a new customer
|
||||
And I specify their first name as "Luke"
|
||||
|
|
@ -15,7 +15,7 @@ Feature: Customer validation
|
|||
And I try to add them
|
||||
Then I should be notified that email is required
|
||||
|
||||
@ui
|
||||
@ui @api
|
||||
Scenario: Trying to specify too short first name for an existing customer
|
||||
Given the store has customer "l.skywalker@gmail.com"
|
||||
When I want to edit this customer
|
||||
|
|
@ -24,7 +24,7 @@ Feature: Customer validation
|
|||
Then I should be notified that first name should be at least 2 characters long
|
||||
And the customer "l.skywalker@gmail.com" should still have an empty first name
|
||||
|
||||
@ui
|
||||
@ui @api
|
||||
Scenario: Trying to specify too short last name for an existing customer
|
||||
Given the store has customer "l.skywalker@gmail.com" with first name "Luke"
|
||||
When I want to edit this customer
|
||||
|
|
@ -33,7 +33,7 @@ Feature: Customer validation
|
|||
Then I should be notified that last name should be at least 2 characters long
|
||||
And the customer "l.skywalker@gmail.com" should still have an empty last name
|
||||
|
||||
@ui
|
||||
@ui @api
|
||||
Scenario: Trying to remove email from an existing customer
|
||||
Given the store has customer "l.skywalker@gmail.com"
|
||||
When I want to edit this customer
|
||||
|
|
@ -42,7 +42,7 @@ Feature: Customer validation
|
|||
Then I should be notified that email is required
|
||||
And the customer "l.skywalker@gmail.com" should still have this email
|
||||
|
||||
@ui
|
||||
@ui @api
|
||||
Scenario: Trying to create customer with wrong email format
|
||||
When I want to create a new customer
|
||||
And I specify their email as "wrongemail"
|
||||
|
|
@ -50,7 +50,7 @@ Feature: Customer validation
|
|||
Then I should be notified that email is not valid
|
||||
And the customer with email "wrongemail" should not appear in the store
|
||||
|
||||
@ui
|
||||
@ui @api
|
||||
Scenario: Trying to create customer with wrong email format in strict mode
|
||||
When I want to create a new customer
|
||||
And I specify their email as "wrongemail@example..com"
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ Feature: Editing a customer
|
|||
Background:
|
||||
Given I am logged in as an administrator
|
||||
|
||||
@ui
|
||||
@ui @api
|
||||
Scenario: Changing first and last name of an existing customer
|
||||
Given the store has customer "Frodo Baggins" with email "f.baggins@example.com"
|
||||
When I want to edit this customer
|
||||
|
|
@ -17,7 +17,7 @@ Feature: Editing a customer
|
|||
Then I should be notified that it has been successfully edited
|
||||
And this customer with name "Jon Snow" should appear in the store
|
||||
|
||||
@ui
|
||||
@ui @api
|
||||
Scenario: Removing first and last name from an existing customer
|
||||
Given the store has customer "Luke Skywalker" with email "l.skywalker@gmail.com"
|
||||
When I want to edit this customer
|
||||
|
|
@ -28,7 +28,7 @@ Feature: Editing a customer
|
|||
And this customer should have an empty first name
|
||||
And this customer should have an empty last name
|
||||
|
||||
@ui
|
||||
@ui @api
|
||||
Scenario: Making an existing customer subscribed to the newsletter
|
||||
Given the store has customer "Mike Ross" with email "ross@teammike.com"
|
||||
When I want to edit this customer
|
||||
|
|
@ -37,7 +37,7 @@ Feature: Editing a customer
|
|||
Then I should be notified that it has been successfully edited
|
||||
And this customer should be subscribed to the newsletter
|
||||
|
||||
@ui
|
||||
@ui @api
|
||||
Scenario: Selecting a group for an existing customer
|
||||
Given the store has a customer group "Retail"
|
||||
And the store has customer "Mike Ross" with email "ross@teammike.com"
|
||||
|
|
|
|||
|
|
@ -9,44 +9,51 @@ Feature: Seeing customer's details
|
|||
And the store has a customer group Retail
|
||||
And the store has customer "f.baggins@shire.me" with name "Frodo Baggins" and phone number "666777888" since "2011-01-10 21:00"
|
||||
|
||||
@ui
|
||||
@ui @api
|
||||
Scenario: Seeing customer's basic information
|
||||
When I view details of the customer "f.baggins@shire.me"
|
||||
Then his name should be "Frodo Baggins"
|
||||
And he should be registered since "2011-01-10 21:00"
|
||||
And he should be registered since "2011-01-10 21:00:00"
|
||||
And his email should be "f.baggins@shire.me"
|
||||
And his phone number should be "666777888"
|
||||
|
||||
@ui
|
||||
@ui @no-api
|
||||
Scenario: Seeing customer's default address
|
||||
Given the store operates in "New Zealand"
|
||||
And their default address is "Hobbiton", "Bag End", "1", "New Zealand" for "Frodo Baggins"
|
||||
When I view details of the customer "f.baggins@shire.me"
|
||||
Then his default address should be "Frodo Baggins, Bag End, Hobbiton, NEW ZEALAND 1"
|
||||
|
||||
@ui
|
||||
@api @no-ui
|
||||
Scenario: Seeing customer's default address
|
||||
Given the store operates in "New Zealand"
|
||||
And their default address is "Hobbiton", "Bag End", "1", "New Zealand" for "Frodo Baggins"
|
||||
When I view details of the customer "f.baggins@shire.me"
|
||||
Then his default address should be "Frodo" "Baggins", "Bag End", "1" "Hobbiton", "NZ"
|
||||
|
||||
@ui @api
|
||||
Scenario: Seeing information about no existing account for a given customer
|
||||
When I view details of the customer "f.baggins@shire.me"
|
||||
Then I should see information about no existing account for this customer
|
||||
|
||||
@ui
|
||||
@ui @api
|
||||
Scenario: Seeing information about subscription to the newsletter
|
||||
Given the customer subscribed to the newsletter
|
||||
When I view details of the customer "f.baggins@shire.me"
|
||||
Then I should see that this customer is subscribed to the newsletter
|
||||
|
||||
@ui
|
||||
@ui @api
|
||||
Scenario: Seeing information about customer groups
|
||||
Given the customer belongs to group "Retail"
|
||||
When I view details of the customer "f.baggins@shire.me"
|
||||
Then this customer should have "Retail" as their group
|
||||
|
||||
@ui
|
||||
@ui @api
|
||||
Scenario: Not Seeing information about email verification for not registered customer
|
||||
When I view details of the customer "f.baggins@shire.me"
|
||||
Then I should not see information about email verification
|
||||
|
||||
@ui
|
||||
@ui @api
|
||||
Scenario: Seeing information about verified email for registered customer
|
||||
Given there is a customer "Legolas Sindar" identified by an email "legolas@woodland.rm" and a password "takingTheHobbitsToIsengard"
|
||||
And this customer verified their email
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Feature: Seeing a province on customer's details
|
|||
As an Administrator
|
||||
I want to be able to see specific customer's page with provinces in the addresses
|
||||
|
||||
@ui
|
||||
@ui @api
|
||||
Scenario: Seeing customer's addresses
|
||||
Given the store operates in "United Kingdom"
|
||||
And the store has customer "f.baggins@shire.me" with name "Frodo Baggins" since "2011-01-10 21:00"
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ Feature: Toggling a customer account
|
|||
Background:
|
||||
Given I am logged in as an administrator
|
||||
|
||||
@ui
|
||||
@ui @api
|
||||
Scenario: Enabling a customer account
|
||||
Given there is disabled customer account "f.baggins@example.com" with password "psw"
|
||||
When I want to enable "f.baggins@example.com"
|
||||
|
|
@ -16,7 +16,7 @@ Feature: Toggling a customer account
|
|||
Then I should be notified that it has been successfully edited
|
||||
And this customer should be enabled
|
||||
|
||||
@ui
|
||||
@ui @api
|
||||
Scenario: Disabling a customer account
|
||||
Given there is enabled customer account "f.baggins@example.com" with password "psw"
|
||||
When I want to disable "f.baggins@example.com"
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ Feature: Toggling a customer account
|
|||
Background:
|
||||
Given I am logged in as an administrator
|
||||
|
||||
@ui
|
||||
@ui @api
|
||||
Scenario: Verifying customer account
|
||||
Given there is enabled customer account "f.baggins@example.com" with password "psw"
|
||||
When I want to verify "f.baggins@example.com"
|
||||
|
|
|
|||
|
|
@ -42,6 +42,9 @@ final class ManagingCustomersContext implements Context
|
|||
|
||||
/**
|
||||
* @When /^I want to edit (this customer)$/
|
||||
* @When I want to enable :customer
|
||||
* @When I want to disable :customer
|
||||
* @When I want to verify :customer
|
||||
*/
|
||||
public function iWantToEditThisCustomer(CustomerInterface $customer): void
|
||||
{
|
||||
|
|
@ -49,28 +52,38 @@ final class ManagingCustomersContext implements Context
|
|||
}
|
||||
|
||||
/**
|
||||
* @When I specify their email as :name
|
||||
* @When I do not specify their email
|
||||
* @When I browse orders of a customer :customer
|
||||
*/
|
||||
public function iSpecifyItsEmailAs(?string $email = null): void
|
||||
public function iBrowseOrdersOfACustomer(CustomerInterface $customer): void
|
||||
{
|
||||
if (null !== $email) {
|
||||
$this->client->addRequestData('email', $email);
|
||||
}
|
||||
$this->client->subResourceIndex(Resources::CUSTOMERS, 'orders', (string) $customer->getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I specify their first name as :name
|
||||
* @When I specify their email as :email
|
||||
* @When I do not specify their email
|
||||
* @When I change their email to :email
|
||||
* @When I remove its email
|
||||
*/
|
||||
public function iSpecifyTheirFirstNameAs(string $name): void
|
||||
public function iChangeTheirEmailTo(?string $email = null): void
|
||||
{
|
||||
$this->client->addRequestData('email', (string) $email);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^I specify (?:their|his) first name as "([^"]*)"$/
|
||||
* @When I remove its first name
|
||||
*/
|
||||
public function iSpecifyTheirFirstNameAs(?string $name = null): void
|
||||
{
|
||||
$this->client->addRequestData('firstName', $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I specify their last name as :name
|
||||
* @When /^I specify (?:their|his) last name as "([^"]*)"$/
|
||||
* @When I remove its last name
|
||||
*/
|
||||
public function iSpecifyTheirLastNameAs(string $name): void
|
||||
public function iSpecifyTheirLastNameAs(?string $name = null): void
|
||||
{
|
||||
$this->client->addRequestData('lastName', $name);
|
||||
}
|
||||
|
|
@ -99,6 +112,14 @@ final class ManagingCustomersContext implements Context
|
|||
$this->client->addRequestData('group', $this->iriConverter->getIriFromItem($customerGroup));
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I make them subscribed to the newsletter
|
||||
*/
|
||||
public function iMakeThemSubscribedToTheNewsletter(): void
|
||||
{
|
||||
$this->client->addRequestData('subscribedToNewsletter', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I choose create account option
|
||||
*/
|
||||
|
|
@ -117,6 +138,36 @@ final class ManagingCustomersContext implements Context
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I enable their account
|
||||
*/
|
||||
public function iEnableIt(): void
|
||||
{
|
||||
$this->client->addRequestData('user', [
|
||||
'enabled' => true,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I disable their account
|
||||
*/
|
||||
public function iDisableIt(): void
|
||||
{
|
||||
$this->client->addRequestData('user', [
|
||||
'enabled' => false,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I verify it
|
||||
*/
|
||||
public function iVerifyIt(): void
|
||||
{
|
||||
$this->client->addRequestData('user', [
|
||||
'verified' => true,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I (try to) add them
|
||||
*/
|
||||
|
|
@ -133,6 +184,15 @@ final class ManagingCustomersContext implements Context
|
|||
$this->client->index(Resources::CUSTOMERS);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I view details of the customer :customer
|
||||
* @When /^I view (their) details$/
|
||||
*/
|
||||
public function iViewDetailsOfTheCustomer(CustomerInterface $customer): void
|
||||
{
|
||||
$this->client->show(Resources::CUSTOMERS, (string) $customer->getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I do not specify any information
|
||||
*/
|
||||
|
|
@ -160,6 +220,50 @@ final class ManagingCustomersContext implements Context
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^I should be notified that ([^"]+) is required$/
|
||||
*/
|
||||
public function iShouldBeNotifiedThatIsRequired(string $element): void
|
||||
{
|
||||
Assert::contains(
|
||||
$this->responseChecker->getError($this->client->getLastResponse()),
|
||||
sprintf('Please enter your %s.', $element),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then I should be notified that email must be unique
|
||||
*/
|
||||
public function iShouldBeNotifiedThatEmailMustBeUnique(): void
|
||||
{
|
||||
Assert::contains(
|
||||
$this->responseChecker->getError($this->client->getLastResponse()),
|
||||
'email: This email is already used.',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^I should be notified that ([^"]+) should be ([^"]+)$/
|
||||
*/
|
||||
public function iShouldBeNotifiedThatTheElementShouldBe($elementName, $validationMessage): void
|
||||
{
|
||||
Assert::contains(
|
||||
$this->responseChecker->getError($this->client->getLastResponse()),
|
||||
sprintf('%s must be %s.', ucfirst($elementName), $validationMessage),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then I should be notified that email is not valid
|
||||
*/
|
||||
public function iShouldBeNotifiedThatEmailIsNotValid(): void
|
||||
{
|
||||
Assert::contains(
|
||||
$this->responseChecker->getError($this->client->getLastResponse()),
|
||||
'This email is invalid.',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the customer :customer should appear in the store
|
||||
* @Then the customer :customer should still have this email
|
||||
|
|
@ -205,13 +309,247 @@ final class ManagingCustomersContext implements Context
|
|||
}
|
||||
|
||||
/**
|
||||
* @Then /^I should be notified that ([^"]+) is required$/
|
||||
* @Then I should see a single order in the list
|
||||
*/
|
||||
public function iShouldBeNotifiedThatIsRequired(string $element): void
|
||||
public function iShouldSeeASingleOrderInTheList(): void
|
||||
{
|
||||
Assert::contains(
|
||||
$this->responseChecker->getError($this->client->getLastResponse()),
|
||||
sprintf('Please enter your %s.', $element),
|
||||
Assert::same($this->responseChecker->countCollectionItems($this->client->getLastResponse()), 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then his name should be :name
|
||||
*/
|
||||
public function hisNameShouldBe(string $name): void
|
||||
{
|
||||
Assert::true($this->responseChecker->hasValue($this->client->getLastResponse(), 'fullName', $name));
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then he should be registered since :registrationDate
|
||||
*/
|
||||
public function hisRegistrationDateShouldBe(string $registrationDate): void
|
||||
{
|
||||
Assert::true($this->responseChecker->hasValue($this->client->getLastResponse(), 'createdAt', $registrationDate));
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then his email should be :email
|
||||
*/
|
||||
public function hisEmailShouldBe(string $email): void
|
||||
{
|
||||
Assert::true($this->responseChecker->hasValue($this->client->getLastResponse(), 'email', $email));
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then his phone number should be :phoneNumber
|
||||
*/
|
||||
public function hisPhoneNumberShouldBe(string $phoneNumber): void
|
||||
{
|
||||
Assert::true($this->responseChecker->hasValue($this->client->getLastResponse(), 'phoneNumber', $phoneNumber));
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then his default address should be :firstName :lastName, :street, :postcode :city, :countryCode
|
||||
*/
|
||||
public function hisSDefaultAddressShouldBe(
|
||||
string $firstName,
|
||||
string $lastName,
|
||||
string $street,
|
||||
string $postcode,
|
||||
string $city,
|
||||
string $countryCode,
|
||||
): void {
|
||||
$this->client->showByIri($this->responseChecker->getValue($this->client->getLastResponse(), 'defaultAddress'));
|
||||
|
||||
Assert::same($this->responseChecker->getValue($this->client->getLastResponse(), 'firstName'), $firstName);
|
||||
Assert::same($this->responseChecker->getValue($this->client->getLastResponse(), 'lastName'), $lastName);
|
||||
Assert::same($this->responseChecker->getValue($this->client->getLastResponse(), 'street'), $street);
|
||||
Assert::same($this->responseChecker->getValue($this->client->getLastResponse(), 'postcode'), $postcode);
|
||||
Assert::same($this->responseChecker->getValue($this->client->getLastResponse(), 'city'), $city);
|
||||
Assert::same($this->responseChecker->getValue($this->client->getLastResponse(), 'countryCode'), $countryCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the province in the default address should be :provinceName
|
||||
*/
|
||||
public function theProvinceInTheDefaultAddressShouldBe(string $provinceName): void
|
||||
{
|
||||
$this->client->showByIri($this->responseChecker->getValue($this->client->getLastResponse(), 'defaultAddress'));
|
||||
Assert::same($this->responseChecker->getValue($this->client->getLastResponse(), 'provinceName'), $provinceName);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then I should see information about no existing account for this customer
|
||||
* @Then I should not see information about email verification
|
||||
*/
|
||||
public function iShouldSeeInformationAboutNoExistingAccountForThisCustomer(): void
|
||||
{
|
||||
Assert::null($this->responseChecker->getValue($this->client->getLastResponse(), 'user'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then I should see that this customer has verified the email
|
||||
*/
|
||||
public function iShouldSeeThatThisCustomerHasVerifiedTheEmail(): void
|
||||
{
|
||||
$user = $this->responseChecker->getValue($this->client->getLastResponse(), 'user');
|
||||
Assert::true($user['verified']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then I should see the order with number :orderNumber in the list
|
||||
*/
|
||||
public function iShouldSeeASingleOrderFromCustomer(string $orderNumber): void
|
||||
{
|
||||
Assert::true(
|
||||
$this->responseChecker->hasItemWithValue(
|
||||
$this->client->getLastResponse(),
|
||||
'number',
|
||||
$orderNumber,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then I should not see the order with number :orderNumber in the list
|
||||
*/
|
||||
public function iShouldNotSeeASingleOrderFromCustomer(string $orderNumber): void
|
||||
{
|
||||
Assert::false(
|
||||
$this->responseChecker->hasItemWithValue(
|
||||
$this->client->getLastResponse(),
|
||||
'number',
|
||||
$orderNumber,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^(this customer) should be enabled$/
|
||||
*/
|
||||
public function thisCustomerShouldBeEnabled(CustomerInterface $customer): 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']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^(this customer) should be verified$/
|
||||
*/
|
||||
public function thisCustomerShouldBeVerified(CustomerInterface $customer): void
|
||||
{
|
||||
$user = $this->responseChecker->getValue(
|
||||
$this->client->show(Resources::CUSTOMERS, (string) $customer->getId()),
|
||||
'user',
|
||||
);
|
||||
Assert::true($user['verified']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then there should still be only one customer with email :email
|
||||
*/
|
||||
public function thereShouldStillBeOnlyOneCustomerWithEmail(string $email): void
|
||||
{
|
||||
Assert::count(
|
||||
$this->responseChecker->getCollectionItemsWithValue($this->client->index(Resources::CUSTOMERS), 'email', $email),
|
||||
1,
|
||||
sprintf('There is more than one customer with email %s', $email),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^(this customer) should have an empty first name$/
|
||||
* @Then the customer :customer should still have an empty first name
|
||||
*/
|
||||
public function theCustomerShouldStillHaveAnEmptyFirstName(CustomerInterface $customer): void
|
||||
{
|
||||
Assert::null(
|
||||
$this->responseChecker->getValue(
|
||||
$this->client->show(Resources::CUSTOMERS, (string) $customer->getId()),
|
||||
'firstName',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^(this customer) should have an empty last name$/
|
||||
* @Then the customer :customer should still have an empty last name
|
||||
*/
|
||||
public function theCustomerShouldStillHaveAnEmptyLastName(CustomerInterface $customer): void
|
||||
{
|
||||
Assert::null(
|
||||
$this->responseChecker->getValue(
|
||||
$this->client->show(Resources::CUSTOMERS, (string) $customer->getId()),
|
||||
'lastName',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the customer with email :email should not appear in the store
|
||||
*/
|
||||
public function theCustomerShouldNotAppearInTheStore(string $email): void
|
||||
{
|
||||
Assert::false(
|
||||
$this->responseChecker->hasItemWithValue(
|
||||
$this->client->index(Resources::CUSTOMERS),
|
||||
'email',
|
||||
$email,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^(this customer) with name "([^"]*)" should appear in the store$/
|
||||
*/
|
||||
public function theCustomerWithNameShouldAppearInTheRegistry(CustomerInterface $customer, string $name): void
|
||||
{
|
||||
Assert::true(
|
||||
$this->responseChecker->hasValue(
|
||||
$this->client->show(Resources::CUSTOMERS, (string) $customer->getId()),
|
||||
'fullName',
|
||||
$name,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then this customer should be subscribed to the newsletter
|
||||
* @Then I should see that this customer is subscribed to the newsletter
|
||||
*/
|
||||
public function thisCustomerShouldBeSubscribedToTheNewsletter(): void
|
||||
{
|
||||
Assert::true(
|
||||
$this->responseChecker->getValue(
|
||||
$this->client->getLastResponse(),
|
||||
'subscribedToNewsletter',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then this customer should have :customerGroup as their group
|
||||
*/
|
||||
public function thisCustomerShouldHaveAsTheirGroup(CustomerGroupInterface $customerGroup): void
|
||||
{
|
||||
Assert::same(
|
||||
$this->responseChecker->getValue($this->client->getLastResponse(), 'group'),
|
||||
$this->iriConverter->getIriFromItem($customerGroup),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,17 +7,30 @@ default:
|
|||
contexts:
|
||||
- sylius.behat.context.hook.doctrine_orm
|
||||
|
||||
- sylius.behat.context.transform.address
|
||||
- sylius.behat.context.transform.customer
|
||||
- sylius.behat.context.transform.customer_group
|
||||
- sylius.behat.context.transform.payment
|
||||
- sylius.behat.context.transform.product
|
||||
- sylius.behat.context.transform.shared_storage
|
||||
- sylius.behat.context.transform.shipping_method
|
||||
|
||||
- sylius.behat.context.setup.address
|
||||
- sylius.behat.context.setup.admin_api_security
|
||||
- sylius.behat.context.setup.channel
|
||||
- sylius.behat.context.setup.customer
|
||||
- sylius.behat.context.setup.customer_group
|
||||
- sylius.behat.context.setup.geographical
|
||||
- sylius.behat.context.setup.order
|
||||
- sylius.behat.context.setup.payment
|
||||
- sylius.behat.context.setup.product
|
||||
- sylius.behat.context.setup.shipping
|
||||
|
||||
- sylius.behat.context.api.admin.managing_customers
|
||||
- sylius.behat.context.api.admin.response
|
||||
- sylius.behat.context.api.admin.save
|
||||
|
||||
- sylius.behat.context.api.shop.login
|
||||
|
||||
filters:
|
||||
tags: "@managing_customers&&@api"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue