6 declare(strict_types=1);
25 private $popularSearchTerms;
30 private $scopeConfigMock;
35 private $queryCollectionMock;
44 $this->scopeConfigMock = $this->createMock(ScopeConfigInterface::class);
45 $this->queryCollectionMock = $this->createMock(Collection::class);
46 $this->popularSearchTerms =
new PopularSearchTerms($this->scopeConfigMock, $this->queryCollectionMock);
65 $this->scopeConfigMock->expects($this->once())->method(
'getValue')
70 )->willReturn($pageSize);
71 $this->queryCollectionMock->expects($this->once())->method(
'setPopularQueryFilter')->with(
$storeId)
73 $this->queryCollectionMock->expects($this->once())->method(
'setPageSize')->with($pageSize)
75 $this->queryCollectionMock->expects($this->once())->method(
'load')->willReturnSelf();
76 $this->queryCollectionMock->expects($this->once())->method(
'getColumnValues')->with(
'query_text')
79 $actual = $this->popularSearchTerms->isCacheable($term,
$storeId);
80 self::assertEquals($expected, $actual);
89 [
'test01', [],
false],
90 [
'test02', [
'test01',
'test02'],
true],
91 [
'test03', [
'test01',
'test02'],
false],
92 [
'test04', [
'test04'],
true],
const XML_PATH_MAX_COUNT_CACHEABLE_SEARCH_TERMS
isCacheableDataProvider()
testIsCacheable($term, $terms, $expected)