コード例 #1
0
ファイル: QueryTest.php プロジェクト: jbanety/database
 /**
  * Tests the \Joomla\Database\DatabaseQuery::having method.
  *
  * @return  void
  *
  * @covers  \Joomla\Database\DatabaseQuery::having
  * @since   1.0
  */
 public function testHaving()
 {
     $this->assertThat($this->instance->having('COUNT(foo) > 1'), $this->identicalTo($this->instance), 'Tests chaining.');
     $this->assertThat(trim(TestHelper::getValue($this->instance, 'having')), $this->equalTo('HAVING COUNT(foo) > 1'), 'Tests rendered value.');
     // Add another column.
     $this->instance->having('COUNT(bar) > 2');
     $this->assertThat(trim(TestHelper::getValue($this->instance, 'having')), $this->equalTo('HAVING COUNT(foo) > 1 AND COUNT(bar) > 2'), 'Tests rendered value after second use.');
     // Reset the field to test the glue.
     TestHelper::setValue($this->instance, 'having', null);
     $this->instance->having('COUNT(foo) > 1', 'OR');
     $this->instance->having('COUNT(bar) > 2');
     $this->assertThat(trim(TestHelper::getValue($this->instance, 'having')), $this->equalTo('HAVING COUNT(foo) > 1 OR COUNT(bar) > 2'), 'Tests rendered value with OR glue.');
 }