Skip to content

Commit

Permalink
[Behat] Create shopBillingData by default in channel setup step
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMilek committed Oct 31, 2023
1 parent 7516adc commit 4004fa3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

use Sylius\Component\Channel\Factory\ChannelFactoryInterface;
use Sylius\Component\Core\Model\ChannelInterface;
use Sylius\Component\Core\Model\ShopBillingData;
use Sylius\Component\Currency\Model\CurrencyInterface;
use Sylius\Component\Locale\Model\LocaleInterface;
use Sylius\Component\Resource\Factory\FactoryInterface;
Expand Down Expand Up @@ -54,6 +55,9 @@ public function create(?string $code = null, ?string $name = null, ?string $curr

$channel->addLocale($locale);
$channel->setDefaultLocale($locale);
if ($channel->getShopBillingData() === null) {
$channel->setShopBillingData(new ShopBillingData());
}

$this->channelRepository->add($channel);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use PhpSpec\ObjectBehavior;
use Sylius\Component\Channel\Factory\ChannelFactoryInterface;
use Sylius\Component\Core\Model\ChannelInterface;
use Sylius\Component\Core\Model\ShopBillingData;
use Sylius\Component\Core\Test\Services\DefaultChannelFactoryInterface;
use Sylius\Component\Currency\Model\CurrencyInterface;
use Sylius\Component\Locale\Model\LocaleInterface;
Expand Down Expand Up @@ -74,6 +75,8 @@ function it_creates_a_default_channel_and_persist_it(
$channel->setBaseCurrency($currency)->shouldBeCalled();
$channel->addLocale($locale)->shouldBeCalled();
$channel->setDefaultLocale($locale)->shouldBeCalled();
$channel->getShopBillingData()->willReturn(null);
$channel->setShopBillingData(new ShopBillingData())->shouldBeCalled();

$currencyRepository->findOneBy(['code' => 'USD'])->willReturn(null);
$localeRepository->findOneBy(['code' => 'en_US'])->willReturn(null);
Expand Down

0 comments on commit 4004fa3

Please sign in to comment.