public function testFetchAll() { $expectedResult = new \stdClass(); $bindParams = ['param_one' => 'value_one', 'param_two' => 'value_two']; $adapter = $this->getMock('Magento\\Framework\\DB\\Adapter\\Pdo\\Mysql', ['fetchAll'], [], '', false); $select = new \Magento\Framework\DB\Select($adapter); $adapter->expects($this->once())->method('fetchAll')->with($select, $bindParams)->will($this->returnValue($expectedResult)); $object = new \Magento\Framework\Data\Collection\Db\FetchStrategy\Query(); $this->assertSame($expectedResult, $object->fetchAll($select, $bindParams)); }
public function testFetchAll() { $expectedResult = new \stdClass(); $bindParams = ['param_one' => 'value_one', 'param_two' => 'value_two']; $adapter = $this->getMockForAbstractClass('Zend_Db_Adapter_Abstract', [], '', false, true, true, ['fetchAll']); $select = new \Zend_Db_Select($adapter); $adapter->expects($this->once())->method('fetchAll')->with($select, $bindParams)->will($this->returnValue($expectedResult)); $object = new \Magento\Framework\Data\Collection\Db\FetchStrategy\Query(); $this->assertSame($expectedResult, $object->fetchAll($select, $bindParams)); }