File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed
lib/internal/Magento/Framework/Test/Unit/DB/Query Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -97,6 +97,19 @@ public function testCurrent()
97
97
$ this ->selectMock ->expects ($ this ->once ())->method ('where ' )->with ($ filed . ' > ? ' , 0 );
98
98
$ this ->selectMock ->expects ($ this ->once ())->method ('limit ' )->with ($ this ->batchSize );
99
99
$ this ->selectMock ->expects ($ this ->once ())->method ('order ' )->with ($ filed . ' ASC ' );
100
+ $ this ->wrapperSelectMock ->expects ($ this ->once ())
101
+ ->method ('from ' )
102
+ ->with (
103
+ $ this ->selectMock ,
104
+ [
105
+ new \Zend_Db_Expr ('MAX( ' . $ this ->rangeFieldAlias . ') as max ' ),
106
+ new \Zend_Db_Expr ('COUNT(*) as cnt ' ),
107
+ ]
108
+ );
109
+ $ this ->connectionMock ->expects ($ this ->once ())
110
+ ->method ('fetchRow ' )
111
+ ->with ($ this ->wrapperSelectMock )
112
+ ->willReturn (['max ' => 10 , 'cnt ' => 10 ]);
100
113
$ this ->assertEquals ($ this ->selectMock , $ this ->model ->current ());
101
114
$ this ->assertEquals ($ this ->selectMock , $ this ->model ->current ());
102
115
$ this ->assertEquals (0 , $ this ->model ->key ());
Original file line number Diff line number Diff line change @@ -99,6 +99,16 @@ public function testCurrent()
99
99
{
100
100
$ this ->selectMock ->expects ($ this ->once ())->method ('limit ' )->with ($ this ->batchSize , $ this ->currentBatch );
101
101
$ this ->selectMock ->expects ($ this ->once ())->method ('order ' )->with ('correlationName.rangeField ' . ' ASC ' );
102
+ $ this ->wrapperSelectMock ->expects ($ this ->once ())
103
+ ->method ('from ' )
104
+ ->with (
105
+ $ this ->selectMock ,
106
+ [new \Zend_Db_Expr ('COUNT(*) as cnt ' )]
107
+ );
108
+ $ this ->connectionMock ->expects ($ this ->once ())
109
+ ->method ('fetchRow ' )
110
+ ->with ($ this ->wrapperSelectMock )
111
+ ->willReturn (['cnt ' => 10 ]);
102
112
$ this ->assertEquals ($ this ->selectMock , $ this ->model ->current ());
103
113
$ this ->assertEquals (0 , $ this ->model ->key ());
104
114
}
You can’t perform that action at this time.
0 commit comments