Fixed failing test in urlmanager

skala
ywarnier 14 years ago
parent 8d6e30feb1
commit 5158865bad
  1. 9
      main/inc/lib/urlmanager.lib.php
  2. 6
      tests/main/inc/lib/urlmanager.lib.test.php

@ -423,12 +423,17 @@ class UrlManager
return $result; return $result;
} }
/**
* Inserts a session to a URL (access_url_rel_session table)
* @param int Session ID
* @param int URL ID
* @return bool True on success, false session already exists or insert failed
*/
public static function add_session_to_url($session_id, $url_id = 1) public static function add_session_to_url($session_id, $url_id = 1)
{ {
$table_url_rel_session= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); $table_url_rel_session= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
if (empty($url_id)) $url_id=1; if (empty($url_id)) $url_id=1;
$return = false;
$count = UrlManager::relation_url_session_exist($session_id,$url_id); $count = UrlManager::relation_url_session_exist($session_id,$url_id);
$session_id = intval($session_id); $session_id = intval($session_id);
if (empty($count) && !empty($session_id)) { if (empty($count) && !empty($session_id)) {

@ -32,10 +32,10 @@ class TestUrlManager extends UnitTestCase {
} }
function testadd_session_to_url() { function testadd_session_to_url() {
$session_id=1; $session_id=1; //arbitrary session name - isn't checked in the function anyway
$res=UrlManager::add_session_to_url($session_id, $url_id=1); $res=UrlManager::add_session_to_url($session_id, $url_id=1);
$this->assertTrue(is_bool($res)); $this->assertTrue($res);
//var_dump($res); UrlManager::delete_url_rel_session($session_id,$url_id);
} }
function testadd_user_to_url() { function testadd_user_to_url() {

Loading…
Cancel
Save