function testIs_main_developer() { // TODO: find a way to better to combine tests, i.e. this function // TODO: uses the is_accepted_developer and don't need to include // TODO: those queries in the mock database, but we have to! global $auth; $auth = new Auth(); $d = array("u0" => "fubar", "r0" => "proid1", "p0" => "p1", "e0" => 1, "u1" => "snafu", "r1" => "proid2", "p1" => "p2", "e1" => 0, "u2" => "user3", "r2" => "proid3", "p2" => "", "e2" => 0); $proid4 = "proid"; // require four instances of the DB_SourceAgency class $db_config = new mock_db_configure(4); $db_q = array(0 => $this->queries["is_main_developer"], 1 => $this->queries["is_accepted_developer"]); $db_config->add_query(sprintf($db_q[1], $d["r0"], $d["u0"]), 0); $db_config->add_query(sprintf($db_q[0], $d["r0"], $d["u0"]), 1); $db_config->add_num_row($d["e0"], 0); $db_config->add_num_row($d["e0"], 1); $db_config->add_query(sprintf($db_q[1], $d["r1"], $d["u1"]), 2); $db_config->add_query(sprintf($db_q[0], $d["r1"], $d["u1"]), 3); // is.accepted.developer returns true $db_config->add_num_row(1, 2); $db_config->add_num_row($d["e1"], 3); for ($idx = 0; $idx < sizeof($d) / 4; $idx++) { $auth->set_uname($d["u" . $idx]); $auth->set_perm($d["p" . $idx]); $this->assertEquals($d["e" . $idx], is_main_developer($d["r" . $idx]), "Index was " . $idx, "Test {$idx}"); } // unset auth and check again. unset($GLOBALS['auth']); $this->assertEquals(true, isset($auth), 'Line: ' . __LINE__); $this->assertEquals(false, isset($GLOBALS['auth']), 'Line: ' . __LINE__); $this->assertEquals(0, is_main_developer($proid4), 'Line: ' . __LINE__); // if using a database, then ensure that it didn't fail $this->_check_db($db_config); }
# # This is the index file which shows the recent apps # # 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/refereeslib.inc"; require "include/decisionslib.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 = "referees"; if (check_proid($proid)) { top_bar($proid, $page); print $t->translate("Referee registration and selection. Any developer " . "who has the skills to be a referee can propose " . "himself as one") . ".\n"; print "<p align=right>[ <b>" . html_link("step4_edit.php", array("proid" => $proid), $t->translate("Propose yourself as referee")) . "</b> ]\n"; show_referees($proid); if (is_accepted_sponsor($proid) || is_main_developer($proid)) { create_decision_link($proid); } } end_content(); require "include/footer.inc"; @page_close();