Skip to content

Commit

Permalink
Fixed paginator adapter test; field mappings are now objects
Browse files Browse the repository at this point in the history
  • Loading branch information
TomHAnderson committed Sep 25, 2024
1 parent 8ecf557 commit 62a7b04
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 20 deletions.
9 changes: 3 additions & 6 deletions src/Pagination/PaginatorAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,14 +205,11 @@ private function getDoctrinePaginator()
*/
protected function convertToLaravelPaginator(DoctrinePaginator $doctrinePaginator, $perPage, $page)
{
$results = iterator_to_array($doctrinePaginator);

die('convert');
$path = Paginator::resolveCurrentPath();
$query = $this->queryParams;
$path = Paginator::resolveCurrentPath();
$query = $this->queryParams;

return new LengthAwarePaginator(
$results,
$doctrinePaginator->getQuery()->getResult(),
$doctrinePaginator->count(),
$perPage,
$page,
Expand Down
28 changes: 14 additions & 14 deletions tests/Pagination/PaginatorAdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ public function testQueryParametersAreProducedInUrlFromRequest()
*/
private function mockEntityManager()
{
$this->markTestSkipped('This test is not working anymore');

/** @var EntityManagerInterface|\Mockery\Mock $em */
$em = \Mockery::mock(EntityManagerInterface::class);
$config = \Mockery::mock(Configuration::class);
Expand All @@ -89,19 +87,21 @@ private function mockEntityManager()
$config->shouldReceive('getQueryCache')->andReturn(null);
$config->shouldReceive('getQuoteStrategy')->andReturn(new DefaultQuoteStrategy);

$id = new stdClass();
$id->fieldName = 'id';
$id->columnName = 'id';
$id->type = Types::INTEGER;
$id->id = true;
$id->options = ['unsigned' => true];

$name = new stdClass();
$name->fieldName = 'name';
$name->columnName = 'name';
$name->type = Types::STRING;

$metadata->fieldMappings = [
'id' => [
'fieldName' => 'id',
'columnName' => 'id',
'type' => Types::INTEGER,
'id' => true,
'options' => ['unsigned' => true],
],
'name' => [
'fieldName' => 'name',
'columnName' => 'name',
'type' => Types::STRING,
],
'id' => $id,
'name' => $name,
];

$metadata->subClasses = [];
Expand Down

0 comments on commit 62a7b04

Please sign in to comment.