@@ -49,47 +49,28 @@ protected function setUp()
49
49
/**
50
50
* Test isCacheableDataProvider method
51
51
*
52
- * @dataProvider isCacheableDataProvider
53
- *
54
52
* @param string $term
55
53
* @param array $terms
56
54
* @param $expected $terms
57
55
*
58
56
* @return void
59
57
*/
60
- public function testIsCacheable ($ term , $ terms , $ expected )
58
+ public function testIsCacheable ()
61
59
{
62
- $ storeId = 7 ;
63
- $ pageSize = 25 ;
64
-
60
+ $ term = 'test1 ' ;
61
+ $ storeId = 1 ;
62
+ $ pageSize = 35 ;
63
+
65
64
$ this ->scopeConfigMock ->expects ($ this ->once ())->method ('getValue ' )
66
65
->with (
67
66
PopularSearchTerms::XML_PATH_MAX_COUNT_CACHEABLE_SEARCH_TERMS ,
68
67
ScopeInterface::SCOPE_STORE ,
69
68
$ storeId
70
69
)->willReturn ($ pageSize );
71
- $ this ->queryCollectionMock ->expects ($ this ->once ())->method ('setPopularQueryFilter ' )->with ($ storeId )
72
- ->willReturnSelf ();
73
- $ this ->queryCollectionMock ->expects ($ this ->once ())->method ('setPageSize ' )->with ($ pageSize )
74
- ->willReturnSelf ();
75
- $ this ->queryCollectionMock ->expects ($ this ->once ())->method ('load ' )->willReturnSelf ();
76
- $ this ->queryCollectionMock ->expects ($ this ->once ())->method ('getColumnValues ' )->with ('query_text ' )
77
- ->willReturn ($ terms );
78
-
79
- $ actual = $ this ->popularSearchTerms ->isCacheable ($ term , $ storeId );
80
- self ::assertEquals ($ expected , $ actual );
81
- }
70
+ $ this ->queryCollectionMock ->expects ($ this ->once ())->method ('isTopSearchResult ' )->with ($ term , $ storeId , $ pageSize )
71
+ ->willReturn (true , false );
82
72
83
- /**
84
- * @return array
85
- */
86
- public function isCacheableDataProvider ()
87
- {
88
- return [
89
- ['test01 ' , [], false ],
90
- ['test02 ' , ['test01 ' , 'test02 ' ], true ],
91
- ['test03 ' , ['test01 ' , 'test02 ' ], false ],
92
- ['test04 ' , ['test04 ' ], true ],
93
- ];
73
+ $ this ->assertTrue ($ this ->popularSearchTerms ->isCacheable ($ term , $ storeId ));
74
+ $ this ->assertFalse ($ this ->popularSearchTerms ->isCacheable ($ term , $ storeId ));
94
75
}
95
76
}
0 commit comments