/**
  *
  * @dataProvider getWhereStringProvider
  */
 public function testGetWhereString($wheres, $expected, $expectedFormatted, $expectedBoundParameters)
 {
     foreach ($wheres as $where) {
         $nbWhere = count($where);
         if ($nbWhere == 4) {
             $this->queryBuilder->where($where[0], $where[1], $where[2], $where[3]);
         } elseif ($nbWhere >= 1 && $nbWhere <= 2) {
             if ($where[0] == '(') {
                 if (isset($where[1])) {
                     $this->queryBuilder->_open($where[1]);
                 } else {
                     $this->queryBuilder->_open();
                 }
             } elseif ($where[0] == ')') {
                 $this->queryBuilder->_close();
             }
         }
     }
     $this->assertEquals($expected, $this->queryBuilder->getWhereString());
     $this->assertEquals($expectedFormatted, $this->queryBuilder->getWhereString(true));
     $this->assertEquals($expectedBoundParameters, $this->queryBuilder->getBoundParameters());
     $this->assertEquals($expectedBoundParameters, $this->queryBuilder->getBoundParameters(false, 'where'));
     $this->assertEquals(array(), $this->queryBuilder->getBoundParameters(false, 'having'));
 }
Ejemplo n.º 2
0
 /**
  * Adds an open bracket for nesting WHERE conditions.
  *
  * @param  string                  $connector optional logical connector, default AND
  * @return \SQL\DeleteQueryBuilder
  */
 public function _open($connector = self::LOGICAL_AND)
 {
     return parent::_open($connector);
 }