-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #93 from BitBagCommerce/release/20230707
Release 20230707
- Loading branch information
Showing
122 changed files
with
5,753 additions
and
10 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<?php | ||
|
||
/* | ||
* This file was created by developers working at BitBag | ||
* Do you need more information about us and what we do? Visit our https://bitbag.io website! | ||
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace spec\BitBag\SyliusVueStorefront2Plugin\Controller; | ||
|
||
use BitBag\SyliusVueStorefront2Plugin\Controller\ThankYouPageController; | ||
use PhpSpec\ObjectBehavior; | ||
use Symfony\Component\HttpFoundation\RedirectResponse; | ||
use Symfony\Component\HttpFoundation\Request; | ||
use Symfony\Component\Routing\RouterInterface; | ||
|
||
final class ThankYouPageControllerSpec extends ObjectBehavior | ||
{ | ||
private const VSF2_HOST = 'http://localhost/'; | ||
|
||
public function let(RouterInterface $router): void | ||
{ | ||
$this->beConstructedWith(self::VSF2_HOST, $router); | ||
} | ||
|
||
public function it_is_initializable(): void | ||
{ | ||
$this->shouldHaveType(ThankYouPageController::class); | ||
} | ||
|
||
public function it_redirects_to_homepage_if_host_not_provided( | ||
RouterInterface $router, | ||
Request $request, | ||
): void { | ||
$this->beConstructedWith(null, $router); | ||
|
||
$url = '/en_US/'; | ||
$router->generate('sylius_shop_homepage')->willReturn($url); | ||
|
||
$response = $this->redirectAction($request); | ||
|
||
$response->shouldBeAnInstanceOf(RedirectResponse::class); | ||
$response->getTargetUrl()->shouldReturn($url); | ||
} | ||
|
||
public function it_redirects_to_homepage_if_order_number_is_not_provided( | ||
RouterInterface $router, | ||
): void { | ||
$attributes = []; | ||
$request = new Request([], [], $attributes); | ||
|
||
$url = '/en_US/'; | ||
$router->generate('sylius_shop_homepage')->willReturn($url); | ||
|
||
$response = $this->redirectAction($request); | ||
|
||
$response->shouldBeAnInstanceOf(RedirectResponse::class); | ||
$response->getTargetUrl()->shouldReturn($url); | ||
} | ||
|
||
function it_redirects_to_thank_you_page(): void | ||
{ | ||
$locale = 'de_DE'; | ||
$orderNumber = '123'; | ||
$request = new Request(['locale' => $locale], [], ['orderNumber' => $orderNumber]); | ||
|
||
$url = sprintf( | ||
'%s/%s/checkout/thank-you?order=%s', | ||
self::VSF2_HOST, | ||
locale_get_primary_language($locale), | ||
$orderNumber | ||
); | ||
|
||
$response = $this->redirectAction($request); | ||
|
||
$response->shouldBeAnInstanceOf(RedirectResponse::class); | ||
$response->getTargetUrl()->shouldReturn($url); | ||
} | ||
} |
108 changes: 108 additions & 0 deletions
108
spec/DataGenerator/ContextModel/DataGeneratorCommandContextSpec.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,108 @@ | ||
<?php | ||
|
||
/* | ||
* This file was created by developers working at BitBag | ||
* Do you need more information about us and what we do? Visit our https://bitbag.io website! | ||
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace spec\BitBag\SyliusVueStorefront2Plugin\DataGenerator\ContextModel; | ||
|
||
use BitBag\SyliusVueStorefront2Plugin\DataGenerator\ContextModel\DataGeneratorCommandContext; | ||
use PhpSpec\ObjectBehavior; | ||
use Sylius\Component\Core\Model\ChannelInterface; | ||
use Symfony\Component\Console\Style\SymfonyStyle; | ||
|
||
final class DataGeneratorCommandContextSpec extends ObjectBehavior | ||
{ | ||
private const PRODUCTS_QTY = 100; | ||
|
||
private const TAXONS_QTY = 200; | ||
|
||
private const WISHLISTS_QTY = 300; | ||
|
||
private const PRODUCTS_PER_TAXON_QTY = 400; | ||
|
||
private const MAX_TAXON_LEVEL = 500; | ||
|
||
private const MAX_CHILDREN_PER_TAXON_LEVEL = 600; | ||
|
||
private const PRODUCTS_PER_WISHLIST_QTY = 700; | ||
|
||
private const STRESS = 25; | ||
|
||
public function let( | ||
SymfonyStyle $io, | ||
ChannelInterface $channel, | ||
): void { | ||
$this->beConstructedWith( | ||
$io, | ||
$channel, | ||
self::PRODUCTS_QTY, | ||
self::TAXONS_QTY, | ||
self::WISHLISTS_QTY, | ||
self::PRODUCTS_PER_TAXON_QTY, | ||
self::MAX_TAXON_LEVEL, | ||
self::MAX_CHILDREN_PER_TAXON_LEVEL, | ||
self::PRODUCTS_PER_WISHLIST_QTY, | ||
self::STRESS, | ||
); | ||
} | ||
|
||
public function it_is_initializable(): void | ||
{ | ||
$this->shouldHaveType(DataGeneratorCommandContext::class); | ||
} | ||
|
||
public function it_returns_io(SymfonyStyle $io): void | ||
{ | ||
$this->getIO()->shouldReturn($io); | ||
} | ||
|
||
public function it_returns_channel(ChannelInterface $channel): void | ||
{ | ||
$this->getChannel()->shouldReturn($channel); | ||
} | ||
|
||
public function it_returns_products_qty(): void | ||
{ | ||
$this->getProductsQty()->shouldReturn(self::PRODUCTS_QTY); | ||
} | ||
|
||
public function it_returns_taxons_qty(): void | ||
{ | ||
$this->getTaxonsQty()->shouldReturn(self::TAXONS_QTY); | ||
} | ||
|
||
public function it_returns_wishlists_qty(): void | ||
{ | ||
$this->getWishlistsQty()->shouldReturn(self::WISHLISTS_QTY); | ||
} | ||
|
||
public function it_returns_products_per_taxon_qty(): void | ||
{ | ||
$this->getProductsPerTaxonQty()->shouldReturn(self::PRODUCTS_PER_TAXON_QTY); | ||
} | ||
|
||
public function it_returns_max_taxon_level(): void | ||
{ | ||
$this->getMaxTaxonLevel()->shouldReturn(self::MAX_TAXON_LEVEL); | ||
} | ||
|
||
public function it_returns_max_children_per_taxon_level(): void | ||
{ | ||
$this->getMaxChildrenPerTaxonLevel()->shouldReturn(self::MAX_CHILDREN_PER_TAXON_LEVEL); | ||
} | ||
|
||
public function it_returns_products_per_wishlist_qty(): void | ||
{ | ||
$this->getProductsPerWishlistQty()->shouldReturn(self::PRODUCTS_PER_WISHLIST_QTY); | ||
} | ||
|
||
public function it_returns_stress(): void | ||
{ | ||
$this->getStress()->shouldReturn(self::STRESS); | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
spec/DataGenerator/ContextModel/Generator/ProductGeneratorContextSpec.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,52 @@ | ||
<?php | ||
|
||
/* | ||
* This file was created by developers working at BitBag | ||
* Do you need more information about us and what we do? Visit our https://bitbag.io website! | ||
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace spec\BitBag\SyliusVueStorefront2Plugin\DataGenerator\ContextModel\Generator; | ||
|
||
use BitBag\SyliusVueStorefront2Plugin\DataGenerator\ContextModel\Generator\ProductGeneratorContext; | ||
use PhpSpec\ObjectBehavior; | ||
use Sylius\Component\Core\Model\ChannelInterface; | ||
use Symfony\Component\Console\Style\SymfonyStyle; | ||
|
||
final class ProductGeneratorContextSpec extends ObjectBehavior | ||
{ | ||
private const QUANTITY = 100; | ||
|
||
public function let( | ||
SymfonyStyle $io, | ||
ChannelInterface $channel, | ||
): void { | ||
$this->beConstructedWith( | ||
$io, | ||
self::QUANTITY, | ||
$channel, | ||
); | ||
} | ||
|
||
public function it_is_initializable(): void | ||
{ | ||
$this->shouldHaveType(ProductGeneratorContext::class); | ||
} | ||
|
||
public function it_returns_io(SymfonyStyle $io): void | ||
{ | ||
$this->getIo()->shouldReturn($io); | ||
} | ||
|
||
public function it_returns_quantity(): void | ||
{ | ||
$this->getQuantity()->shouldReturn(self::QUANTITY); | ||
} | ||
|
||
public function it_returns_channel(ChannelInterface $channel): void | ||
{ | ||
$this->getChannel()->shouldReturn($channel); | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
spec/DataGenerator/ContextModel/Generator/ProductTaxonGeneratorContextSpec.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 | ||
|
||
/* | ||
* This file was created by developers working at BitBag | ||
* Do you need more information about us and what we do? Visit our https://bitbag.io website! | ||
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace spec\BitBag\SyliusVueStorefront2Plugin\DataGenerator\ContextModel\Generator; | ||
|
||
use BitBag\SyliusVueStorefront2Plugin\DataGenerator\ContextModel\Generator\ProductTaxonGeneratorContext; | ||
use PhpSpec\ObjectBehavior; | ||
use Sylius\Component\Core\Model\ChannelInterface; | ||
use Symfony\Component\Console\Style\SymfonyStyle; | ||
|
||
final class ProductTaxonGeneratorContextSpec extends ObjectBehavior | ||
{ | ||
private const QUANTITY = 100; | ||
|
||
private const STRESS = 15; | ||
|
||
public function let( | ||
SymfonyStyle $io, | ||
ChannelInterface $channel, | ||
): void { | ||
$this->beConstructedWith( | ||
$io, | ||
self::QUANTITY, | ||
$channel, | ||
self::STRESS, | ||
); | ||
} | ||
|
||
public function it_is_initializable(): void | ||
{ | ||
$this->shouldHaveType(ProductTaxonGeneratorContext::class); | ||
} | ||
|
||
public function it_returns_io(SymfonyStyle $io): void | ||
{ | ||
$this->getIo()->shouldReturn($io); | ||
} | ||
|
||
public function it_returns_quantity(): void | ||
{ | ||
$this->getQuantity()->shouldReturn(self::QUANTITY); | ||
} | ||
|
||
public function it_returns_channel(ChannelInterface $channel): void | ||
{ | ||
$this->getChannel()->shouldReturn($channel); | ||
} | ||
|
||
public function it_returns_stress(): void | ||
{ | ||
$this->getStress()->shouldReturn(self::STRESS); | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
spec/DataGenerator/ContextModel/Generator/TaxonGeneratorContextSpec.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,59 @@ | ||
<?php | ||
|
||
/* | ||
* This file was created by developers working at BitBag | ||
* Do you need more information about us and what we do? Visit our https://bitbag.io website! | ||
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace spec\BitBag\SyliusVueStorefront2Plugin\DataGenerator\ContextModel\Generator; | ||
|
||
use BitBag\SyliusVueStorefront2Plugin\DataGenerator\ContextModel\Generator\TaxonGeneratorContext; | ||
use PhpSpec\ObjectBehavior; | ||
use Symfony\Component\Console\Style\SymfonyStyle; | ||
|
||
final class TaxonGeneratorContextSpec extends ObjectBehavior | ||
{ | ||
private const QUANTITY = 100; | ||
|
||
private const MAX_TAXON_LEVEL = 10; | ||
|
||
private const MAX_CHILDREN_PER_TAXON_LEVEL = 5; | ||
|
||
public function let(SymfonyStyle $io): void | ||
{ | ||
$this->beConstructedWith( | ||
$io, | ||
self::QUANTITY, | ||
self::MAX_TAXON_LEVEL, | ||
self::MAX_CHILDREN_PER_TAXON_LEVEL, | ||
); | ||
} | ||
|
||
public function it_is_initializable(): void | ||
{ | ||
$this->shouldHaveType(TaxonGeneratorContext::class); | ||
} | ||
|
||
public function it_returns_io(SymfonyStyle $io): void | ||
{ | ||
$this->getIo()->shouldReturn($io); | ||
} | ||
|
||
public function it_returns_quantity(): void | ||
{ | ||
$this->getQuantity()->shouldReturn(self::QUANTITY); | ||
} | ||
|
||
public function it_returns_max_taxon_level(): void | ||
{ | ||
$this->getMaxTaxonLevel()->shouldReturn(self::MAX_TAXON_LEVEL); | ||
} | ||
|
||
public function it_returns_max_children_per_taxon_level(): void | ||
{ | ||
$this->getMaxChildrenPerTaxonLevel()->shouldReturn(self::MAX_CHILDREN_PER_TAXON_LEVEL); | ||
} | ||
} |
Oops, something went wrong.