33 private $resourceConnectionMock;
43 private $storeManagerMock;
48 private $aliasResolverMock;
52 $this->resourceConnectionMock = $this->createMock(ResourceConnection::class);
53 $this->adapterMock = $this->createMock(AdapterInterface::class);
54 $this->resourceConnectionMock->expects($this->any())->method(
'getConnection')->willReturn($this->adapterMock);
55 $this->storeManagerMock = $this->createMock(StoreManagerInterface::class);
56 $this->aliasResolverMock = $this->createMock(AliasResolver::class);
58 $this->indexScopeResolverMock = $this->createMock(
59 \
Magento\Framework\Search\Request\IndexScopeResolverInterface::class
61 $this->tableResolverMock = $this->createMock(
62 \
Magento\Framework\Indexer\ScopeResolver\IndexScopeResolver::class
64 $this->dimensionMock = $this->createMock(\
Magento\Framework\Indexer\Dimension::class);
65 $this->dimensionFactoryMock = $this->createMock(\
Magento\Framework\Indexer\DimensionFactory::class);
66 $this->dimensionFactoryMock->method(
'create')->willReturn($this->dimensionMock);
67 $storeMock = $this->createMock(\
Magento\
Store\Api\Data\StoreInterface::class);
68 $storeMock->method(
'getId')->willReturn(1);
69 $storeMock->method(
'getWebsiteId')->willReturn(1);
70 $this->storeManagerMock->method(
'getStore')->willReturn($storeMock);
71 $this->indexScopeResolverMock->method(
'resolve')->willReturn(
'catalog_product_index_price');
72 $this->httpContextMock = $this->createMock(\
Magento\Framework\
App\Http\Context::class);
73 $this->httpContextMock->method(
'getValue')->willReturn(1);
76 $this->resourceConnectionMock,
77 $this->storeManagerMock,
78 $this->aliasResolverMock,
79 $this->tableResolverMock,
80 $this->dimensionFactoryMock,
81 $this->indexScopeResolverMock,
82 $this->httpContextMock
90 $selectMock = $this->createMock(Select::class);
91 $selectMock->expects($this->any())->method(
'joinInner')->willReturnSelf();
92 $selectMock->expects($this->any())->method(
'getPart')->willReturn([]);
94 $searchFilterMock = $this->createMock(Term::class);
95 $searchFilterMock->expects($this->any())->method(
'getField')->willReturn(
$attributeCode);
97 $websiteMock = $this->createMock(WebsiteInterface::class);
98 $websiteMock->expects($this->any())->method(
'getId')->willReturn(
$websiteId);
99 $this->storeManagerMock->expects($this->any())->method(
'getWebsite')->willReturn($websiteMock);
101 $this->assertTrue($this->model->apply($searchFilterMock, $selectMock));
testApplyUsesFrontendPriceIndexerTableIfAttributeCodeIsPrice()