forked from Sylius/Sylius
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
240 additions
and
24 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
features/channel/managing_channels/adding_channel_with_shop_billing_data.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
@managing_channels | ||
Feature: Adding a new channel with shop billing data | ||
In order to sell through multiple channels of distributions with specific billing data | ||
As an Administrator | ||
I want to add a new channel with shop billing data to the registry | ||
|
||
Background: | ||
Given the store has currency "Euro" | ||
And the store has locale "English (United States)" | ||
And I am logged in as an administrator | ||
|
||
@ui | ||
Scenario: Adding a new channel with shop billing data | ||
Given I want to create a new channel | ||
When I specify its code as "MOBILE" | ||
And I name it "Mobile channel" | ||
And I choose "Euro" as the base currency | ||
And I choose "English (United States)" as a default locale | ||
And I specify company as "Ragnarok" | ||
And I specify tax ID as "1100110011" | ||
And I specify shop billing address as "Pacific Coast Hwy", "90806" "Los Angeles", "United States" | ||
And I add it | ||
Then I should be notified that it has been successfully created | ||
And the channel "Mobile channel" should appear in the registry |
22 changes: 22 additions & 0 deletions
22
features/channel/managing_channels/editing_shop_billing_data_on_channel.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
@managing_channels | ||
Feature: Editing shop billing data on channel | ||
In order to have proper shop billing data on shop-related documents | ||
As an Administrator | ||
I want to be able to edit shop billing data on a channel | ||
|
||
Background: | ||
Given the store operates on a channel named "Web Store" | ||
And the store ships to "United States" | ||
And I am logged in as an administrator | ||
|
||
@ui | ||
Scenario: Editing shop billing data on channel | ||
When I want to modify a channel "Web Store" | ||
And I specify company as "Ragnarok" | ||
And I specify tax ID as "1100110011" | ||
And I specify shop billing address as "Pacific Coast Hwy", "90806" "Los Angeles", "United States" | ||
And I save my changes | ||
Then I should be notified that it has been successfully edited | ||
And this channel company should be "Ragnarok" | ||
And this channel tax ID should be "1100110011" | ||
And this channel shop billing address should be "Pacific Coast Hwy", "90806" "Los Angeles", "United States" |
79 changes: 79 additions & 0 deletions
79
src/Sylius/Behat/Context/Ui/Admin/ManagingChannelsBillingDataContext.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Sylius\Behat\Context\Ui\Admin; | ||
|
||
use Behat\Behat\Context\Context; | ||
use Sylius\Behat\Element\Admin\Channel\ShopBillingDataElementInterface; | ||
use Sylius\Component\Addressing\Model\CountryInterface; | ||
use Webmozart\Assert\Assert; | ||
|
||
final class ManagingChannelsBillingDataContext implements Context | ||
{ | ||
/** @var ShopBillingDataElementInterface */ | ||
private $shopBillingDataElement; | ||
|
||
public function __construct(ShopBillingDataElementInterface $shopBillingDataElement) | ||
{ | ||
$this->shopBillingDataElement = $shopBillingDataElement; | ||
} | ||
|
||
/** | ||
* @When I specify company as :company | ||
*/ | ||
public function specifyCompanyAs(string $company): void | ||
{ | ||
$this->shopBillingDataElement->specifyCompany($company); | ||
} | ||
|
||
/** | ||
* @When I specify tax ID as :taxId | ||
*/ | ||
public function specifyTaxIdAs(string $taxId): void | ||
{ | ||
$this->shopBillingDataElement->specifyTaxId($taxId); | ||
} | ||
|
||
/** | ||
* @When I specify shop billing address as :street, :postcode :city, :country | ||
*/ | ||
public function specifyShopBillingAddressAs( | ||
string $street, | ||
string $postcode, | ||
string $city, | ||
CountryInterface $country | ||
): void | ||
{ | ||
$this->shopBillingDataElement->specifyBillingAddress($street, $postcode, $city, $country->getCode()); | ||
} | ||
|
||
/** | ||
* @Then this channel company should be :company | ||
*/ | ||
public function thisChannelCompanyShouldBe(string $company): void | ||
{ | ||
Assert::true($this->shopBillingDataElement->hasCompany($company)); | ||
} | ||
|
||
/** | ||
* @Then this channel tax ID should be :taxId | ||
*/ | ||
public function thisChanneTaxIdShouldBe(string $taxId): void | ||
{ | ||
Assert::true($this->shopBillingDataElement->hasTaxId($taxId)); | ||
} | ||
|
||
/** | ||
* @Then this channel shop billing address should be :street, :postcode :city, :country | ||
*/ | ||
public function thisChannelShopBillingAddressShouldBe( | ||
string $street, | ||
string $postcode, | ||
string $city, | ||
CountryInterface $country | ||
): void | ||
{ | ||
Assert::true($this->shopBillingDataElement->hasBillingAddress($street, $postcode, $city, $country->getCode())); | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
src/Sylius/Behat/Element/Admin/Channel/ShopBillingDataElement.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Sylius\Behat\Element\Admin\Channel; | ||
|
||
use FriendsOfBehat\PageObjectExtension\Element\Element; | ||
|
||
final class ShopBillingDataElement extends Element implements ShopBillingDataElementInterface | ||
{ | ||
public function specifyCompany(string $company): void | ||
{ | ||
$this->getElement('company')->setValue($company); | ||
} | ||
|
||
public function specifyTaxId(string $taxId): void | ||
{ | ||
$this->getElement('tax_id')->setValue($taxId); | ||
} | ||
|
||
public function specifyBillingAddress(string $street, string $postcode, string $city, string $countryCode): void | ||
{ | ||
$this->getElement('street')->setValue($street); | ||
$this->getElement('postcode')->setValue($postcode); | ||
$this->getElement('city')->setValue($city); | ||
$this->getElement('country_code')->setValue($countryCode); | ||
} | ||
|
||
public function hasCompany(string $company): bool | ||
{ | ||
return $company === $this->getElement('company')->getValue(); | ||
} | ||
|
||
public function hasTaxId(string $taxId): bool | ||
{ | ||
return $taxId === $this->getElement('tax_id')->getValue(); | ||
} | ||
|
||
public function hasBillingAddress(string $street, string $postcode, string $city, string $countryCode): bool | ||
{ | ||
return | ||
$street === $this->getElement('street')->getValue() && | ||
$postcode === $this->getElement('postcode')->getValue() && | ||
$city === $this->getElement('city')->getValue() && | ||
$countryCode === $this->getElement('country_code')->getValue() | ||
; | ||
} | ||
|
||
protected function getDefinedElements(): array | ||
{ | ||
return array_merge(parent::getDefinedElements(), [ | ||
'city' => '#sylius_channel_billingData_city', | ||
'company' => '#sylius_channel_billingData_company', | ||
'country_code' => '#sylius_channel_billingData_countryCode', | ||
'postcode' => '#sylius_channel_billingData_postcode', | ||
'street' => '#sylius_channel_billingData_street', | ||
'tax_id' => '#sylius_channel_billingData_taxId', | ||
]); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
src/Sylius/Behat/Element/Admin/Channel/ShopBillingDataElementInterface.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Sylius\Behat\Element\Admin\Channel; | ||
|
||
interface ShopBillingDataElementInterface | ||
{ | ||
public function specifyCompany(string $company): void; | ||
|
||
public function specifyTaxId(string $taxId): void; | ||
|
||
public function specifyBillingAddress(string $street, string $postcode, string $city, string $countryCode): void; | ||
|
||
public function hasCompany(string $company): bool; | ||
|
||
public function hasTaxId(string $taxId): bool; | ||
|
||
public function hasBillingAddress(string $street, string $postcode, string $city, string $countryCode): bool; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters