Improve shop billing data edit scenario

This commit is contained in:
Mateusz Zalewski 2019-02-20 18:51:29 +01:00
parent c188f7385b
commit add3655ae9
No known key found for this signature in database
GPG key ID: 0545A7503DD474B8
2 changed files with 34 additions and 6 deletions

View file

@ -7,16 +7,17 @@ Feature: Editing shop billing data on channel
Background: Background:
Given the store operates on a channel named "Web Store" Given the store operates on a channel named "Web Store"
And the store ships to "United States" And the store ships to "United States"
And channel "Web Store" billing data is "Ragnarok", "Pacific Coast Hwy", "90806" "Los Angeles", "United States" with "1100110011" tax ID
And I am logged in as an administrator And I am logged in as an administrator
@ui @ui
Scenario: Editing shop billing data on channel Scenario: Editing shop billing data on channel
When I want to modify a channel "Web Store" When I want to modify a channel "Web Store"
And I specify company as "Ragnarok" And I specify company as "Götterdämmerung"
And I specify tax ID as "1100110011" And I specify tax ID as "666777"
And I specify shop billing address as "Pacific Coast Hwy", "90806" "Los Angeles", "United States" And I specify shop billing address as "Valhalla", "123" "Asgard", "United States"
And I save my changes And I save my changes
Then I should be notified that it has been successfully edited Then I should be notified that it has been successfully edited
And this channel company should be "Ragnarok" And this channel company should be "Götterdämmerung"
And this channel tax ID should be "1100110011" And this channel tax ID should be "666777"
And this channel shop billing address should be "Pacific Coast Hwy", "90806" "Los Angeles", "United States" And this channel shop billing address should be "Valhalla", "123" "Asgard", "United States"

View file

@ -16,10 +16,12 @@ namespace Sylius\Behat\Context\Setup;
use Behat\Behat\Context\Context; use Behat\Behat\Context\Context;
use Doctrine\Common\Persistence\ObjectManager; use Doctrine\Common\Persistence\ObjectManager;
use Sylius\Behat\Service\SharedStorageInterface; use Sylius\Behat\Service\SharedStorageInterface;
use Sylius\Component\Addressing\Model\CountryInterface;
use Sylius\Component\Addressing\Model\ZoneInterface; use Sylius\Component\Addressing\Model\ZoneInterface;
use Sylius\Component\Channel\Repository\ChannelRepositoryInterface; use Sylius\Component\Channel\Repository\ChannelRepositoryInterface;
use Sylius\Component\Core\Formatter\StringInflector; use Sylius\Component\Core\Formatter\StringInflector;
use Sylius\Component\Core\Model\ChannelInterface; use Sylius\Component\Core\Model\ChannelInterface;
use Sylius\Component\Core\Model\ShopBillingData;
use Sylius\Component\Core\Test\Services\DefaultChannelFactoryInterface; use Sylius\Component\Core\Test\Services\DefaultChannelFactoryInterface;
final class ChannelContext implements Context final class ChannelContext implements Context
@ -186,6 +188,31 @@ final class ChannelContext implements Context
$this->channelManager->flush(); $this->channelManager->flush();
} }
/**
* @Given channel :channel billing data is :company, :street, :postcode :city, :country with :taxId tax ID
*/
public function channelBillingDataIs(
ChannelInterface $channel,
string $company,
string $street,
string $postcode,
string $city,
CountryInterface $country,
string $taxId
): void {
$shopBillingData = new ShopBillingData();
$shopBillingData->setCompany($company);
$shopBillingData->setStreet($street);
$shopBillingData->setPostcode($postcode);
$shopBillingData->setCity($city);
$shopBillingData->setCountryCode($country->getCode());
$shopBillingData->setTaxId($taxId);
$channel->setShopBillingData($shopBillingData);
$this->channelManager->flush();
}
/** /**
* @param bool $state * @param bool $state
*/ */