/** * Tests the JDatabaseQuery::union method. * * @return void * * @since 12.1 */ public function testUnionClear() { $q = new JDatabaseQueryInspector($this->dbo); $q->union = null; $q->order = null; $q->order('bar'); $q->union('SELECT name FROM foo'); $this->assertThat($q->order, $this->equalTo(null), 'Tests that ORDER BY is cleared with union.'); }
/** * Tests the JDatabaseQuery::order method. * * @return void * * @since 11.3 */ public function testOrder() { $q = new JDatabaseQueryInspector($this->dbo); $this->assertThat($q->order('foo'), $this->identicalTo($q), 'Tests chaining.'); $this->assertThat(trim($q->order), $this->equalTo('ORDER BY foo'), 'Tests rendered value.'); // Add another column. $q->order('bar'); $this->assertThat(trim($q->order), $this->equalTo('ORDER BY foo,bar'), 'Tests rendered value after second use.'); $q->order(array('goo', 'car')); $this->assertThat(trim($q->order), $this->equalTo('ORDER BY foo,bar,goo,car'), 'Tests array input.'); }