Esempio n. 1
0
 $bx->box_column_finish();
 $bx->box_columns_end();
 $bx->box_body_end();
 $bx->box_end();
 if ($auth->auth["perm"] != "sponsor_pending" && $auth->auth["perm"] != "devel_pending" && $auth->auth["perm"] != "editor" && $auth->auth["perm"] != "admin" && $auth->auth["perm"] != "editor,admin") {
     $bx->box_begin();
     $bx->box_body_begin();
     $bx->box_columns_begin(3, 'top');
     $bx->box_column_start("right", "34%", "");
     personal_related_projects($auth->auth["uname"], "A");
     $bx->box_column_finish();
     $bx->box_column_start("right", "33%", "");
     personal_related_projects($auth->auth["uname"], "P");
     $bx->box_column_finish();
     $bx->box_column_start("right", "33%", "");
     personal_related_projects($auth->auth["uname"], "R");
     $bx->box_column_finish();
     $bx->box_columns_end();
     $bx->box_body_end();
     $bx->box_end();
 }
 if (is_developer($auth->auth["uname"]) && $auth->auth["perm"] != "devel_pending" && $auth->auth["perm"] != "editor" && $auth->auth["perm"] != "admin" && $auth->auth["perm"] != "editor,admin") {
     $bx->box_begin();
     $bx->box_body_begin();
     $bx->box_columns_begin(3, 'top');
     $bx->box_column_start("right", "34%", "");
     personal_consultants($auth->auth["uname"], "A");
     $bx->box_column_finish();
     $bx->box_column_start("right", "33%", "");
     personal_consultants($auth->auth["uname"], "P");
     $bx->box_column_finish();
 function testPersonal_related_projects()
 {
     global $auth, $bx;
     // status can be one of: P(Proposed),N(Negotiating),A(Accepted),
     //                       R(Rejected),D(Delete),M(Modified)
     $user1 = "fubar";
     $user2 = "snafu";
     $user3 = "fritz";
     $table1 = "sponsoring";
     $user_type1 = "sponsor";
     $status1 = "P";
     $table2 = "developing";
     $user_type2 = "developer";
     $status2 = "D";
     $db_config = new mock_db_configure(5);
     $db_q = array(0 => "SELECT * FROM auth_user WHERE perms " . "LIKE '%%sponsor%%' " . "AND username='******'", 1 => "SELECT * FROM %s,description WHERE " . "%s='%s' AND %s.status='%s' AND %s.proid=" . "description.proid  ORDER BY creation DESC", 2 => "SELECT * FROM auth_user WHERE perms " . "LIKE '%%devel%%' " . "AND username='******'");
     // Database instances:
     //  fubar:
     //    0 created by personal_related_projects
     //    1 created by is_sponsor
     //  snafu:
     //    2 created by personal_related_projects
     //    3 created by is_sponsor
     //    4 created by is_developer
     $db_config->add_query(sprintf($db_q[1], $table1, $user_type1, $user1, $table1, $status1, $table1), 0);
     $db_config->add_query(sprintf($db_q[0], $user1), 1);
     $db_config->add_num_row(0, 0);
     // fubar not related to any projects
     $db_config->add_record(false, 0);
     $db_config->add_num_row(1, 1);
     // return one, fubar is sponsor
     $db_config->add_query(sprintf($db_q[1], $table2, $user_type2, $user2, $table2, $status2, $table2), 2);
     $db_config->add_query(sprintf($db_q[0], $user2), 3);
     //is_sponsor
     $db_config->add_query(sprintf($db_q[2], $user2), 4);
     //is_sponsor
     $db_config->add_num_row(0, 2);
     // snafu also has no relate projects
     $db_config->add_record(false, 2);
     $db_config->add_num_row(0, 3);
     $db_config->add_num_row(1, 4);
     //
     // fubar
     //
     $auth->set_uname($user1);
     $auth->set_perm("hell yes!");
     $bx = $this->_create_default_box();
     capture_reset_and_start();
     personal_related_projects($auth->auth['uname'], $status1);
     $this->set_text(capture_stop_and_get());
     $this->set_msg('test 1');
     $this->_testFor_string_length(732);
     $this->_testFor_pattern("<b>Involved Projects [(]" . show_status($status1) . "[)]<\\/b>");
     $this->_testFor_pattern("Not related to any project with " . show_status($status1) . " status\n");
     $this->reverse_next_test();
     $this->_testFor_pattern('summary.php3');
     //
     // snafu
     //
     $auth->set_uname($user2);
     $auth->set_perm("hell yes!");
     $bx = $this->_create_default_box();
     capture_reset_and_start();
     personal_related_projects($auth->auth['uname'], $status2);
     $this->set_text(capture_stop_and_get());
     $this->set_msg('test 2');
     $this->_testFor_string_length(730);
     $this->_testFor_pattern("<b>Involved Projects [(]" . show_status($status2) . "[)]<\\/b>");
     $this->_testFor_pattern("Not related to any project with " . show_status($status2) . " status\n");
     $this->reverse_next_test();
     $this->_testFor_pattern('summary.php3');
     // TODO: this test requires another test for fritz where projects
     // TODO: actually exist in the database
     $this->_check_db($db_config);
 }