|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file has been created by developers from BitBag. |
|
5
|
|
|
* Feel free to contact us once you face any issues or want to start |
|
6
|
|
|
* another great project. |
|
7
|
|
|
* You can find more information about us on https://bitbag.shop and write us |
|
8
|
|
|
* an email on [email protected]. |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
declare(strict_types=1); |
|
12
|
|
|
|
|
13
|
|
|
namespace spec\BitBag\SyliusElasticsearchPlugin\Context; |
|
14
|
|
|
|
|
15
|
|
|
use BitBag\SyliusElasticsearchPlugin\Context\ProductOptionsContext; |
|
16
|
|
|
use BitBag\SyliusElasticsearchPlugin\Context\ProductOptionsContextInterface; |
|
17
|
|
|
use BitBag\SyliusElasticsearchPlugin\Context\TaxonContextInterface; |
|
18
|
|
|
use BitBag\SyliusElasticsearchPlugin\Finder\ProductOptionsFinderInterface; |
|
19
|
|
|
use PhpSpec\ObjectBehavior; |
|
20
|
|
|
use Sylius\Component\Core\Model\TaxonInterface; |
|
21
|
|
|
|
|
22
|
|
|
final class ProductOptionsContextSpec extends ObjectBehavior |
|
23
|
|
|
{ |
|
24
|
|
|
function let( |
|
25
|
|
|
TaxonContextInterface $taxonContext, |
|
26
|
|
|
ProductOptionsFinderInterface $optionsFinder |
|
27
|
|
|
): void { |
|
28
|
|
|
$this->beConstructedWith($taxonContext, $optionsFinder); |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
function it_is_initializable(): void |
|
32
|
|
|
{ |
|
33
|
|
|
$this->shouldHaveType(ProductOptionsContext::class); |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
function it_implements_product_options_context_interface(): void |
|
37
|
|
|
{ |
|
38
|
|
|
$this->shouldHaveType(ProductOptionsContextInterface::class); |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
function it_gets_options( |
|
42
|
|
|
TaxonContextInterface $taxonContext, |
|
43
|
|
|
ProductOptionsFinderInterface $optionsFinder, |
|
44
|
|
|
TaxonInterface $taxon |
|
45
|
|
|
): void { |
|
46
|
|
|
$taxonContext->getTaxon()->willReturn($taxon); |
|
47
|
|
|
|
|
48
|
|
|
$optionsFinder->findByTaxon($taxon)->willReturn([]); |
|
49
|
|
|
|
|
50
|
|
|
$this->getOptions()->shouldBeEqualTo([]); |
|
51
|
|
|
} |
|
52
|
|
|
} |
|
53
|
|
|
|