コード例 #1
0
ファイル: DbTest.php プロジェクト: pradeep-wagento/magento2
 public function testGetSelectSql()
 {
     $adapterMock = $this->getMock('Magento\\Framework\\DB\\Adapter\\Pdo\\Mysql', ['select'], [], '', false);
     $selectMock = $this->getMock('Magento\\Framework\\DB\\Select', ['__toString'], ['adapter' => $adapterMock]);
     $adapterMock->expects($this->once())->method('select')->will($this->returnValue($selectMock));
     $sql = 'query';
     $selectMock->expects($this->once())->method('__toString')->will($this->returnValue($sql));
     $this->collection->setConnection($adapterMock);
     $this->assertEquals($sql, $this->collection->getSelectSql(true));
     $this->assertEquals($selectMock, $this->collection->getSelectSql());
 }