GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

it_should_implement_compiler_pass_interface()   A
last analyzed

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
namespace spec\Odiseo\SyliusReportPlugin\DependencyInjection\Compiler;
4
5
use PhpSpec\ObjectBehavior;
6
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
7
use Symfony\Component\DependencyInjection\ContainerBuilder;
8
use Symfony\Component\DependencyInjection\Definition;
9
use Symfony\Component\DependencyInjection\Reference;
10
11
/**
12
 * @author Mateusz Zalewski <[email protected]>
13
 * @author Diego D'amico <[email protected]>
14
 */
15
final class RegisterDataFetchersPassSpec extends ObjectBehavior
16
{
17
    function it_should_implement_compiler_pass_interface()
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...
18
    {
19
        $this->shouldImplement(CompilerPassInterface::class);
20
    }
21
22
    function it_processes_with_given_container(ContainerBuilder $container, Definition $dataFetcherDefinition)
23
    {
24
        $container->hasDefinition('odiseo_sylius_report.registry.data_fetcher')->willReturn(true);
25
        $container->getDefinition('odiseo_sylius_report.registry.data_fetcher')->willReturn($dataFetcherDefinition);
0 ignored issues
show
Bug introduced by
The method willReturn() does not exist on Symfony\Component\DependencyInjection\Definition. ( Ignorable by Annotation )

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

25
        $container->getDefinition('odiseo_sylius_report.registry.data_fetcher')->/** @scrutinizer ignore-call */ willReturn($dataFetcherDefinition);

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...
26
27
        $dataFetcherServices = [
28
            'odiseo_sylius_report.form.type.data_fetcher.test' => [
29
                ['fetcher' => 'test', 'label' => 'Test data fetcher'],
30
            ],
31
        ];
32
        $container->findTaggedServiceIds('odiseo_sylius_report.data_fetcher')->willReturn($dataFetcherServices);
33
34
        $dataFetcherDefinition->addMethodCall('register', ['test', new Reference('odiseo_sylius_report.form.type.data_fetcher.test')])->shouldBeCalled();
0 ignored issues
show
Bug introduced by
The method shouldBeCalled() does not exist on Symfony\Component\DependencyInjection\Definition. ( Ignorable by Annotation )

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

34
        $dataFetcherDefinition->addMethodCall('register', ['test', new Reference('odiseo_sylius_report.form.type.data_fetcher.test')])->/** @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...
35
        $container->setParameter('odiseo_sylius_report.data_fetchers', ['test' => 'Test data fetcher'])->shouldBeCalled();
0 ignored issues
show
Bug introduced by
Are you sure the usage of $container->setParameter...> 'Test data fetcher')) targeting Symfony\Component\Depend...ntainer::setParameter() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
36
37
        $this->process($container);
0 ignored issues
show
Bug introduced by
The method process() does not exist on spec\Odiseo\SyliusReport...terDataFetchersPassSpec. 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

37
        $this->/** @scrutinizer ignore-call */ 
38
               process($container);
Loading history...
38
    }
39
40
    function it_does_not_process_if_container_has_not_proper_definition(ContainerBuilder $container)
41
    {
42
        $container->hasDefinition('odiseo_sylius_report.registry.data_fetcher')->willReturn(false);
43
        $container->getDefinition('odiseo_sylius_report.registry.data_fetcher')->shouldNotBeCalled();
0 ignored issues
show
Bug introduced by
The method shouldNotBeCalled() does not exist on Symfony\Component\DependencyInjection\Definition. ( Ignorable by Annotation )

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

43
        $container->getDefinition('odiseo_sylius_report.registry.data_fetcher')->/** @scrutinizer ignore-call */ shouldNotBeCalled();

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...
44
45
        $this->process($container);
46
    }
47
48
    function it_throws_exception_if_any_data_fetcher_has_improper_attributes(ContainerBuilder $container, Definition $dataFetcherDefinition)
49
    {
50
        $container->hasDefinition('odiseo_sylius_report.registry.data_fetcher')->willReturn(true);
51
        $container->getDefinition('odiseo_sylius_report.registry.data_fetcher')->willReturn($dataFetcherDefinition);
52
53
        $dataFetcherServices = [
54
            'odiseo_sylius_report.form.type.data_fetcher.test' => [
55
                ['data_fetcher' => 'test'],
56
            ],
57
        ];
58
        $container->findTaggedServiceIds('odiseo_sylius_report.data_fetcher')->willReturn($dataFetcherServices);
59
        $dataFetcherDefinition->addMethodCall('register', ['test', new Reference('odiseo_sylius_report.form.type.data_fetcher.test')])->shouldNotBeCalled();
60
61
        $this->shouldThrow(new \InvalidArgumentException('Tagged report data fetchers needs to have `fetcher` and `label` attributes.'))
62
            ->during('process', [$container]);
63
    }
64
}
65