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.
Completed
Push — master ( 1537c6...c1251f )
by
unknown
07:51
created

DelegatingDataFetcherSpec   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 74
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 37
dl 0
loc 74
rs 10
c 0
b 0
f 0
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A let() 0 3 1
A it_get_the_data_fetcher_with_given_report() 0 5 1
A it_throws_an_exception_if_report_has_not_data_fetcher() 0 8 1
A it_should_implement_delegating_data_fetcher_interface() 0 3 1
A it_fetch_the_data_with_given_report_configuration() 0 18 1
A it_is_initializable() 0 3 1
A it_fetch_the_data_with_given_parameter_configuration() 0 19 1
1
<?php
2
3
namespace spec\Odiseo\SyliusReportPlugin\DataFetcher;
4
5
use Odiseo\SyliusReportPlugin\DataFetcher\Data;
6
use Odiseo\SyliusReportPlugin\DataFetcher\DataFetcherInterface;
7
use Odiseo\SyliusReportPlugin\DataFetcher\DefaultDataFetchers;
8
use Odiseo\SyliusReportPlugin\DataFetcher\DelegatingDataFetcher;
9
use Odiseo\SyliusReportPlugin\DataFetcher\DelegatingDataFetcherInterface;
10
use Odiseo\SyliusReportPlugin\DataFetcher\UserRegistrationDataFetcher;
11
use Odiseo\SyliusReportPlugin\Model\ReportInterface;
12
use PhpSpec\ObjectBehavior;
13
use Sylius\Component\Registry\ServiceRegistryInterface;
14
15
/**
16
 * @author Diego D'amico <[email protected]>
17
 */
18
class DelegatingDataFetcherSpec extends ObjectBehavior
19
{
20
    function let(ServiceRegistryInterface $registry)
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...
21
    {
22
        $this->beConstructedWith($registry);
23
    }
24
25
    function it_is_initializable()
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...
26
    {
27
        $this->shouldHaveType(DelegatingDataFetcher::class);
28
    }
29
30
    function it_should_implement_delegating_data_fetcher_interface()
31
    {
32
        $this->shouldImplement(DelegatingDataFetcherInterface::class);
33
    }
34
35
    function it_get_the_data_fetcher_with_given_report(ReportInterface $report, ServiceRegistryInterface $registry)
36
    {
37
        $report->getDataFetcher()->willReturn(DefaultDataFetchers::USER_REGISTRATION);
38
        $registry->get(DefaultDataFetchers::USER_REGISTRATION)->willReturn(UserRegistrationDataFetcher::class);
39
        $this->getDataFetcher($report)->shouldReturn(UserRegistrationDataFetcher::class);
0 ignored issues
show
Bug introduced by
The method getDataFetcher() does not exist on spec\Odiseo\SyliusReport...legatingDataFetcherSpec. 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

39
        $this->/** @scrutinizer ignore-call */ 
40
               getDataFetcher($report)->shouldReturn(UserRegistrationDataFetcher::class);
Loading history...
40
    }
41
42
    function it_throws_an_exception_if_report_has_not_data_fetcher(ReportInterface $report, ServiceRegistryInterface $registry)
43
    {
44
        $report->getDataFetcher()->willReturn(null);
45
        $registry->get(DefaultDataFetchers::USER_REGISTRATION)->willReturn(UserRegistrationDataFetcher::class);
46
47
        $this
48
            ->shouldThrow(new \InvalidArgumentException('Cannot fetch data for ReportInterface instance without DataFetcher defined.'))
49
            ->during('getDataFetcher', [$report])
50
        ;
51
    }
52
53
    function it_fetch_the_data_with_given_report_configuration(ReportInterface $report, DataFetcherInterface $dataFetcher, ServiceRegistryInterface $registry)
54
    {
55
        $reportConfiguration = [
56
            'start' => new \DateTime('1918-01-01 00:00:00.000000'),
57
            'end' => new \DateTime(),
58
            'period' => 'month',
59
            'empty_records' => false
60
        ];
61
        $otherConfiguration = [
62
        ];
63
        $data = new Data();
64
65
        $report->getDataFetcher()->willReturn(DefaultDataFetchers::USER_REGISTRATION);
66
        $registry->get(DefaultDataFetchers::USER_REGISTRATION)->willReturn($dataFetcher);
67
        $report->getDataFetcherConfiguration()->willReturn($reportConfiguration);
68
        $dataFetcher->fetch($reportConfiguration)->willReturn($data);
0 ignored issues
show
Bug introduced by
The method willReturn() does not exist on Odiseo\SyliusReportPlugin\DataFetcher\Data. ( Ignorable by Annotation )

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

68
        $dataFetcher->fetch($reportConfiguration)->/** @scrutinizer ignore-call */ willReturn($data);

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...
69
70
        $this->fetch($report, $otherConfiguration)->shouldReturn($data);
0 ignored issues
show
Bug introduced by
The method fetch() does not exist on spec\Odiseo\SyliusReport...legatingDataFetcherSpec. 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

70
        $this->/** @scrutinizer ignore-call */ 
71
               fetch($report, $otherConfiguration)->shouldReturn($data);
Loading history...
71
    }
72
73
    function it_fetch_the_data_with_given_parameter_configuration(ReportInterface $report, DataFetcherInterface $dataFetcher, ServiceRegistryInterface $registry)
74
    {
75
        $reportConfiguration = [
76
            'start' => new \DateTime('1918-01-01 00:00:00.000000'),
77
            'end' => new \DateTime(),
78
            'period' => 'month',
79
            'empty_records' => false
80
        ];
81
        $otherConfiguration = [
82
            'otherConfiguration' => 'test'
83
        ];
84
        $data = new Data();
85
86
        $report->getDataFetcher()->willReturn(DefaultDataFetchers::USER_REGISTRATION);
87
        $registry->get(DefaultDataFetchers::USER_REGISTRATION)->willReturn($dataFetcher);
88
        $report->getDataFetcherConfiguration()->willReturn($reportConfiguration);
89
        $dataFetcher->fetch($otherConfiguration)->willReturn($data);
90
91
        $this->fetch($report, $otherConfiguration)->shouldReturn($data);
92
    }
93
}
94