Report abuse

  /**
   * Test that countQuery properly removes fields and expressions.
   */
  function testCountQueryFieldRemovals() {
    $query = db_select('test');
    $query->fields('test', array('nonexistant'));
    $fail = FALSE;
    try {
      $query->countQuery()->execute();
    }
    catch (Exception $e) {
      $fail = TRUE;
    }
    $this->assertFALSE($fail, t('Count Query removed fields'));
  }