mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 17:10:53 +00:00
[Admin][Customer] Implement checking subscription to the newsletter on the customer show page
This commit is contained in:
parent
e6baa9e796
commit
3762d5c951
7 changed files with 51 additions and 1 deletions
|
|
@ -28,7 +28,7 @@ Feature: Seeing customer's details
|
|||
When I view details of the customer "f.baggins@shire.me"
|
||||
Then I should see information about no existing account for this customer
|
||||
|
||||
@todo
|
||||
@ui
|
||||
Scenario: Seeing information about subscribed to the newsletter
|
||||
Given he subscribes to the newsletter
|
||||
When I view details of the customer "f.baggins@shire.me"
|
||||
|
|
|
|||
|
|
@ -229,4 +229,14 @@ final class CustomerContext implements Context
|
|||
$this->sharedStorage->set('customer', $customer);
|
||||
$this->customerRepository->add($customer);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^(he) subscribes to the newsletter$/
|
||||
*/
|
||||
public function heSubscribesToTheNewsletter(CustomerInterface $customer)
|
||||
{
|
||||
$customer->setSubscribedToNewsletter(true);
|
||||
|
||||
$this->customerManager->flush();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -498,4 +498,15 @@ final class ManagingCustomersContext implements Context
|
|||
'There should be information about no account, but there is none.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then I should see that this customer subscribes to the newsletter
|
||||
*/
|
||||
public function iShouldSeeThatThisCustomerSubscribesToTheNewsletter()
|
||||
{
|
||||
Assert::true(
|
||||
$this->showPage->isSubscribedToNewsletter(),
|
||||
'There should be information that this customer subscribes to the newsletter.'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,6 +86,19 @@ class ShowPage extends SymfonyPage implements ShowPageInterface
|
|||
return $this->hasElement('no_account');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isSubscribedToNewsletter()
|
||||
{
|
||||
$subscribedToNewsletter = $this->getElement('subscribed_to_newsletter');
|
||||
if ($subscribedToNewsletter->find('css', 'i.green')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
@ -107,6 +120,7 @@ class ShowPage extends SymfonyPage implements ShowPageInterface
|
|||
'no_account' => '#no-account',
|
||||
'registration_date' => '#info .content .date',
|
||||
'shipping_address' => '#shippingAddress address',
|
||||
'subscribed_to_newsletter' => '#subscribed-to-newsletter',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,4 +63,9 @@ interface ShowPageInterface extends PageInterface
|
|||
* @return bool
|
||||
*/
|
||||
public function hasAccount();
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isSubscribedToNewsletter();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,6 +36,15 @@
|
|||
<div class="meta">
|
||||
<span class="date">{{ 'sylius.ui.customer_since'|trans }} {{ customer.createdAt|date }}</span>
|
||||
</div>
|
||||
<br />
|
||||
<div id="subscribed-to-newsletter">
|
||||
{% if customer.subscribedToNewsletter %}
|
||||
<i class="green checkmark icon"></i>
|
||||
{% else %}
|
||||
<i class="red remove icon"></i>
|
||||
{% endif %}
|
||||
{{ 'sylius.ui.subscribed_to_newsletter'|trans }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="extra content">
|
||||
<a href="mailto: {{ customer.email }}">
|
||||
|
|
|
|||
|
|
@ -661,6 +661,7 @@ sylius:
|
|||
street: Street
|
||||
string_blocks: 'String blocks'
|
||||
subject: Subject
|
||||
subscribed_to_newsletter: Subscribe to the newsletter
|
||||
subtotal: Subtotal
|
||||
success: Success
|
||||
summary: Summary
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue