/** * Test for the clear method (clearing each query type). * * @return void * * @covers JDatabaseQuery::clear * @since 11.1 */ public function testClear_type() { $types = array( 'select', 'delete', 'update', 'insert', 'union', ); $clauses = array( 'from', 'join', 'set', 'where', 'group', 'having', 'order', 'columns', 'values', ); // Set the clauses. foreach ($clauses as $clause) { $this->_instance->$clause = $clause; } // Check that all properties have been cleared foreach ($types as $type) { // Set the type. $this->_instance->$type = $type; // Clear the type. $this->_instance->clear($type); // Check the type has been cleared. $this->assertThat( $this->_instance->type, $this->equalTo(null) ); $this->assertThat( $this->_instance->get($type), $this->equalTo(null) ); // Now check the claues have not been affected. foreach ($clauses as $clause) { $this->assertThat( $this->_instance->get($clause), $this->equalTo($clause) ); } } }