Skip to content

Commit 1e72961

Browse files
committed
Fixed paginator adapter test; field mappings are now objects
1 parent 9ed4d44 commit 1e72961

File tree

2 files changed

+17
-20
lines changed

2 files changed

+17
-20
lines changed

src/Pagination/PaginatorAdapter.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -205,14 +205,11 @@ private function getDoctrinePaginator()
205205
*/
206206
protected function convertToLaravelPaginator(DoctrinePaginator $doctrinePaginator, $perPage, $page)
207207
{
208-
$results = iterator_to_array($doctrinePaginator);
209-
210-
die('convert');
211-
$path = Paginator::resolveCurrentPath();
212-
$query = $this->queryParams;
208+
$path = Paginator::resolveCurrentPath();
209+
$query = $this->queryParams;
213210

214211
return new LengthAwarePaginator(
215-
$results,
212+
$doctrinePaginator->getQuery()->getResult(),
216213
$doctrinePaginator->count(),
217214
$perPage,
218215
$page,

tests/Pagination/PaginatorAdapterTest.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,6 @@ public function testQueryParametersAreProducedInUrlFromRequest()
7373
*/
7474
private function mockEntityManager()
7575
{
76-
$this->markTestSkipped('This test is not working anymore');
77-
7876
/** @var EntityManagerInterface|\Mockery\Mock $em */
7977
$em = \Mockery::mock(EntityManagerInterface::class);
8078
$config = \Mockery::mock(Configuration::class);
@@ -89,19 +87,21 @@ private function mockEntityManager()
8987
$config->shouldReceive('getQueryCache')->andReturn(null);
9088
$config->shouldReceive('getQuoteStrategy')->andReturn(new DefaultQuoteStrategy);
9189

90+
$id = new stdClass();
91+
$id->fieldName = 'id';
92+
$id->columnName = 'id';
93+
$id->type = Types::INTEGER;
94+
$id->id = true;
95+
$id->options = ['unsigned' => true];
96+
97+
$name = new stdClass();
98+
$name->fieldName = 'name';
99+
$name->columnName = 'name';
100+
$name->type = Types::STRING;
101+
92102
$metadata->fieldMappings = [
93-
'id' => [
94-
'fieldName' => 'id',
95-
'columnName' => 'id',
96-
'type' => Types::INTEGER,
97-
'id' => true,
98-
'options' => ['unsigned' => true],
99-
],
100-
'name' => [
101-
'fieldName' => 'name',
102-
'columnName' => 'name',
103-
'type' => Types::STRING,
104-
],
103+
'id' => $id,
104+
'name' => $name,
105105
];
106106

107107
$metadata->subClasses = [];

0 commit comments

Comments
 (0)