File tree 2 files changed +42
-1
lines changed
Model/ResourceModel/Review/Customer
Test/Unit/Model/ResourceModel/Report/Review/Customer 2 files changed +42
-1
lines changed Original file line number Diff line number Diff line change @@ -106,7 +106,7 @@ protected function _joinCustomers()
106
106
*/
107
107
public function getSelectCountSql ()
108
108
{
109
- $ countSelect = clone $ this ->_select ;
109
+ $ countSelect = clone $ this ->getSelect () ;
110
110
$ countSelect ->reset (\Magento \Framework \DB \Select::ORDER );
111
111
$ countSelect ->reset (\Magento \Framework \DB \Select::GROUP );
112
112
$ countSelect ->reset (\Magento \Framework \DB \Select::HAVING );
Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * CollectionTest
4
+ *
5
+ * @copyright Copyright (c) 2017 Interactiv4
6
+
7
+ */
8
+
9
+ namespace Magento \Reports \Test \Unit \Model \ResourceModel \Review \Customer ;
10
+
11
+ use Magento \Framework \DB \Select ;
12
+ use Magento \Reports \Model \ResourceModel \Review \Customer \Collection ;
13
+
14
+ class CollectionTest extends \PHPUnit \Framework \TestCase
15
+ {
16
+ /**
17
+ * @var \PHPUnit_Framework_MockObject_MockObject
18
+ */
19
+ protected $ selectMock ;
20
+
21
+ protected function setUp ()
22
+ {
23
+ $ this ->selectMock = $ this ->createMock (Select::class);
24
+ }
25
+
26
+ public function testGetSelectCountSql ()
27
+ {
28
+ /** @var $collection \PHPUnit_Framework_MockObject_MockObject */
29
+ $ collection = $ this ->getMockBuilder (Collection::class)
30
+ ->setMethods (['getSelect ' ])
31
+ ->disableOriginalConstructor ()
32
+ ->getMock ();
33
+
34
+ $ collection ->expects ($ this ->atLeastOnce ())->method ('getSelect ' )->willReturn ($ this ->selectMock );
35
+
36
+ $ this ->selectMock ->expects ($ this ->atLeastOnce ())->method ('reset ' )->willReturnSelf ();
37
+ $ this ->selectMock ->expects ($ this ->exactly (1 ))->method ('columns ' )->willReturnSelf ();
38
+
39
+ $ this ->assertEquals ($ this ->selectMock , $ collection ->getSelectCountSql ());
40
+ }
41
+ }
You can’t perform that action at this time.
0 commit comments