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/newslib.inc"; $bx = new box("80%", $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); $be = new box("80%", $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_error_font_color, $th_box_body_align); $bs = new box("100%", $th_strip_frame_color, $th_strip_frame_width, $th_strip_title_bgcolor, $th_strip_title_font_color, $th_strip_title_align, $th_strip_body_bgcolor, $th_strip_body_font_color, $th_strip_body_align); start_content(); $page = "news_mod"; if (check_proid($proid)) { top_bar($proid, $page); print $t->translate("News can be modified by the project owner(s)") . ".\n<br><p>\n"; if ((!isset($preview) || empty($preview)) && (!isset($submit) || empty($submit))) { $db->query("SELECT * FROM news WHERE subject_news='First Comment!'"); $db->next_record(); $subject = $db->f("subject_news"); $text = $db->f("text_news"); $creation = $db->f("creation_news"); } if (!isset($submit) || empty($submit)) { news_modify_form($proid); } else { news_modify($proid, "devel", $subject, $text, $creation); } } end_content(); require "include/footer.inc"; @page_close();
function testNews_modify() { global $db; $db_config = new mock_db_configure(2); $row = array(0 => $this->_generate_array(array("proid", "user", "subject", "text", "creation"), 0)); $db_q = array(0 => "UPDATE news SET user_news='%s', subject_news=" . "'%s', text_news='%s' WHERE proid='%s' AND " . "creation_news='%s'", 1 => "SELECT email_usr FROM auth_user,monitor " . "WHERE monitor.username=auth_user.username " . "AND proid='%s' AND importance='high'", 2 => "SELECT * FROM news,auth_user WHERE proid='%s' " . "AND user_news=username ORDER BY " . "creation_news DESC"); $db_config->add_query(sprintf($db_q[0], $row[0]["user"], $row[0]["subject"], $row[0]["text"], $row[0]["proid"], $row[0]["creation"]), 0); $db_config->add_query(sprintf($db_q[1], $row[0]["proid"]), 1); $db_config->add_query(sprintf($db_q[2], $row[0]["proid"]), 0); $db_config->add_num_row(0, 0); $db_config->add_record(false, 0); $db_config->add_record(false, 1); // // first call, no records // $db = new DB_SourceAgency(); capture_reset_and_start(); news_modify($row[0]["proid"], $row[0]["user"], $row[0]["subject"], $row[0]["text"], $row[0]["creation"]); $this->set_text(capture_stop_and_get()); $this->set_msg('test 1'); $this->_testFor_string_length(67); $this->_testFor_pattern("<p>There have not been posted any news " . "by the project owner[(]s[)][.]<p>\n"); // check that the database component did not fail $this->_check_db($db_config); }