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

DelegatingRendererSpec   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 16
dl 0
loc 42
rs 10
c 0
b 0
f 0
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A it_should_implement_delegating_renderer_interface() 0 3 1
A it_get_the_renderer_with_given_report() 0 5 1
A it_throws_an_exception_if_report_has_not_renderer() 0 8 1
A let() 0 3 1
A it_is_initializable() 0 3 1
A it_render_with_given_report_configuration_and_data() 0 7 1
1
<?php
2
3
namespace spec\Odiseo\SyliusReportPlugin\Renderer;
4
5
use Odiseo\SyliusReportPlugin\DataFetcher\Data;
6
use Odiseo\SyliusReportPlugin\Model\ReportInterface;
7
use Odiseo\SyliusReportPlugin\Renderer\DefaultRenderers;
8
use Odiseo\SyliusReportPlugin\Renderer\DelegatingRenderer;
9
use Odiseo\SyliusReportPlugin\Renderer\DelegatingRendererInterface;
10
use Odiseo\SyliusReportPlugin\Renderer\RendererInterface;
11
use Odiseo\SyliusReportPlugin\Renderer\TableRenderer;
12
use PhpSpec\ObjectBehavior;
13
use Sylius\Component\Registry\ServiceRegistryInterface;
14
15
/**
16
 * @author Diego D'amico <[email protected]>
17
 */
18
class DelegatingRendererSpec 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(DelegatingRenderer::class);
28
    }
29
30
    function it_should_implement_delegating_renderer_interface()
31
    {
32
        $this->shouldImplement(DelegatingRendererInterface::class);
33
    }
34
35
    function it_get_the_renderer_with_given_report(ReportInterface $report, ServiceRegistryInterface $registry)
36
    {
37
        $report->getRenderer()->willReturn(DefaultRenderers::TABLE);
38
        $registry->get(DefaultRenderers::TABLE)->willReturn(TableRenderer::class);
39
        $this->getRenderer($report)->shouldReturn(TableRenderer::class);
0 ignored issues
show
Bug introduced by
The method getRenderer() does not exist on spec\Odiseo\SyliusReport...\DelegatingRendererSpec. 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
               getRenderer($report)->shouldReturn(TableRenderer::class);
Loading history...
40
    }
41
42
    function it_throws_an_exception_if_report_has_not_renderer(ReportInterface $report, ServiceRegistryInterface $registry)
43
    {
44
        $report->getRenderer()->willReturn(null);
45
        $registry->get(DefaultRenderers::TABLE)->willReturn(TableRenderer::class);
46
47
        $this
48
            ->shouldThrow(new \InvalidArgumentException('Cannot render data for ReportInterface instance without renderer defined.'))
49
            ->during('getRenderer', [$report])
50
        ;
51
    }
52
53
    function it_render_with_given_report_configuration_and_data(ReportInterface $report, RendererInterface $renderer, Data $data, ServiceRegistryInterface $registry)
54
    {
55
        $report->getRenderer()->willReturn(DefaultRenderers::TABLE);
56
        $registry->get(DefaultRenderers::TABLE)->willReturn($renderer);
57
        $renderer->render($report, $data)->willReturn('<div>Table render</div>');
58
59
        $this->render($report, $data)->shouldReturn('<div>Table render</div>');
0 ignored issues
show
Bug introduced by
The method render() does not exist on spec\Odiseo\SyliusReport...\DelegatingRendererSpec. 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
               render($report, $data)->shouldReturn('<div>Table render</div>');
Loading history...
60
    }
61
}
62