Exemple #1
0
 /**
  * Test that field is quoted when added to SQL via addFieldToFilter()
  */
 public function testAddFieldToFilterFieldIsQuoted()
 {
     $adapter = $this->getMock('Zend_Db_Adapter_Pdo_Mysql', ['quoteIdentifier', 'prepareSqlCondition'], [], '', false);
     $adapter->expects($this->once())->method('quoteIdentifier')->with('email')->will($this->returnValue('`email`'));
     $adapter->expects($this->any())->method('prepareSqlCondition')->with($this->stringContains('`email`'), $this->anything())->will($this->returnValue('`email` = "*****@*****.**"'));
     $this->collection->setConnection($adapter);
     $select = $this->collection->getSelect()->from('test');
     $this->collection->addFieldToFilter('email', ['eq' => '*****@*****.**']);
     $this->assertEquals('SELECT `test`.* FROM `test` WHERE (`email` = "*****@*****.**")', $select->assemble());
 }