Fixed failures and other minor code problems

skala
Yannick Warnier 16 years ago
parent e5423bbee9
commit b3452b5e60
  1. 2
      tests/main/inc/lib/document.lib.test.php
  2. 6
      tests/main/inc/lib/main_api.lib.test.php
  3. 9
      tests/main/inc/lib/usermanager.lib.test.php

@ -235,7 +235,7 @@ class TestDocumentManager extends UnitTestCase {
if (!headers_sent()) { if (!headers_sent()) {
$res=DocumentManager::string_send_for_download($full_string, $forced, $name); $res=DocumentManager::string_send_for_download($full_string, $forced, $name);
} }
$this->assertFalse(empty($res)); $this->assertTrue(empty($res));
} }
/** /**

@ -107,7 +107,7 @@ class TestMainApi extends UnitTestCase {
function testApiGetCourseIdReturnFalseWhenOutOfCourseIdContext(){ function testApiGetCourseIdReturnFalseWhenOutOfCourseIdContext(){
$res = api_get_course_id(); $res = api_get_course_id();
$this->assertEqual($res,-1); $this->assertNull($res);
} }
function testApiGetCoursePathReturnFalseWhenOutOfCoursePathContext(){ function testApiGetCoursePathReturnFalseWhenOutOfCoursePathContext(){
@ -381,7 +381,7 @@ class TestMainApi extends UnitTestCase {
api_display_tool_view_option(); api_display_tool_view_option();
$res = ob_get_contents(); $res = ob_get_contents();
ob_end_clean(); ob_end_clean();
$this->assertFalse(empty($res)); $this->assertTrue(empty($res));
} }
function testApiDisplayArray(){ function testApiDisplayArray(){
@ -628,7 +628,7 @@ class TestMainApi extends UnitTestCase {
function testApiStatusKey(){ function testApiStatusKey(){
$status = 'user'; $status = 'user';
$res = api_status_key($status); $res = api_status_key($status);
$this->assertTrue($res); $this->assertEqual($res,STUDENT);
} }
function testApiGetStatusLangvars(){ function testApiGetStatusLangvars(){

@ -126,10 +126,15 @@ class TestUserManager extends UnitTestCase {
$this->assertTrue(is_bool($res)); $this->assertTrue(is_bool($res));
} }
function testGetApiKeyId() { function testGetApiKeyIdEmptyServiceReturnsFalse() {
$api_service = ''; $api_service = '';
$res = UserManager::get_api_key_id(1,$api_service); $res = UserManager::get_api_key_id(1,$api_service);
$this->assertTrue(is_int($res)); $this->assertFalse($res);
}
function testGetApiKeyIdNonEmptyServiceWithExtremeUserIdReturnsFalse() {
$api_service = '';
$res = UserManager::get_api_key_id(5000000,$api_service);
$this->assertFalse($res);
} }
function testGetApiKeys() { function testGetApiKeys() {

Loading…
Cancel
Save