Test Failed
Pull Request — master (#39)
by Roman
03:36
created

PaginateStepTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 5
dl 0
loc 13
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testCanBeConstructed() 0 4 1
A testGetRequiredArtifacts() 0 4 1
1
<?php
2
3
namespace Kami\ApiCoreBundle\Tests\RequestProcessor\Step\Common;
4
5
use Doctrine\ORM\EntityManagerInterface;
6
use Doctrine\ORM\Query;
7
use Doctrine\ORM\QueryBuilder;
8
use Doctrine\ORM\Tools\Pagination\Paginator;
9
use Kami\ApiCoreBundle\RequestProcessor\ProcessorResponse;
0 ignored issues
show
Bug introduced by
The type Kami\ApiCoreBundle\Reque...essor\ProcessorResponse was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
10
use Kami\ApiCoreBundle\RequestProcessor\Step\Common\BuildSelectQueryStep;
11
use Kami\ApiCoreBundle\RequestProcessor\Step\Common\GetEntityFromReflectionStep;
12
use Kami\ApiCoreBundle\RequestProcessor\Step\Common\GetReflectionFromRequestStep;
13
use Kami\ApiCoreBundle\RequestProcessor\Step\Common\HandleRequestStep;
14
use Kami\ApiCoreBundle\RequestProcessor\Step\Common\PaginateStep;
15
use Kami\ApiCoreBundle\Tests\Entity\MyModel;
16
use Kami\ApiCoreBundle\Tests\fixtures\Entity;
17
use Kami\Component\RequestProcessor\Artifact;
18
use Kami\Component\RequestProcessor\ArtifactCollection;
19
use PHPUnit\Framework\TestCase;
20
use Symfony\Component\Form\Form;
21
use Symfony\Component\HttpFoundation\Request;
22
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
23
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
24
25
class PaginateStepTest extends TestCase
26
{
27
28
    public function testCanBeConstructed()
29
    {
30
        $step = new PaginateStep(10, 20);
31
        $this->assertInstanceOf(PaginateStep::class, $step);
32
    }
33
34
    public function testGetRequiredArtifacts()
35
    {
36
        $step = new PaginateStep(10, 20);
37
        $this->assertEquals(['query_builder', 'select_query_built', 'access_granted'], $step->getRequiredArtifacts());
38
    }
39
40
//    public function testExecute()
41
//    {
42
//        $paginatorMock = $this->createMock(Paginator::class);
43
//        $paginatorMock->expects($this->any())->method('__construct')->willReturn($paginatorMock);
44
//        $paginatorMock->expects($this->any())->method('count')->willReturn(10);
45
//
46
//        $queryBuilderMock = $this->createMock(QueryBuilder::class);
47
//        $queryBuilderMock->expects($this->any())->method('getQuery')->willReturn($queryMock);
48
//
49
//        $step = new PaginateStep(10);
50
//        $request = new Request();
51
//        $step->setRequest($request);
52
//        $step->setPreviousResponse(new ProcessorResponse($request, ['query_builder' => $queryBuilderMock]));
53
//
54
//        $response = $step->execute();
55
//        $this->assertInstanceOf(ProcessorResponse::class, $response);
56
//        $this->assertInstanceOf(Form::class, $response->getData()['form']);
57
//    }
58
}
59