Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ENGCOM-9391: #33586: fix php warning message at search advansed resul…
…t and index pages #34995
- Loading branch information
Showing
4 changed files
with
138 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
115 changes: 115 additions & 0 deletions
115
dev/tests/integration/testsuite/Magento/CatalogSearch/Controller/Advanced/IndexTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\CatalogSearch\Controller\Advanced; | ||
|
||
use Magento\TestFramework\TestCase\AbstractController; | ||
use Laminas\Stdlib\Parameters; | ||
|
||
/** | ||
* Test cases for catalog advanced index using params. | ||
* | ||
* @magentoDbIsolation disabled | ||
* @magentoAppIsolation enabled | ||
*/ | ||
class IndexTest extends AbstractController | ||
{ | ||
/** | ||
* Advanced index test by params with the array in params. | ||
* | ||
* @magentoAppArea frontend | ||
* @dataProvider fromParamsInArrayDataProvider | ||
* | ||
* @param array $searchParams | ||
* @return void | ||
*/ | ||
public function testExecuteWithArrayInParams(array $searchParams): void | ||
{ | ||
$this->getRequest()->setQuery( | ||
$this->_objectManager->create( | ||
Parameters::class, | ||
[ | ||
'values' => $searchParams | ||
] | ||
) | ||
); | ||
$this->dispatch('catalogsearch/advanced/index'); | ||
$this->assertEquals(200, $this->getResponse()->getStatusCode()); | ||
$this->getResponse()->getBody(); | ||
} | ||
|
||
/** | ||
* Data provider with array in param values. | ||
* | ||
* @return array | ||
*/ | ||
public function fromParamsInArrayDataProvider(): array | ||
{ | ||
return [ | ||
'from_data_with_from_param_is_array' => [ | ||
[ | ||
'name' => '', | ||
'sku' => '', | ||
'description' => '', | ||
'short_description' => '', | ||
'price' => [ | ||
'from' => [], | ||
'to' => 1, | ||
] | ||
] | ||
], | ||
'from_data_with_to_param_is_array' => [ | ||
[ | ||
'name' => '', | ||
'sku' => '', | ||
'description' => '', | ||
'short_description' => '', | ||
'price' => [ | ||
'from' => 0, | ||
'to' => [], | ||
] | ||
] | ||
], | ||
'from_data_with_params_in_array' => [ | ||
[ | ||
'name' => '', | ||
'sku' => '', | ||
'description' => '', | ||
'short_description' => '', | ||
'price' => [ | ||
'from' => ['0' => 1], | ||
'to' => [1], | ||
] | ||
] | ||
], | ||
'from_data_with_params_in_array_in_array' => [ | ||
[ | ||
'name' => '', | ||
'sku' => '', | ||
'description' => '', | ||
'short_description' => '', | ||
'price' => [ | ||
'from' => ['0' => ['0' => 1]], | ||
'to' => 1, | ||
] | ||
] | ||
], | ||
'from_data_with_name_param_is_array' => [ | ||
[ | ||
'name' => [], | ||
'sku' => '', | ||
'description' => '', | ||
'short_description' => '', | ||
'price' => [ | ||
'from' => 0, | ||
'to' => 20, | ||
] | ||
] | ||
] | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters