Skip to content

Commit 90879bc

Browse files
authored
Merge pull request #93 from BitBagCommerce/release/20230707
Release 20230707
2 parents fe5f3df + 343a11d commit 90879bc

File tree

122 files changed

+5753
-10
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+5753
-10
lines changed

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"license": "MIT",
1313
"require": {
1414
"php": "^8.0",
15+
"ext-intl": "*",
1516
"ext-json": "*",
1617
"ext-openssl": "*",
1718
"bitbag/wishlist-plugin": "^3.0",
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
<?php
2+
3+
/*
4+
* This file was created by developers working at BitBag
5+
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
6+
* 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
7+
*/
8+
9+
declare(strict_types=1);
10+
11+
namespace spec\BitBag\SyliusVueStorefront2Plugin\Controller;
12+
13+
use BitBag\SyliusVueStorefront2Plugin\Controller\ThankYouPageController;
14+
use PhpSpec\ObjectBehavior;
15+
use Symfony\Component\HttpFoundation\RedirectResponse;
16+
use Symfony\Component\HttpFoundation\Request;
17+
use Symfony\Component\Routing\RouterInterface;
18+
19+
final class ThankYouPageControllerSpec extends ObjectBehavior
20+
{
21+
private const VSF2_HOST = 'http://localhost/';
22+
23+
public function let(RouterInterface $router): void
24+
{
25+
$this->beConstructedWith(self::VSF2_HOST, $router);
26+
}
27+
28+
public function it_is_initializable(): void
29+
{
30+
$this->shouldHaveType(ThankYouPageController::class);
31+
}
32+
33+
public function it_redirects_to_homepage_if_host_not_provided(
34+
RouterInterface $router,
35+
Request $request,
36+
): void {
37+
$this->beConstructedWith(null, $router);
38+
39+
$url = '/en_US/';
40+
$router->generate('sylius_shop_homepage')->willReturn($url);
41+
42+
$response = $this->redirectAction($request);
43+
44+
$response->shouldBeAnInstanceOf(RedirectResponse::class);
45+
$response->getTargetUrl()->shouldReturn($url);
46+
}
47+
48+
public function it_redirects_to_homepage_if_order_number_is_not_provided(
49+
RouterInterface $router,
50+
): void {
51+
$attributes = [];
52+
$request = new Request([], [], $attributes);
53+
54+
$url = '/en_US/';
55+
$router->generate('sylius_shop_homepage')->willReturn($url);
56+
57+
$response = $this->redirectAction($request);
58+
59+
$response->shouldBeAnInstanceOf(RedirectResponse::class);
60+
$response->getTargetUrl()->shouldReturn($url);
61+
}
62+
63+
function it_redirects_to_thank_you_page(): void
64+
{
65+
$locale = 'de_DE';
66+
$orderNumber = '123';
67+
$request = new Request(['locale' => $locale], [], ['orderNumber' => $orderNumber]);
68+
69+
$url = sprintf(
70+
'%s/%s/checkout/thank-you?order=%s',
71+
self::VSF2_HOST,
72+
locale_get_primary_language($locale),
73+
$orderNumber
74+
);
75+
76+
$response = $this->redirectAction($request);
77+
78+
$response->shouldBeAnInstanceOf(RedirectResponse::class);
79+
$response->getTargetUrl()->shouldReturn($url);
80+
}
81+
}
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
<?php
2+
3+
/*
4+
* This file was created by developers working at BitBag
5+
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
6+
* 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
7+
*/
8+
9+
declare(strict_types=1);
10+
11+
namespace spec\BitBag\SyliusVueStorefront2Plugin\DataGenerator\ContextModel;
12+
13+
use BitBag\SyliusVueStorefront2Plugin\DataGenerator\ContextModel\DataGeneratorCommandContext;
14+
use PhpSpec\ObjectBehavior;
15+
use Sylius\Component\Core\Model\ChannelInterface;
16+
use Symfony\Component\Console\Style\SymfonyStyle;
17+
18+
final class DataGeneratorCommandContextSpec extends ObjectBehavior
19+
{
20+
private const PRODUCTS_QTY = 100;
21+
22+
private const TAXONS_QTY = 200;
23+
24+
private const WISHLISTS_QTY = 300;
25+
26+
private const PRODUCTS_PER_TAXON_QTY = 400;
27+
28+
private const MAX_TAXON_LEVEL = 500;
29+
30+
private const MAX_CHILDREN_PER_TAXON_LEVEL = 600;
31+
32+
private const PRODUCTS_PER_WISHLIST_QTY = 700;
33+
34+
private const STRESS = 25;
35+
36+
public function let(
37+
SymfonyStyle $io,
38+
ChannelInterface $channel,
39+
): void {
40+
$this->beConstructedWith(
41+
$io,
42+
$channel,
43+
self::PRODUCTS_QTY,
44+
self::TAXONS_QTY,
45+
self::WISHLISTS_QTY,
46+
self::PRODUCTS_PER_TAXON_QTY,
47+
self::MAX_TAXON_LEVEL,
48+
self::MAX_CHILDREN_PER_TAXON_LEVEL,
49+
self::PRODUCTS_PER_WISHLIST_QTY,
50+
self::STRESS,
51+
);
52+
}
53+
54+
public function it_is_initializable(): void
55+
{
56+
$this->shouldHaveType(DataGeneratorCommandContext::class);
57+
}
58+
59+
public function it_returns_io(SymfonyStyle $io): void
60+
{
61+
$this->getIO()->shouldReturn($io);
62+
}
63+
64+
public function it_returns_channel(ChannelInterface $channel): void
65+
{
66+
$this->getChannel()->shouldReturn($channel);
67+
}
68+
69+
public function it_returns_products_qty(): void
70+
{
71+
$this->getProductsQty()->shouldReturn(self::PRODUCTS_QTY);
72+
}
73+
74+
public function it_returns_taxons_qty(): void
75+
{
76+
$this->getTaxonsQty()->shouldReturn(self::TAXONS_QTY);
77+
}
78+
79+
public function it_returns_wishlists_qty(): void
80+
{
81+
$this->getWishlistsQty()->shouldReturn(self::WISHLISTS_QTY);
82+
}
83+
84+
public function it_returns_products_per_taxon_qty(): void
85+
{
86+
$this->getProductsPerTaxonQty()->shouldReturn(self::PRODUCTS_PER_TAXON_QTY);
87+
}
88+
89+
public function it_returns_max_taxon_level(): void
90+
{
91+
$this->getMaxTaxonLevel()->shouldReturn(self::MAX_TAXON_LEVEL);
92+
}
93+
94+
public function it_returns_max_children_per_taxon_level(): void
95+
{
96+
$this->getMaxChildrenPerTaxonLevel()->shouldReturn(self::MAX_CHILDREN_PER_TAXON_LEVEL);
97+
}
98+
99+
public function it_returns_products_per_wishlist_qty(): void
100+
{
101+
$this->getProductsPerWishlistQty()->shouldReturn(self::PRODUCTS_PER_WISHLIST_QTY);
102+
}
103+
104+
public function it_returns_stress(): void
105+
{
106+
$this->getStress()->shouldReturn(self::STRESS);
107+
}
108+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?php
2+
3+
/*
4+
* This file was created by developers working at BitBag
5+
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
6+
* 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
7+
*/
8+
9+
declare(strict_types=1);
10+
11+
namespace spec\BitBag\SyliusVueStorefront2Plugin\DataGenerator\ContextModel\Generator;
12+
13+
use BitBag\SyliusVueStorefront2Plugin\DataGenerator\ContextModel\Generator\ProductGeneratorContext;
14+
use PhpSpec\ObjectBehavior;
15+
use Sylius\Component\Core\Model\ChannelInterface;
16+
use Symfony\Component\Console\Style\SymfonyStyle;
17+
18+
final class ProductGeneratorContextSpec extends ObjectBehavior
19+
{
20+
private const QUANTITY = 100;
21+
22+
public function let(
23+
SymfonyStyle $io,
24+
ChannelInterface $channel,
25+
): void {
26+
$this->beConstructedWith(
27+
$io,
28+
self::QUANTITY,
29+
$channel,
30+
);
31+
}
32+
33+
public function it_is_initializable(): void
34+
{
35+
$this->shouldHaveType(ProductGeneratorContext::class);
36+
}
37+
38+
public function it_returns_io(SymfonyStyle $io): void
39+
{
40+
$this->getIo()->shouldReturn($io);
41+
}
42+
43+
public function it_returns_quantity(): void
44+
{
45+
$this->getQuantity()->shouldReturn(self::QUANTITY);
46+
}
47+
48+
public function it_returns_channel(ChannelInterface $channel): void
49+
{
50+
$this->getChannel()->shouldReturn($channel);
51+
}
52+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<?php
2+
3+
/*
4+
* This file was created by developers working at BitBag
5+
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
6+
* 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
7+
*/
8+
9+
declare(strict_types=1);
10+
11+
namespace spec\BitBag\SyliusVueStorefront2Plugin\DataGenerator\ContextModel\Generator;
12+
13+
use BitBag\SyliusVueStorefront2Plugin\DataGenerator\ContextModel\Generator\ProductTaxonGeneratorContext;
14+
use PhpSpec\ObjectBehavior;
15+
use Sylius\Component\Core\Model\ChannelInterface;
16+
use Symfony\Component\Console\Style\SymfonyStyle;
17+
18+
final class ProductTaxonGeneratorContextSpec extends ObjectBehavior
19+
{
20+
private const QUANTITY = 100;
21+
22+
private const STRESS = 15;
23+
24+
public function let(
25+
SymfonyStyle $io,
26+
ChannelInterface $channel,
27+
): void {
28+
$this->beConstructedWith(
29+
$io,
30+
self::QUANTITY,
31+
$channel,
32+
self::STRESS,
33+
);
34+
}
35+
36+
public function it_is_initializable(): void
37+
{
38+
$this->shouldHaveType(ProductTaxonGeneratorContext::class);
39+
}
40+
41+
public function it_returns_io(SymfonyStyle $io): void
42+
{
43+
$this->getIo()->shouldReturn($io);
44+
}
45+
46+
public function it_returns_quantity(): void
47+
{
48+
$this->getQuantity()->shouldReturn(self::QUANTITY);
49+
}
50+
51+
public function it_returns_channel(ChannelInterface $channel): void
52+
{
53+
$this->getChannel()->shouldReturn($channel);
54+
}
55+
56+
public function it_returns_stress(): void
57+
{
58+
$this->getStress()->shouldReturn(self::STRESS);
59+
}
60+
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?php
2+
3+
/*
4+
* This file was created by developers working at BitBag
5+
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
6+
* 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
7+
*/
8+
9+
declare(strict_types=1);
10+
11+
namespace spec\BitBag\SyliusVueStorefront2Plugin\DataGenerator\ContextModel\Generator;
12+
13+
use BitBag\SyliusVueStorefront2Plugin\DataGenerator\ContextModel\Generator\TaxonGeneratorContext;
14+
use PhpSpec\ObjectBehavior;
15+
use Symfony\Component\Console\Style\SymfonyStyle;
16+
17+
final class TaxonGeneratorContextSpec extends ObjectBehavior
18+
{
19+
private const QUANTITY = 100;
20+
21+
private const MAX_TAXON_LEVEL = 10;
22+
23+
private const MAX_CHILDREN_PER_TAXON_LEVEL = 5;
24+
25+
public function let(SymfonyStyle $io): void
26+
{
27+
$this->beConstructedWith(
28+
$io,
29+
self::QUANTITY,
30+
self::MAX_TAXON_LEVEL,
31+
self::MAX_CHILDREN_PER_TAXON_LEVEL,
32+
);
33+
}
34+
35+
public function it_is_initializable(): void
36+
{
37+
$this->shouldHaveType(TaxonGeneratorContext::class);
38+
}
39+
40+
public function it_returns_io(SymfonyStyle $io): void
41+
{
42+
$this->getIo()->shouldReturn($io);
43+
}
44+
45+
public function it_returns_quantity(): void
46+
{
47+
$this->getQuantity()->shouldReturn(self::QUANTITY);
48+
}
49+
50+
public function it_returns_max_taxon_level(): void
51+
{
52+
$this->getMaxTaxonLevel()->shouldReturn(self::MAX_TAXON_LEVEL);
53+
}
54+
55+
public function it_returns_max_children_per_taxon_level(): void
56+
{
57+
$this->getMaxChildrenPerTaxonLevel()->shouldReturn(self::MAX_CHILDREN_PER_TAXON_LEVEL);
58+
}
59+
}

0 commit comments

Comments
 (0)