Skip to content

Commit c6c4e16

Browse files
authored
Merge pull request #28 from ppaulis/1.6.x
Allow `Laminas\Stdlib\Parameters` as parameter type for for `AbstractResourceListener#fetchAll()`
2 parents 36583a7 + 2174bc9 commit c6c4e16

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/AbstractResourceListener.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Laminas\EventManager\ListenerAggregateInterface;
1111
use Laminas\EventManager\ListenerAggregateTrait;
1212
use Laminas\InputFilter\InputFilterInterface;
13+
use Laminas\Stdlib\Parameters;
1314

1415
use function sprintf;
1516

@@ -252,7 +253,7 @@ public function fetch($id)
252253
/**
253254
* Fetch all or a subset of resources
254255
*
255-
* @param array $params
256+
* @param array|Parameters $params
256257
* @return ApiProblem|mixed
257258
*/
258259
public function fetchAll($params = [])

test/AbstractResourceListenerTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,4 +133,17 @@ public function testDispatchShouldPassWhitelistedQueryParamsToFetchAllMethod()
133133

134134
$this->assertEquals($queryParams, $this->listener->testCase->paramsPassedToListener);
135135
}
136+
137+
/**
138+
* @group 7
139+
*/
140+
public function testDispatchShouldPassEmptyArrayToFetchAllMethodIfNoQueryParamsArePresent()
141+
{
142+
$event = new ResourceEvent();
143+
$event->setName('fetchAll');
144+
145+
$this->listener->dispatch($event);
146+
147+
$this->assertEquals([], $this->listener->testCase->paramsPassedToListener);
148+
}
136149
}

0 commit comments

Comments
 (0)