/** * @dataProvider distinctDataProvider */ public function testDistinct($flag, $expectedFlag) { $adapterMock = $this->getMock('Magento\\Framework\\DB\\Adapter\\Pdo\\Mysql', ['select'], [], '', false); $selectMock = $this->getMock('Magento\\Framework\\DB\\Select', ['distinct'], ['adapter' => $adapterMock]); $adapterMock->expects($this->once())->method('select')->will($this->returnValue($selectMock)); $selectMock->expects($this->once())->method('distinct')->with($expectedFlag); $this->collection->setConnection($adapterMock); $this->collection->distinct($flag); }