Skip to content

Commit

Permalink
Merge pull request #139 from magento-cia/cia-2.4.8-beta1-develop-2.4-…
Browse files Browse the repository at this point in the history
…develop-sync-08152024

Cia 2.4.8 beta1 develop 2.4 develop sync 08152024
  • Loading branch information
pawan-adobe-security authored Sep 1, 2024
2 parents 4900a50 + 7025189 commit fdf2ee2
Showing 1 changed file with 50 additions and 10 deletions.
60 changes: 50 additions & 10 deletions AdobeStockImage/Test/Unit/Model/GetImageListTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ protected function setUp(): void
* @param array $appliedFilterNames
* @dataProvider appliedFilterNamesProvider
* @throws LocalizedException
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.NPathComplexity)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function testWithDefaultFilters(array $appliedFilterNames): void
{
Expand Down Expand Up @@ -149,31 +152,68 @@ public function testWithDefaultFilters(array $appliedFilterNames): void
];
$this->filterBuilderMock
->method('setField')
->withConsecutive(...$filterBuilderMockSetFieldWith)
->willReturnSelf();
->willReturnCallback(function (...$args) use ($filterBuilderMockSetFieldWith) {
if (!empty($args)) {
static $callCount = 0;
$callCount++;
if ($callCount <= count($filterBuilderMockSetFieldWith)) {
return $this->filterBuilderMock;
}
}
});
$this->filterBuilderMock
->method('setConditionType')
->withConsecutive(...$filterBuilderMockSetConditionTypeWith)
->willReturnSelf();
->willReturnCallback(function (...$args) use ($filterBuilderMockSetConditionTypeWith) {
if (!empty($args)) {
static $callCount = 0;
$callCount++;
if ($callCount <= count($filterBuilderMockSetConditionTypeWith)) {
return $this->filterBuilderMock;
}
}
});

$this->filterBuilderMock
->method('setValue')
->withConsecutive(...$filterBuilderMockSetValueWith)
->willReturnSelf();
->willReturnCallback(function (...$args) use ($filterBuilderMockSetValueWith) {
if (!empty($args)) {
static $callCount = 0;
$callCount++;
if ($callCount <= count($filterBuilderMockSetValueWith)) {
return $this->filterBuilderMock;
}
}
});
$this->filterBuilderMock
->method('create')
->willReturnOnConsecutiveCalls(...$filterBuilderMockCreateReturn);

$this->filterGroupBuilderMock
->method('setFilters')
->withConsecutive(...$filterGroupBuilderMockSetFiltersWith)
->willReturnSelf();
->willReturnCallback(function (...$args) use ($filterGroupBuilderMockSetFiltersWith) {
if (!empty($args)) {
static $callCount = 0;
$callCount++;
if ($callCount <= count($filterGroupBuilderMockSetFiltersWith)) {
return $this->filterGroupBuilderMock;
}
}
});
$this->filterGroupBuilderMock
->method('create')
->willReturnOnConsecutiveCalls(...$filterGroupBuilderMockCreateReturn);

$searchCriteria
->method('setFilterGroups')
->withConsecutive(...$searchCriteriaSetFilterGroupsWith);
->willReturnCallback(function (...$args) use ($searchCriteriaSetFilterGroupsWith) {
static $callCount = 0;
$callCount++;
if (!empty($args)) {
if ($callCount <= count($searchCriteriaSetFilterGroupsWith)) {
return null;
}
}
});

$searchResult = $this->createMock(SearchResultInterface::class);

Expand All @@ -190,7 +230,7 @@ public function testWithDefaultFilters(array $appliedFilterNames): void
*
* @return array
*/
public function appliedFilterNamesProvider(): array
public static function appliedFilterNamesProvider(): array
{
return [
[
Expand Down

0 comments on commit fdf2ee2

Please sign in to comment.