Browse Source

[svn r20979] Minor - tested function testApiIsSelfRegistrationAllowed()

Ricardo Rodriguez 16 years ago
parent
commit
7d96cf81ad
1 changed files with 42 additions and 7 deletions
  1. 42 7
      tests/main/inc/lib/main_api.lib.test.php

+ 42 - 7
tests/main/inc/lib/main_api.lib.test.php

@@ -1,12 +1,11 @@
-<?php
-require_once(api_get_path(LIBRARY_PATH).'main_api.lib.php');
+<?php //$id:$
+
 
 class TestMainApi extends UnitTestCase {
 	
 	function TestMainApi() {
         $this->UnitTestCase('Main API tests');
     }
-
 // todo function testApiProtectCourseScriptReturnsFalse()
 // todo function testApiProtectAdminScriptReturnsFalse()
 // todo function testApiBlockAnonymousUsers()
@@ -113,8 +112,44 @@ class TestMainApi extends UnitTestCase {
 // todo function testApiUrlToLocalPathReturnString()
 // todo function testApiResizeImage()
 // todo function testApiCalculateImageSizeReturnArray()
-	
-//	function testApiGetSettingReturnsRightValue() {
+	/**
+	 * Test out of a course context
+	 */
+/*	function testApiProtectCourseScriptReturnsFalseWhenOutOfCourseContext(){
+		$res= api_protect_course_script();
+		$this->assertTrue($res);
+		}
+	function testApiGetSettingReturnsRightValue() {
 	 	//$this->assertPattern('/\d/',$res);
-//	}
-}
+	}
+}
+	/**
+	 * Test out of a Admin context
+	 
+	 function testApiProtectAdminScriptReturnsFalseWhenOutOfCourseContext(){
+	 	$res= api_protect_admin_script();
+	 	$this->assertTrue($res);
+	 }
+	 
+	 function testApiBlockAnonymousUsersReturnTrueWhenUserIsAnonymous(){
+	 	$res=api_block_anonymous_users();
+	 	$this->assertTrue($res);
+	 	
+	 }
+
+
+	 function testApiGetNavigator()
+	 {	
+	 	
+	 		
+	 }
+*/
+	function testApiIsSelfRegistrationAllowed()
+	{
+		$res = api_is_self_registration_allowed(); 
+		$this->assertFalse($res);
+	}
+	
+}
+
+?>