Completed
Push — master ( 1bdfd1...c133b5 )
by G
03:55
created

it_is_initializable()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace spec\Gweb\SyliusProductDepositPlugin\Menu;
6
7
use Gweb\SyliusProductDepositPlugin\Menu\AdminProductVariantFormMenuListener;
8
use Knp\Menu\ItemInterface;
9
use PhpSpec\ObjectBehavior;
10
use Sylius\Bundle\AdminBundle\Event\ProductVariantMenuBuilderEvent;
11
use Symfony\Contracts\Translation\TranslatorInterface;
12
13
final class AdminProductVariantFormMenuListenerSpec extends ObjectBehavior
14
{
15
    function let(
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...
16
        TranslatorInterface $translator
17
    ): void {
18
        $translator->trans('gweb_deposit.admin.product_variant.menu')->willReturn('Deposit');
19
20
        $this->beConstructedWith($translator);
21
    }
22
23
    function it_is_initializable(): 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...
24
    {
25
        $this->shouldHaveType(AdminProductVariantFormMenuListener::class);
26
    }
27
28
    function it_build_menu(
29
        ProductVariantMenuBuilderEvent $menuBuilderEvent,
30
        ItemInterface $menuItem,
31
        ItemInterface $rootMenuItem
32
    ): void {
33
        $menuBuilderEvent->getMenu()->willReturn($rootMenuItem);
0 ignored issues
show
Bug introduced by
The method willReturn() does not exist on Knp\Menu\ItemInterface. ( Ignorable by Annotation )

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

33
        $menuBuilderEvent->getMenu()->/** @scrutinizer ignore-call */ willReturn($rootMenuItem);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
34
        $rootMenuItem->addChild('deposit', ['position' => 1])->willReturn($menuItem);
35
36
        $menuItem->setAttribute(
37
            'template',
38
            '@GwebSyliusProductDepositPlugin/Resources/views/Admin/ProductVariant/Tab/_deposit.html.twig'
39
        )->willReturn($menuItem);
40
        $menuItem->setLabel('Deposit')->willReturn($menuItem);
41
        $menuItem->setLabelAttribute('icon', 'dollar')->shouldBeCalled();
0 ignored issues
show
Bug introduced by
The method shouldBeCalled() does not exist on Knp\Menu\ItemInterface. ( Ignorable by Annotation )

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

41
        $menuItem->setLabelAttribute('icon', 'dollar')->/** @scrutinizer ignore-call */ shouldBeCalled();

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
42
43
        $this->addItems($menuBuilderEvent);
0 ignored issues
show
Bug introduced by
The method addItems() does not exist on spec\Gweb\SyliusProductD...antFormMenuListenerSpec. 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

43
        $this->/** @scrutinizer ignore-call */ 
44
               addItems($menuBuilderEvent);
Loading history...
44
    }
45
}
46