Esempio n. 1
0
 public function testConditionalMethods()
 {
     $this->assertSame($this->queryBuilder, $this->queryBuilder->_if(true));
     $this->assertSame($this->queryBuilder, $this->queryBuilder->_endif());
     $this->assertInstanceOf('\\SQL\\Proxy\\QueryConditionalProxy', $this->queryBuilder->_if(false));
     $this->assertSame($this->queryBuilder, $this->queryBuilder->_endif());
     $this->assertSame($this->queryBuilder, $this->queryBuilder->_if(true));
     $this->assertInstanceOf('\\SQL\\Proxy\\QueryConditionalProxy', $this->queryBuilder->_elseif(false));
     $this->assertInstanceOf('\\SQL\\Proxy\\QueryConditionalProxy', $this->queryBuilder->_else(false));
     $this->assertSame($this->queryBuilder, $this->queryBuilder->_endif());
     $this->assertInstanceOf('\\SQL\\Proxy\\QueryConditionalProxy', $this->queryBuilder->_if(false));
     $this->assertSame($this->queryBuilder, $this->queryBuilder->_elseif(true));
     $this->assertInstanceOf('\\SQL\\Proxy\\QueryConditionalProxy', $this->queryBuilder->_else(false));
     $this->assertSame($this->queryBuilder, $this->queryBuilder->_endif());
     $this->assertInstanceOf('\\SQL\\Proxy\\QueryConditionalProxy', $this->queryBuilder->_if(false));
     $this->assertInstanceOf('\\SQL\\Proxy\\QueryConditionalProxy', $this->queryBuilder->_elseif(false));
     $this->assertSame($this->queryBuilder, $this->queryBuilder->_else());
     $this->assertSame($this->queryBuilder, $this->queryBuilder->_endif());
     $this->assertSame($this->queryBuilder, $this->queryBuilder->_if(true));
     $this->assertInstanceOf('\\SQL\\Proxy\\QueryConditionalProxy', $this->queryBuilder->_if(false));
     $this->assertSame($this->queryBuilder, $this->queryBuilder->_endif());
     $this->assertSame($this->queryBuilder, $this->queryBuilder->_endif());
 }
 /**
  * Returns a new level QueryConditionalProxy instance.
  * Allows for conditional statements in a fluid interface.
  *
  * @param bool $cond
  *
  * @return \SQL\Proxy\QueryConditionalProxy
  */
 public function _if($cond)
 {
     return $this->query->_if($cond);
 }