$bx->box_column_start("right", "33%", ""); personal_consultants($auth->auth["uname"], "P"); $bx->box_column_finish(); $bx->box_column_start("right", "33%", ""); personal_consultants($auth->auth["uname"], "R"); $bx->box_column_finish(); $bx->box_columns_end(); $bx->box_body_end(); $bx->box_end(); $bx->box_begin(); $bx->box_body_begin(); $bx->box_columns_begin(3, 'top'); $bx->box_column_start("right", "34%", ""); personal_referees($auth->auth["uname"], "A"); $bx->box_column_finish(); $bx->box_column_start("right", "33%", ""); personal_referees($auth->auth["uname"], "P"); $bx->box_column_finish(); $bx->box_column_start("right", "33%", ""); personal_referees($auth->auth["uname"], "R"); $bx->box_column_finish(); $bx->box_columns_end(); $bx->box_body_end(); $bx->box_end(); } personal_comments_short($auth->auth["uname"]); personal_news_short($auth->auth["uname"]); } end_content(); require "include/footer.inc"; @page_close();
function testPersonal_comments_short() { global $bx; $user1 = "fubar"; $user2 = "snafu"; $user3 = "fritz"; $db_config = new mock_db_configure(4); $db_q = array(0 => "SELECT * FROM comments WHERE user_cmt='%s' " . "AND comments.proid", 1 => "SELECT COUNT(*) FROM comments WHERE proid='%s'" . " AND type='%s' 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_query(sprintf($db_q[0], $user3), 4); $db_config->add_num_row(0, 0); // fubar generates zero $db_config->add_record(false, 0); $db_config->add_num_row(2, 1); // snafu generates two $db_config->add_num_row(12, 4); // fritz generates 12 $cols = array('id', 'proid', 'type', 'number', 'subject_cmt', 'creation_cmt', 'ref'); // queries for snafu $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); // queries for fritz $row7 = $this->_generate_array($cols, 7); $db_config->add_record($row7, 4); $row8 = $this->_generate_array($cols, 8); $db_config->add_record($row8, 4); $row9 = $this->_generate_array($cols, 9); $db_config->add_record($row9, 4); $row10 = $this->_generate_array($cols, 10); $db_config->add_record($row10, 4); $row11 = $this->_generate_array($cols, 11); $db_config->add_record($row11, 4); $row12 = $this->_generate_array($cols, 12); $db_config->add_record($row12, 4); $row13 = $this->_generate_array($cols, 13); $db_config->add_record($row13, 4); $row14 = $this->_generate_array($cols, 14); $db_config->add_record($row14, 4); $row15 = $this->_generate_array($cols, 15); $db_config->add_record($row15, 4); $row16 = $this->_generate_array($cols, 16); $db_config->add_record($row16, 4); $row17 = $this->_generate_array($cols, 17); $db_config->add_record($row17, 4); $row18 = $this->_generate_array($cols, 18); $db_config->add_record($row18, 4); // sub-queries for snafu $db_config->add_query(sprintf($db_q[1], $row1['proid'], $row1['type'], $row1['id']), 2); $row3 = array('COUNT(*)' => 'this is count start row3'); $db_config->add_record($row3, 2); $db_config->add_query(sprintf($db_q[2], $row1['proid']), 2); $row4 = array('proid' => 'proid_row4', 'project_title' => 'project title row4'); $db_config->add_record($row4, 2); $db_config->add_query(sprintf($db_q[1], $row2['proid'], $row2['type'], $row2['id']), 3); $row5 = array('COUNT(*)' => 'this is count start row5'); $db_config->add_record($row5, 3); $db_config->add_query(sprintf($db_q[2], $row2['proid']), 3); $row6 = array('proid' => 'proid_row6', 'project_title' => 'project title row6'); $db_config->add_record($row6, 3); // // fubar query // $bx = $this->_create_default_box(); capture_reset_and_start(); // here next_record will not be called personal_comments_short($user1); $this->set_text(capture_stop_and_get()); $this->set_msg('test 1'); $this->_testFor_string_length(727); $this->_testFor_pattern("Last 10 Comments by " . $user1); $this->_testFor_pattern("no comments posted\n"); $this->reverse_next_test(); $this->_testFor_pattern('See all the comments...'); // // snafu query // $bx = $this->_create_default_box(); capture_reset_and_start(); // here next_record will not be called personal_comments_short($user2); $this->set_text(capture_stop_and_get()); $this->set_msg('test 2'); $this->_testFor_string_length(1302); $this->_testFor_pattern("Last 10 Comments by " . $user2); $this->reverse_next_test(); $this->_testFor_pattern('no comments posted'); $this->reverse_next_test(); $this->_testFor_pattern('See all the comments...'); $this->_testFor_comment_line($row1['type'], $row1['proid'], $row1['number'], $row1['ref'], $row1['subject_cmt'], $row3['COUNT(*)'], $row4['proid'], $row4['project_title']); $this->_testFor_comment_line($row2['type'], $row2['proid'], $row2['number'], $row2['ref'], $row2['subject_cmt'], $row5['COUNT(*)'], $row6['proid'], $row6['project_title']); // if using a database, then ensure that it didn't fail $this->_check_db($db_config); }