function testPersonal_news_long()
 {
     global $bx;
     $user1 = "fubar";
     $user2 = "snafu";
     // 4 instances: 1 for the fubar query, 3 for the snafu query (we
     // call personal_news_long twice). The snafu database has two
     // entries, each of which create separate database instances, hence
     // we need a total of 3 instances for the snafu query
     $db_config = new mock_db_configure(4);
     $db_q = array(0 => "SELECT * FROM news WHERE user_news='%s' " . "AND news.proid", 1 => "SELECT COUNT(*) FROM comments WHERE proid='%s" . "' AND type='News' AND ref='%s'", 2 => "SELECT * FROM description WHERE proid='%s'");
     $db_config->add_query(sprintf($db_q[0], $user1), 0);
     $db_config->add_query(sprintf($db_q[0], $user2), 1);
     $db_config->add_num_row(0, 0);
     $db_config->add_num_row(2, 1);
     $db_config->add_record(false, 0);
     $cols = array('id', 'subject_news', 'project_title', 'proid', 'creation_news');
     $row1 = $this->_generate_array($cols, 1);
     $db_config->add_record($row1, 1);
     $row2 = $this->_generate_array($cols, 2);
     $db_config->add_record($row2, 1);
     $db_config->add_record(false, 1);
     $row3 = array('COUNT(*)' => 'count star value 3');
     $db_config->add_record($row3, 2);
     $row4 = array('project_title' => 'reference_id_instance_4', 'proid' => 'project_id_instance_4');
     $db_config->add_record($row4, 2);
     $row5 = array('COUNT(*)' => 'count star value 5');
     $db_config->add_record($row5, 3);
     $row6 = array('project_title' => 'reference_id_instance_6', 'proid' => 'project_id_instance_6');
     $db_config->add_record($row6, 3);
     $db_config->add_query(sprintf($db_q[1], $row1['proid'], $row1['id']), 2);
     $db_config->add_query(sprintf($db_q[2], $row1['proid']), 2);
     $db_config->add_query(sprintf($db_q[1], $row2['proid'], $row2['id']), 3);
     $db_config->add_query(sprintf($db_q[2], $row2['proid']), 3);
     //
     // fubar query
     //
     $bx = $this->_create_default_box();
     capture_reset_and_start();
     // here next_record will not be called
     personal_news_long($user1);
     $this->set_text(capture_stop_and_get());
     $this->set_msg('test 1');
     $this->_testFor_string_length(715);
     $this->_testFor_pattern("All news by " . $user1);
     $this->_testFor_pattern("no news posted\n");
     //
     // snafu query
     //
     $bx = $this->_create_default_box();
     capture_reset_and_start();
     // here next_record will not be called
     personal_news_long($user2);
     $this->set_text(capture_stop_and_get());
     $this->set_msg('test 2');
     $this->_testFor_string_length(1208);
     $this->_testFor_pattern("All news by " . $user2);
     $this->_testFor_news_link($row1['proid'], $row1['subject_news'], $row3['COUNT(*)'], $row4['proid'], $row4['project_title']);
     $this->_testFor_news_link($row2['proid'], $row2['subject_news'], $row5['COUNT(*)'], $row6['proid'], $row6['project_title']);
     // if using a database, then ensure that it didn't fail
     $this->_check_db($db_config);
 }
######################################################################
# SourceAgency:
# ================================================
#
# Copyright (c) 2001-2003 by
#             Gregorio Robles (grex@scouts-es.org)
#
# BerliOS SourceAgency: http://sourceagency.berlios.de
# BerliOS - The OpenSource Mediator: http://www.berlios.de
#
#
#
# This program is free software. You can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 or later of the GPL.
######################################################################
require "include/prepend.php3";
page_open(array("sess" => "SourceAgency_Session"));
if (isset($auth) && !empty($auth->auth["perm"])) {
    page_close();
    page_open(array("sess" => "SourceAgency_Session", "auth" => "SourceAgency_Auth", "perm" => "SourceAgency_Perm"));
}
require "include/header.inc";
require "include/personallib.inc";
$bx = new box("100%", $th_box_frame_color, $th_box_frame_width, $th_box_title_bgcolor, $th_box_title_font_color, $th_box_title_align, $th_box_body_bgcolor, $th_box_body_font_color, $th_box_body_align);
start_content();
$page = "personal_news";
personal_news_long($auth->auth["uname"]);
end_content();
require "include/footer.inc";
page_close();