Example #1
0
 public function testGetData()
 {
     $adapterMock = $this->getMock('Zend_Db_Adapter_Pdo_Mysql', ['select', 'quoteInto', 'prepareSqlCondition', 'fetchOne'], [], '', false);
     $selectMock = $this->getMock('Magento\\Framework\\DB\\Select', ['orWhere', 'where', 'reset', 'columns'], ['adapter' => $adapterMock]);
     $selectMock->expects($this->once())->method('where')->with('aliasField3 = testValue3', null, \Magento\Framework\DB\Select::TYPE_CONDITION)->will($this->returnSelf());
     $adapterMock->expects($this->once())->method('select')->will($this->returnValue($selectMock));
     $adapterMock->expects($this->once())->method('prepareSqlCondition')->with('aliasField3', 'testValue3')->will($this->returnValue('aliasField3 = testValue3'));
     $this->collection->addFilter('testField3', 'testValue3', 'public');
     $this->collection->addFilterToMap('testFilter', 'testAlias', 'testGroup');
     $this->collection->addFilterToMap('testField3', 'aliasField3');
     $this->collection->setConnection($adapterMock);
     $this->assertNull($this->collection->getData());
 }