ltsecurityinc安防产品在线商城代码

This commit is contained in:
2026-09-14 17:47:10 +08:00
parent 57d8444c15
commit 6a3c9c5bd8
14539 changed files with 1775310 additions and 0 deletions
@@ -0,0 +1,100 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\LayeredNavigation\Block\Navigation\Search;
use Magento\Catalog\Model\Layer\Filter\AbstractFilter;
use Magento\Catalog\Model\Layer\Resolver;
use Magento\LayeredNavigation\Block\Navigation\Category\BooleanFilterTest as CategoryBooleanFilterTest;
/**
* Provides tests for custom boolean filter in navigation block on search page.
*
* @magentoAppArea frontend
* @magentoAppIsolation enabled
* @magentoDbIsolation disabled
*/
class BooleanFilterTest extends CategoryBooleanFilterTest
{
/**
* @magentoDataFixture Magento/Catalog/_files/product_boolean_attribute.php
* @magentoDataFixture Magento/Catalog/_files/category_with_different_price_products.php
* @dataProvider getFiltersWithCustomAttributeDataProvider
* @param array $products
* @param array $attributeData
* @param array $expectation
* @return void
*/
public function testGetFiltersWithCustomAttribute(
array $products,
array $attributeData,
array $expectation
): void {
$this->getSearchFiltersAndAssert($products, $attributeData, $expectation);
}
/**
* @return array
*/
public function getFiltersWithCustomAttributeDataProvider(): array
{
$dataProvider = parent::getFiltersWithCustomAttributeDataProvider();
$dataProvider = array_replace_recursive(
$dataProvider,
[
'not_used_in_navigation' => [
'attribute_data' => [
'is_filterable_in_search' => 0,
],
],
'used_in_navigation_with_results' => [
'attribute_data' => [
'is_filterable_in_search' => 1,
],
],
'used_in_navigation_without_results' => [
'attribute_data' => [
'is_filterable' => 0,
'is_filterable_in_search' => 1,
],
],
]
);
//TODO uncomment after fix MC-29227
//unset($dataProvider['used_in_navigation_without_results']['expectation'][1]);
return $dataProvider;
}
/**
* @magentoDataFixture Magento/Catalog/_files/product_boolean_attribute.php
* @magentoDataFixture Magento/Catalog/_files/category_with_different_price_products.php
* @dataProvider getActiveFiltersWithCustomAttributeDataProvider
* @param array $products
* @param array $expectation
* @param string $filterValue
* @param int $productsCount
* @return void
*/
public function testGetActiveFiltersWithCustomAttribute(
array $products,
array $expectation,
string $filterValue,
int $productsCount
): void {
$this->getSearchActiveFiltersAndAssert($products, $expectation, $filterValue, $productsCount);
}
/**
* @inheritdoc
*/
protected function getLayerType(): string
{
return Resolver::CATALOG_LAYER_SEARCH;
}
}
@@ -0,0 +1,55 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\LayeredNavigation\Block\Navigation\Search\Bundle;
use Magento\Catalog\Model\Layer\Resolver;
use Magento\LayeredNavigation\Block\Navigation\Category\Bundle\PriceFilterTest as CategoryFilterTest;
/**
* Provides price filter tests for bundle product in navigation block on search page.
*
* @magentoAppArea frontend
* @magentoAppIsolation enabled
* @magentoDbIsolation disabled
*/
class PriceFilterTest extends CategoryFilterTest
{
/**
* @magentoDataFixture Magento/Bundle/_files/dynamic_and_fixed_bundle_products_in_category.php
* @magentoConfigFixture current_store catalog/layered_navigation/price_range_calculation manual
* @magentoConfigFixture current_store catalog/layered_navigation/price_range_step 10
* @return void
*/
public function testGetFilters(): void
{
$this->getSearchFiltersAndAssert(
['bundle-product' => 20.00],
['is_filterable_in_search' => 1],
[
['label' => '$10.00 - $19.99', 'value' => '10-20', 'count' => 1],
['label' => '$20.00 and above', 'value' => '20-30', 'count' => 1],
]
);
}
/**
* @inheritdoc
*/
protected function getLayerType(): string
{
return Resolver::CATALOG_LAYER_SEARCH;
}
/**
* @inheritdoc
*/
protected function getSearchString(): string
{
return 'Bundle';
}
}
@@ -0,0 +1,75 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\LayeredNavigation\Block\Navigation\Search;
use Magento\Catalog\Model\Layer\Filter\AbstractFilter;
use Magento\Catalog\Model\Layer\Resolver;
use Magento\LayeredNavigation\Block\Navigation\Category\DecimalFilterTest as CategoryDecimalFilterTest;
/**
* Provides tests for custom price filter in navigation block on search page.
*
* @magentoAppArea frontend
* @magentoAppIsolation enabled
* @magentoDbIsolation disabled
*/
class DecimalFilterTest extends CategoryDecimalFilterTest
{
/**
* @magentoDataFixture Magento/Catalog/_files/product_decimal_attribute.php
* @magentoDataFixture Magento/Catalog/_files/category_with_different_price_products.php
* @dataProvider getFiltersWithCustomAttributeDataProvider
* @param array $products
* @param array $attributeData
* @param array $expectation
* @return void
*/
public function testGetFiltersWithCustomAttribute(
array $products,
array $attributeData,
array $expectation
): void {
$this->getSearchFiltersAndAssert($products, $attributeData, $expectation);
}
/**
* @return array
*/
public function getFiltersWithCustomAttributeDataProvider(): array
{
$dataProvider = parent::getFiltersWithCustomAttributeDataProvider();
$dataProvider = array_replace_recursive(
$dataProvider,
[
'not_used_in_navigation' => [
'attribute_data' => ['is_filterable' => 0, 'is_filterable_in_search' => 0],
],
/* @TODO: Should be uncommented in MC-16650 */
/*'used_in_navigation_with_results' => [
'attribute_data' => [
'is_filterable' => AbstractFilter::ATTRIBUTE_OPTIONS_ONLY_WITH_RESULTS,
'is_filterable_in_search' => 1,
],
],*/
]
);
return $dataProvider;
}
/**
* @inheritdoc
*/
protected function getLayerType(): string
{
return Resolver::CATALOG_LAYER_SEARCH;
}
}
@@ -0,0 +1,58 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\LayeredNavigation\Block\Navigation\Search;
use Magento\Catalog\Model\Layer\Resolver;
use Magento\LayeredNavigation\Block\Navigation\Category\MultipleFiltersTest as CategoryFilterTest;
use Magento\Catalog\Model\Layer\Filter\AbstractFilter;
/**
* Provides tests for multiple custom select filters in navigation block on search page.
*
* @magentoAppArea frontend
* @magentoAppIsolation enabled
* @magentoDbIsolation disabled
*/
class MultipleFiltersTest extends CategoryFilterTest
{
/**
* @magentoDataFixture Magento/Catalog/_files/product_dropdown_attribute.php
* @magentoDataFixture Magento/Catalog/_files/configurable_attribute.php
* @magentoDataFixture Magento/Catalog/_files/category_with_three_products.php
* @dataProvider getMultipleActiveFiltersDataProvider
* @param array $products
* @param array $filters
* @param array $expectedProducts
* @return void
*/
public function testGetMultipleActiveFilters(
array $products,
array $filters,
array $expectedProducts
): void {
$this->updateAttributesAndProducts(
$products,
['is_filterable' => AbstractFilter::ATTRIBUTE_OPTIONS_ONLY_WITH_RESULTS, 'is_filterable_in_search' => 1]
);
$this->clearInstanceAndReindexSearch();
$this->navigationBlock->getRequest()->setParams(
array_merge($this->getMultipleRequestParams($filters), ['q' => $this->getSearchString()])
);
$this->navigationBlock->setLayout($this->layout);
$resultProducts = $this->getProductSkus($this->navigationBlock->getLayer()->getProductCollection());
self::assertEqualsCanonicalizing($expectedProducts, $resultProducts);
}
/**
* @inheritdoc
*/
protected function getLayerType(): string
{
return Resolver::CATALOG_LAYER_SEARCH;
}
}
@@ -0,0 +1,103 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\LayeredNavigation\Block\Navigation\Search;
use Magento\Catalog\Model\Layer\Filter\AbstractFilter;
use Magento\Catalog\Model\Layer\Resolver;
use Magento\LayeredNavigation\Block\Navigation\Category\MultiselectFilterTest as CategoryMultiselectFilterTest;
/**
* Provides tests for custom multiselect filter in navigation block on search page.
*
* @magentoAppArea frontend
* @magentoAppIsolation enabled
* @magentoDbIsolation disabled
*/
class MultiselectFilterTest extends CategoryMultiselectFilterTest
{
/**
* @magentoDataFixture Magento/Catalog/_files/multiselect_attribute.php
* @magentoDataFixture Magento/Catalog/_files/category_with_different_price_products.php
* @dataProvider getFiltersWithCustomAttributeDataProvider
* @param array $products
* @param array $attributeData
* @param array $expectation
* @return void
*/
public function testGetFiltersWithCustomAttribute(
array $products,
array $attributeData,
array $expectation
): void {
$this->getSearchFiltersAndAssert($products, $attributeData, $expectation);
}
/**
* @return array
*/
public function getFiltersWithCustomAttributeDataProvider(): array
{
$dataProvider = parent::getFiltersWithCustomAttributeDataProvider();
$dataProvider = array_replace_recursive(
$dataProvider,
[
'not_used_in_navigation' => [
'attribute_data' => [
'is_filterable_in_search' => 0,
],
],
'used_in_navigation_with_results' => [
'attribute_data' => [
'is_filterable' => AbstractFilter::ATTRIBUTE_OPTIONS_ONLY_WITH_RESULTS,
'is_filterable_in_search' => 1,
],
],
'used_in_navigation_without_results' => [
'attribute_data' => [
'is_filterable' => 0,
'is_filterable_in_search' => 1,
],
],
]
);
//TODO uncomment after fix MC-29227
//unset($dataProvider['used_in_navigation_without_results']['expectation'][1]);
//unset($dataProvider['used_in_navigation_without_results']['expectation'][2]);
//unset($dataProvider['used_in_navigation_without_results']['expectation'][3]);
return $dataProvider;
}
/**
* @magentoDataFixture Magento/Catalog/_files/multiselect_attribute.php
* @magentoDataFixture Magento/Catalog/_files/category_with_different_price_products.php
* @dataProvider getActiveFiltersWithCustomAttributeDataProvider
* @param array $products
* @param array $expectation
* @param string $filterValue
* @param int $productsCount
* @return void
*/
public function testGetActiveFiltersWithCustomAttribute(
array $products,
array $expectation,
string $filterValue,
int $productsCount
): void {
$this->getSearchActiveFiltersAndAssert($products, $expectation, $filterValue, $productsCount);
}
/**
* @inheritdoc
*/
protected function getLayerType(): string
{
return Resolver::CATALOG_LAYER_SEARCH;
}
}
@@ -0,0 +1,53 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\LayeredNavigation\Block\Navigation\Search;
use Magento\Catalog\Model\Layer\Filter\AbstractFilter;
use Magento\Catalog\Model\Layer\Resolver;
use Magento\LayeredNavigation\Block\Navigation\Category\OutOfStockProductsFilterTest as CategoryFilterTest;
/**
* Provides tests for select filter in navigation block on search page with out of stock products
* and enabled out of stock products displaying.
*
* @magentoAppArea frontend
* @magentoAppIsolation enabled
* @magentoDbIsolation disabled
*/
class OutOfStockProductsFilterTest extends CategoryFilterTest
{
/**
* @magentoDataFixture Magento/Catalog/_files/product_dropdown_attribute.php
* @magentoDataFixture Magento/Catalog/_files/out_of_stock_product_with_category.php
* @magentoDataFixture Magento/Catalog/_files/product_with_category.php
* @dataProvider getFiltersWithOutOfStockProduct
* @param int $showOutOfStock
* @param array $expectation
* @return void
*/
public function testGetFiltersWithOutOfStockProduct(int $showOutOfStock, array $expectation): void
{
$this->updateConfigShowOutOfStockFlag($showOutOfStock);
$this->getSearchFiltersAndAssert(
['out-of-stock-product' => 'Option 1', 'in-stock-product' => 'Option 2'],
[
'is_filterable' => AbstractFilter::ATTRIBUTE_OPTIONS_ONLY_WITH_RESULTS,
'is_filterable_in_search' => 1,
],
$expectation
);
}
/**
* @inheritdoc
*/
protected function getLayerType(): string
{
return Resolver::CATALOG_LAYER_SEARCH;
}
}
@@ -0,0 +1,66 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\LayeredNavigation\Block\Navigation\Search;
use Magento\Catalog\Model\Layer\Filter\AbstractFilter;
use Magento\Catalog\Model\Layer\Resolver;
use Magento\LayeredNavigation\Block\Navigation\Category\PriceFilterTest as CategoryPriceFilterTest;
/**
* Provides price filter tests with different price ranges calculation in navigation block on search page.
*
* @magentoAppArea frontend
* @magentoAppIsolation enabled
* @magentoDbIsolation disabled
*/
class PriceFilterTest extends CategoryPriceFilterTest
{
/**
* @magentoDataFixture Magento/Catalog/_files/category_with_three_products.php
* @dataProvider getFiltersDataProvider
* @param array $config
* @param array $products
* @param array $expectation
* @return void
*/
public function testGetFilters(array $config, array $products, array $expectation): void
{
$this->applyCatalogConfig($config);
$this->getSearchFiltersAndAssert(
$products,
[
'is_filterable' => AbstractFilter::ATTRIBUTE_OPTIONS_ONLY_WITH_RESULTS,
'is_filterable_in_search' => 1,
],
$expectation
);
}
/**
* @magentoDataFixture Magento/Catalog/_files/category_with_three_products.php
* @dataProvider getActiveFiltersDataProvider
* @param array $config
* @param array $products
* @param array $expectation
* @param string $filterValue
* @return void
*/
public function testGetActiveFilters(array $config, array $products, array $expectation, string $filterValue): void
{
$this->applyCatalogConfig($config);
$this->getSearchActiveFiltersAndAssert($products, $expectation, $filterValue, 1);
}
/**
* @inheritdoc
*/
protected function getLayerType(): string
{
return Resolver::CATALOG_LAYER_SEARCH;
}
}
@@ -0,0 +1,101 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\LayeredNavigation\Block\Navigation\Search;
use Magento\Catalog\Model\Layer\Filter\AbstractFilter;
use Magento\Catalog\Model\Layer\Resolver;
use Magento\LayeredNavigation\Block\Navigation\Category\SelectFilterTest as CategorySelectFilterTest;
/**
* Provides tests for custom select filter in navigation block on search page.
*
* @magentoAppArea frontend
* @magentoAppIsolation enabled
* @magentoDbIsolation disabled
*/
class SelectFilterTest extends CategorySelectFilterTest
{
/**
* @magentoDataFixture Magento/Catalog/_files/product_dropdown_attribute.php
* @magentoDataFixture Magento/Catalog/_files/category_with_different_price_products.php
* @dataProvider getFiltersWithCustomAttributeDataProvider
* @param array $products
* @param array $attributeData
* @param array $expectation
* @return void
*/
public function testGetFiltersWithCustomAttribute(
array $products,
array $attributeData,
array $expectation
): void {
$this->getSearchFiltersAndAssert($products, $attributeData, $expectation);
}
/**
* @return array
*/
public function getFiltersWithCustomAttributeDataProvider(): array
{
$dataProvider = parent::getFiltersWithCustomAttributeDataProvider();
$dataProvider = array_replace_recursive(
$dataProvider,
[
'not_used_in_navigation' => [
'attribute_data' => [
'is_filterable_in_search' => 0,
],
],
'used_in_navigation_with_results' => [
'attribute_data' => [
'is_filterable' => AbstractFilter::ATTRIBUTE_OPTIONS_ONLY_WITH_RESULTS,
'is_filterable_in_search' => 1,
],
],
'used_in_navigation_without_results' => [
'attribute_data' => [
'is_filterable' => 0,
'is_filterable_in_search' => 1,
],
],
]
);
//TODO uncomment after fix MC-29227
//unset($dataProvider['used_in_navigation_without_results']['expectation'][2]);
return $dataProvider;
}
/**
* @magentoDataFixture Magento/Catalog/_files/product_dropdown_attribute.php
* @magentoDataFixture Magento/Catalog/_files/category_with_different_price_products.php
* @dataProvider getActiveFiltersWithCustomAttributeDataProvider
* @param array $products
* @param array $expectation
* @param string $filterValue
* @param int $productsCount
* @return void
*/
public function testGetActiveFiltersWithCustomAttribute(
array $products,
array $expectation,
string $filterValue,
int $productsCount
): void {
$this->getSearchActiveFiltersAndAssert($products, $expectation, $filterValue, $productsCount);
}
/**
* @inheritdoc
*/
protected function getLayerType(): string
{
return Resolver::CATALOG_LAYER_SEARCH;
}
}