-
Notifications
You must be signed in to change notification settings - Fork 156
Expand file tree
/
Copy pathTaxonsAssignerSpec.php
More file actions
45 lines (36 loc) · 1.4 KB
/
TaxonsAssignerSpec.php
File metadata and controls
45 lines (36 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
declare(strict_types=1);
namespace spec\BitBag\SyliusCmsPlugin\Assigner;
use BitBag\SyliusCmsPlugin\Assigner\TaxonsAssigner;
use BitBag\SyliusCmsPlugin\Assigner\TaxonsAssignerInterface;
use BitBag\SyliusCmsPlugin\Entity\TaxonAwareInterface;
use PhpSpec\ObjectBehavior;
use Sylius\Component\Core\Model\TaxonInterface;
use Sylius\Component\Taxonomy\Repository\TaxonRepositoryInterface;
final class TaxonsAssignerSpec extends ObjectBehavior
{
public function let(TaxonRepositoryInterface $taxonRepository): void
{
$this->beConstructedWith($taxonRepository);
}
public function it_is_initializable(): void
{
$this->shouldHaveType(TaxonsAssigner::class);
}
public function it_implements_taxons_assigner_interface(): void
{
$this->shouldHaveType(TaxonsAssignerInterface::class);
}
public function it_assigns_taxons(
TaxonRepositoryInterface $taxonRepository,
TaxonInterface $mugsTaxon,
TaxonInterface $stickersTaxon,
TaxonAwareInterface $taxonsAware
): void {
$taxonRepository->findOneBy(['code' => 'mugs'])->willReturn($mugsTaxon);
$taxonRepository->findOneBy(['code' => 'stickers'])->willReturn($stickersTaxon);
$taxonsAware->addTaxon($mugsTaxon)->shouldBeCalled();
$taxonsAware->addTaxon($stickersTaxon)->shouldBeCalled();
$this->assign($taxonsAware, ['mugs', 'stickers']);
}
}