odiseoteam /
SyliusReportPlugin
| 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
|
|||||||
| 21 | { |
||||||
| 22 | $this->beConstructedWith($registry); |
||||||
| 23 | } |
||||||
| 24 | |||||||
| 25 | function it_is_initializable() |
||||||
|
0 ignored issues
–
show
|
|||||||
| 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, TableRenderer $tableRenderer) |
||||||
| 36 | { |
||||||
| 37 | $report->getRenderer()->willReturn(DefaultRenderers::TABLE); |
||||||
| 38 | $registry->get(DefaultRenderers::TABLE)->willReturn($tableRenderer); |
||||||
| 39 | $this->getRenderer($report)->shouldReturn($tableRenderer); |
||||||
|
0 ignored issues
–
show
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
Loading history...
|
|||||||
| 40 | } |
||||||
| 41 | |||||||
| 42 | function it_render_with_given_report_configuration_and_data(ReportInterface $report, RendererInterface $renderer, Data $data, ServiceRegistryInterface $registry) |
||||||
| 43 | { |
||||||
| 44 | $report->getRenderer()->willReturn(DefaultRenderers::TABLE); |
||||||
| 45 | $registry->get(DefaultRenderers::TABLE)->willReturn($renderer); |
||||||
| 46 | $renderer->render($report, $data)->willReturn('<div>Table render</div>'); |
||||||
| 47 | |||||||
| 48 | $this->render($report, $data)->shouldReturn('<div>Table render</div>'); |
||||||
|
0 ignored issues
–
show
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
Loading history...
|
|||||||
| 49 | } |
||||||
| 50 | } |
||||||
| 51 |
Adding explicit visibility (
private,protected, orpublic) is generally recommend to communicate to other developers how, and from where this method is intended to be used.