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.

DelegatingDataFetcherSpec   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 63
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 32
c 1
b 0
f 1
dl 0
loc 63
rs 10
wmc 6

6 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_should_implement_delegating_data_fetcher_interface() 0 3 1
A it_is_initializable() 0 3 1
A it_fetch_the_data_with_given_report_configuration() 0 18 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, UserRegistrationDataFetcher $userRegistrationDataFetcher)
36
    {
37
        $report->getDataFetcher()->willReturn(DefaultDataFetchers::USER_REGISTRATION);
38
        $registry->get(DefaultDataFetchers::USER_REGISTRATION)->willReturn($userRegistrationDataFetcher);
39
        $this->getDataFetcher($report)->shouldReturn($userRegistrationDataFetcher);
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);
Loading history...
40
    }
41
42
    function it_fetch_the_data_with_given_report_configuration(ReportInterface $report, DataFetcherInterface $dataFetcher, ServiceRegistryInterface $registry)
43
    {
44
        $reportConfiguration = [
45
            'start' => new \DateTime('1918-01-01 00:00:00.000000'),
46
            'end' => new \DateTime(),
47
            'period' => 'month',
48
            'empty_records' => false
49
        ];
50
        $otherConfiguration = [
51
        ];
52
        $data = new Data();
53
54
        $report->getDataFetcher()->willReturn(DefaultDataFetchers::USER_REGISTRATION);
55
        $registry->get(DefaultDataFetchers::USER_REGISTRATION)->willReturn($dataFetcher);
56
        $report->getDataFetcherConfiguration()->willReturn($reportConfiguration);
57
        $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

57
        $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...
58
59
        $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

59
        $this->/** @scrutinizer ignore-call */ 
60
               fetch($report, $otherConfiguration)->shouldReturn($data);
Loading history...
60
    }
61
62
    function it_fetch_the_data_with_given_parameter_configuration(ReportInterface $report, DataFetcherInterface $dataFetcher, ServiceRegistryInterface $registry)
63
    {
64
        $reportConfiguration = [
65
            'start' => new \DateTime('1918-01-01 00:00:00.000000'),
66
            'end' => new \DateTime(),
67
            'period' => 'month',
68
            'empty_records' => false
69
        ];
70
        $otherConfiguration = [
71
            'otherConfiguration' => 'test'
72
        ];
73
        $data = new Data();
74
75
        $report->getDataFetcher()->willReturn(DefaultDataFetchers::USER_REGISTRATION);
76
        $registry->get(DefaultDataFetchers::USER_REGISTRATION)->willReturn($dataFetcher);
77
        $report->getDataFetcherConfiguration()->willReturn($reportConfiguration);
78
        $dataFetcher->fetch($otherConfiguration)->willReturn($data);
79
80
        $this->fetch($report, $otherConfiguration)->shouldReturn($data);
81
    }
82
}
83