| Total Complexity | 5 | 
| Total Lines | 101 | 
| Duplicated Lines | 0 % | 
| Changes | 0 | ||
| 1 | <?php  | 
            ||
| 17 | class PaginatorTest extends OrmTestCase  | 
            ||
| 18 | { | 
            ||
| 19 | /** @var Connection */  | 
            ||
| 20 | private $connection;  | 
            ||
| 21 | /** @var EntityManagerInterface */  | 
            ||
| 22 | private $em;  | 
            ||
| 23 | /** @var AbstractHydrator */  | 
            ||
| 24 | private $hydrator;  | 
            ||
| 25 | |||
| 26 | protected function setUp() : void  | 
            ||
| 27 |     { | 
            ||
| 28 | $this->connection = $this->getMockBuilder(ConnectionMock::class)  | 
            ||
| 
                                                                                                    
                         1 ignored issue 
                            –
                            show
                         | 
                |||
| 29 | ->setConstructorArgs([[], new DriverMock()])  | 
            ||
| 30 | ->setMethods(['executeQuery'])  | 
            ||
| 31 | ->getMock()  | 
            ||
| 32 | ;  | 
            ||
| 33 | |||
| 34 | $this->em = $this->getMockBuilder(EntityManagerDecorator::class)  | 
            ||
| 
                                                                                                    
                         1 ignored issue 
                            –
                            show
                         | 
                |||
| 35 | ->setConstructorArgs([$this->getTestEntityManager($this->connection)])  | 
            ||
| 36 | ->setMethods(['newHydrator'])  | 
            ||
| 37 | ->getMock()  | 
            ||
| 38 | ;  | 
            ||
| 39 | |||
| 40 | $this->hydrator = $this->createMock(AbstractHydrator::class);  | 
            ||
| 
                                                                                                    
                         1 ignored issue 
                            –
                            show
                         | 
                |||
| 41 |         $this->em->method('newHydrator')->willReturn($this->hydrator); | 
            ||
| 42 | }  | 
            ||
| 43 | |||
| 44 | public function testExtraParametersAreStrippedWhenWalkerRemovingOriginalSelectElementsIsUsed() : void  | 
            ||
| 45 |     { | 
            ||
| 46 | $paramInWhere = 1;  | 
            ||
| 47 | $paramInSubSelect = 2;  | 
            ||
| 48 | $returnedIds = [10];  | 
            ||
| 49 | |||
| 50 |         $this->hydrator->method('hydrateAll')->willReturn([$returnedIds]); | 
            ||
| 51 | |||
| 52 | $query = new Query($this->em);  | 
            ||
| 53 | $query->setDQL(  | 
            ||
| 54 | 'SELECT u,  | 
            ||
| 55 | (  | 
            ||
| 56 | SELECT MAX(a.version)  | 
            ||
| 57 | FROM Doctrine\\Tests\\Models\\CMS\\CmsArticle a  | 
            ||
| 58 | WHERE a.user = u AND 1 = :paramInSubSelect  | 
            ||
| 59 | ) AS HIDDEN max_version  | 
            ||
| 60 | FROM Doctrine\\Tests\\Models\\CMS\\CmsUser u  | 
            ||
| 61 | WHERE u.id = :paramInWhere'  | 
            ||
| 62 | );  | 
            ||
| 63 | $query->setParameters(['paramInWhere' => $paramInWhere, 'paramInSubSelect' => $paramInSubSelect]);  | 
            ||
| 64 | $paginator = (new Paginator($query, true))->setUseOutputWalkers(false);  | 
            ||
| 65 | |||
| 66 |         $this->connection->expects($this->exactly(3))->method('executeQuery'); | 
            ||
| 67 | |||
| 68 | $this->connection->expects($this->at(0))  | 
            ||
| 69 |             ->method('executeQuery') | 
            ||
| 70 | ->with($this->anything(), [$paramInWhere])  | 
            ||
| 71 | ;  | 
            ||
| 72 | |||
| 73 | $this->connection->expects($this->at(1))  | 
            ||
| 74 |             ->method('executeQuery') | 
            ||
| 75 | ->with($this->anything(), [$paramInWhere])  | 
            ||
| 76 | ;  | 
            ||
| 77 | |||
| 78 | $this->connection->expects($this->at(2))  | 
            ||
| 79 |             ->method('executeQuery') | 
            ||
| 80 | ->with($this->anything(), [$paramInSubSelect, $paramInWhere, $returnedIds])  | 
            ||
| 81 | ;  | 
            ||
| 82 | |||
| 83 | $paginator->count();  | 
            ||
| 84 | $paginator->getIterator();  | 
            ||
| 85 | }  | 
            ||
| 86 | |||
| 87 | public function testPaginatorNotCaringAboutExtraParametersWithoutOutputWalkers() : void  | 
            ||
| 94 | }  | 
            ||
| 95 | |||
| 96 | public function testgetIteratorDoesCareAboutExtraParametersWithoutOutputWalkersWhenResultIsNotEmpty() : void  | 
            ||
| 103 | }  | 
            ||
| 104 | |||
| 105 | /**  | 
            ||
| 106 | * @param int[][] $willReturnRows  | 
            ||
| 107 | */  | 
            ||
| 108 | private function createPaginatorWithExtraParametersWithoutOutputWalkers(array $willReturnRows) : Paginator  | 
            ||
| 120 | 
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..