Completed
Pull Request — master (#54)
by Konrad
04:41
created

SlugTransformerSpec   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 19
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A let() 0 3 1
A it_is_a_transformer() 0 3 1
A it_transforms_product_slug_into_route() 0 7 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace spec\BitBag\SyliusElasticsearchPlugin\Transformer\Product;
6
7
use BitBag\SyliusElasticsearchPlugin\Transformer\Product\TransformerInterface;
8
use PhpSpec\ObjectBehavior;
9
use Sylius\Component\Core\Model\ProductInterface;
10
use Symfony\Component\Routing\RouterInterface;
11
12
final class SlugTransformerSpec extends ObjectBehavior
13
{
14
    function let(RouterInterface $router): void
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
15
    {
16
        $this->beConstructedWith($router);
17
    }
18
19
    function it_is_a_transformer(): void
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
20
    {
21
        $this->shouldImplement(TransformerInterface::class);
22
    }
23
24
    function it_transforms_product_slug_into_route(RouterInterface $router, ProductInterface $product): void
25
    {
26
        $product->getSlug()->willReturn('/super-quirky-shirt');
27
28
        $router->generate('sylius_shop_product_show', ['slug' => '/super-quirky-shirt'])->shouldBeCalled();
29
30
        $this->transform($product);
0 ignored issues
show
Bug introduced by
The method transform() does not exist on spec\BitBag\SyliusElasti...uct\SlugTransformerSpec. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

30
        $this->/** @scrutinizer ignore-call */ 
31
               transform($product);
Loading history...
31
    }
32
}
33