@@ -45,6 +45,16 @@ class AbstractCollectionTest extends \PHPUnit_Framework_TestCase
45
45
*/
46
46
protected $ _db ;
47
47
48
+ /**
49
+ * @var \Magento\Framework\DB\Adapter\AdapterInterface|\PHPUnit_Framework_MockObject_MockObject
50
+ */
51
+ private $ connectionMock ;
52
+
53
+ /**
54
+ * @var \Magento\Framework\DB\Select|\PHPUnit_Framework_MockObject_MockObject
55
+ */
56
+ private $ selectMock ;
57
+
48
58
protected function setUp ()
49
59
{
50
60
$ this ->_entityFactoryMock = $ this ->getMock (\Magento \Framework \Data \Collection \EntityFactoryInterface::class);
@@ -152,6 +162,30 @@ public function testAddWebsiteFilter()
152
162
);
153
163
}
154
164
165
+ public function testAddWebsiteFilterArray ()
166
+ {
167
+ $ this ->selectMock = $ this ->getMockBuilder (\Magento \Framework \DB \Select::class)
168
+ ->disableOriginalConstructor ()
169
+ ->getMock ();
170
+
171
+ $ this ->connectionMock = $ this ->getMockBuilder (\Magento \Framework \DB \Adapter \AdapterInterface::class)
172
+ ->disableOriginalConstructor ()
173
+ ->getMockForAbstractClass ();
174
+ $ this ->connectionMock ->expects ($ this ->atLeastOnce ())
175
+ ->method ('quoteInto ' )
176
+ ->with ($ this ->equalTo ('website. IN (?) ' ), $ this ->equalTo (['2 ' , '3 ' ]))
177
+ ->willReturn (true );
178
+
179
+ $ this ->abstractCollection ->expects ($ this ->atLeastOnce ())->method ('getSelect ' )->willReturn ($ this ->selectMock );
180
+ $ this ->abstractCollection ->expects ($ this ->atLeastOnce ())->method ('getConnection ' )
181
+ ->willReturn ($ this ->connectionMock );
182
+
183
+ $ this ->assertInstanceOf (
184
+ \Magento \Rule \Model \ResourceModel \Rule \Collection \AbstractCollection::class,
185
+ $ this ->abstractCollection ->addWebsiteFilter (['2 ' , '3 ' ])
186
+ );
187
+ }
188
+
155
189
public function testAddFieldToFilter ()
156
190
{
157
191
$ this ->_prepareAddFilterStubs ();
0 commit comments