Deleted tests folder

Yannick Warnier 10 years ago
parent 221253f3dd
commit 2ad054d369
  1. 6
      tests/README.txt
  2. 1
      tests/api/README.txt
  3. 9
      tests/behat.yml
  4. 116
      tests/build.phing.xml
  5. 115
      tests/build.xml
  6. 6
      tests/chamilotest.php
  7. 8
      tests/course_tests/index.html
  8. 42
      tests/datafiller/data_courses.php
  9. 226
      tests/datafiller/data_users.php
  10. 48
      tests/datafiller/fill_all.php
  11. 32
      tests/datafiller/fill_courses.php
  12. 38
      tests/datafiller/fill_many_users.php
  13. 44
      tests/datafiller/fill_users.php
  14. 28
      tests/datafiller/fill_whoisonline.php
  15. 8
      tests/datafiller/index.html
  16. 20
      tests/features/accessCompanyReports.feature
  17. 191
      tests/features/bootstrap/FeatureContext.php
  18. 143
      tests/features/courseTools.feature
  19. 36
      tests/features/createCourse.feature
  20. 33
      tests/features/createUser.feature
  21. 35
      tests/features/login.feature
  22. BIN
      tests/history/1.8.8.2/640x480/admin.png
  23. BIN
      tests/history/1.8.8.2/640x480/agenda.png
  24. BIN
      tests/history/1.8.8.2/640x480/catalog.png
  25. BIN
      tests/history/1.8.8.2/640x480/course-home1.png
  26. BIN
      tests/history/1.8.8.2/640x480/dashboard.png
  27. BIN
      tests/history/1.8.8.2/640x480/documents.png
  28. BIN
      tests/history/1.8.8.2/640x480/home.png
  29. BIN
      tests/history/1.8.8.2/640x480/lp.png
  30. BIN
      tests/history/1.8.8.2/640x480/online.png
  31. BIN
      tests/history/1.8.8.2/640x480/portal.png
  32. BIN
      tests/history/1.8.8.2/640x480/reporting.png
  33. BIN
      tests/history/1.8.8.2/640x480/reporting2.png
  34. BIN
      tests/history/1.8.8.2/640x480/reporting3.png
  35. BIN
      tests/history/1.8.8.2/640x480/sessions.png
  36. BIN
      tests/history/1.8.8.2/640x480/social-profile.png
  37. BIN
      tests/history/1.8.8.2/640x480/social.png
  38. BIN
      tests/history/1.8.8.2/640x480/student-session-dashboard.png
  39. BIN
      tests/history/1.8.8.2/admin.png
  40. BIN
      tests/history/1.8.8.2/agenda.png
  41. BIN
      tests/history/1.8.8.2/catalog.png
  42. BIN
      tests/history/1.8.8.2/course-home1.png
  43. BIN
      tests/history/1.8.8.2/dashboard.png
  44. BIN
      tests/history/1.8.8.2/documents.png
  45. BIN
      tests/history/1.8.8.2/home.png
  46. BIN
      tests/history/1.8.8.2/lp.png
  47. BIN
      tests/history/1.8.8.2/online.png
  48. BIN
      tests/history/1.8.8.2/portal.png
  49. BIN
      tests/history/1.8.8.2/reporting.png
  50. BIN
      tests/history/1.8.8.2/reporting2.png
  51. BIN
      tests/history/1.8.8.2/reporting3.png
  52. BIN
      tests/history/1.8.8.2/sessions.png
  53. BIN
      tests/history/1.8.8.2/social-profile.png
  54. BIN
      tests/history/1.8.8.2/social.png
  55. BIN
      tests/history/1.8.8.2/student-session-dashboard.png
  56. BIN
      tests/history/1.9.0/640x480/course-home1.png
  57. 130
      tests/history/1.9.0/chamilito-2d.svg
  58. BIN
      tests/history/1.9.0/chamilito-3d.blend
  59. BIN
      tests/history/1.9.0/chamilo-logo-transparent.png
  60. 231
      tests/history/1.9.0/chamilo-logo.svg
  61. BIN
      tests/img/bg-footer.gif
  62. BIN
      tests/img/bg-header4.png
  63. BIN
      tests/img/header-logo.png
  64. 8
      tests/index.html
  65. 49
      tests/internationalization.lib.test_standalone.php
  66. 1
      tests/logs/code-browser/README.txt
  67. 4
      tests/logs/index.html
  68. 0
      tests/logs/jdepend.xml
  69. 0
      tests/logs/junit.xml
  70. 114
      tests/main/admin/calendar.lib.test.php
  71. 188
      tests/main/admin/statistics/statistics.lib.test.php
  72. 206
      tests/main/admin/sub_language.class.test.php
  73. 80
      tests/main/announcements/announcements.inc.test.php
  74. 71
      tests/main/auth/openid/xrds.lib.test.php
  75. 79
      tests/main/chat/chat_functions.lib.test.php
  76. 16
      tests/main/conference/get_translation.lib.test.php
  77. 319
      tests/main/dropbox/dropbox_class.inc.test.php
  78. 505
      tests/main/dropbox/dropbox_functions.inc.test.php
  79. 389
      tests/main/exercice/answer.class.test.php
  80. 539
      tests/main/exercice/exercise.class.test.php
  81. 42
      tests/main/exercice/exercise.lib.test.php
  82. 83
      tests/main/exercice/exercise_result.class.test.php
  83. 100
      tests/main/exercice/export/exercise_import.inc.test.php
  84. 189
      tests/main/exercice/export/qti2/qti2_classes.test.php
  85. 86
      tests/main/exercice/export/qti2/qti2_export.test.php
  86. 219
      tests/main/exercice/export/scorm/scorm_classes.test.php
  87. 45
      tests/main/exercice/fill_blanks.class.test.php
  88. 29
      tests/main/exercice/freeanswer.class.test.php
  89. 178
      tests/main/exercice/hotpotatoes.lib.test.php
  90. 1311
      tests/main/forum/forumfunction.inc.test.php
  91. 135
      tests/main/gradebook/lib/be/attendancelink.class.test.php
  92. 423
      tests/main/gradebook/lib/be/category.class.test.php
  93. 42
      tests/main/gradebook/lib/be/dropboxlink.class.test.php
  94. 347
      tests/main/gradebook/lib/be/evaluation.class.test.php
  95. 153
      tests/main/gradebook/lib/be/exerciselink.class.test.php
  96. 42
      tests/main/gradebook/lib/be/forumthreadlink.class.test.php
  97. 21
      tests/main/inc/banner.inc.test.php
  98. 35
      tests/main/inc/course_document.lib.test.php
  99. 35
      tests/main/inc/lib/access_url_edit_courses_to_url_functions.lib.test.php
  100. 32
      tests/main/inc/lib/access_url_edit_sessions_to_url_functions.lib.test.php
  101. Some files were not shown because too many files have changed in this diff Show More

@ -1,6 +0,0 @@
/* For licensing terms, see /license.txt */
/* README */
This directory is used for automated testing through the use of the SimpleTest framework..
Run test_suite.php

@ -1 +0,0 @@
This directory will contain the auto-generated PHPDoc files

@ -1,9 +0,0 @@
default:
extensions:
Behat\MinkExtension\Extension:
base_url: http://my.chamilo110.net
goutte: ~
selenium2: ~
paths:
features: features
bootstrap: %behat.paths.features%/bootstrap

@ -1,116 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="Chamilo LMS" default="build">
<target name="build"
depends="prepare,lint,phpcs-ci,simpletest,phpdoc"/>
<target name="build-parallel"
depends="prepare,lint,tools-parallel,simpletest"/>
<target name="tools-parallel" description="Run tools in parallel">
<parallel threadCount="2">
<sequential>
<antcall target="pdepend"/>
<!--antcall target="phpmd-ci"/-->
</sequential>
<antcall target="phpcs-ci"/>
<antcall target="simpletest"/>
<antcall target="phpdoc"/>
</parallel>
</target>
<target name="clean" description="Cleanup build artifacts">
<delete dir="${basedir}/tests/api"/>
<delete dir="${basedir}/tests/code-browser"/>
<delete dir="${basedir}/tests/coverage"/>
<delete dir="${basedir}/tests/logs"/>
<delete dir="${basedir}/tests/pdepend"/>
</target>
<target name="prepare" depends="clean" description="Prepare for build">
<mkdir dir="${basedir}/tests/api"/>
<mkdir dir="${basedir}/tests/code-browser"/>
<mkdir dir="${basedir}/tests/coverage"/>
<mkdir dir="${basedir}/tests/logs"/>
<mkdir dir="${basedir}/tests/pdepend"/>
<mkdir dir="${basedir}/tests/phpdox"/>
</target>
<target name="lint" description="Perform syntax check of sourcecode files">
<phplint>
<fileset dir="${basedir}">
<include name="**/*.php"/>
</fileset>
</phplint>
</target>
<target name="pdepend" description="Calculate software metrics using PHP_Depend">
<exec executable="pdepend">
<arg value="--jdepend-xml=${basedir}/tests/logs/jdepend.xml" />
<arg value="--jdepend-chart=${basedir}/tests/pdepend/dependencies.svg" />
<arg value="--overview-pyramid=${basedir}/tests/pdepend/overview-pyramid.svg" />
<arg path="${basedir}" />
</exec>
</target>
<target name="phpmd"
description="Perform project mess detection using PHPMD and print human readable output. Intended for usage on the command line before committing.">
<exec executable="phpmd">
<arg path="${basedir}" />
<arg value="text" />
<arg value="${basedir}/tests/phpmd.xml" />
</exec>
</target>
<target name="phpmd-ci" description="Perform project mess detection using PHPMD creating a log file for the continuous integration server">
<exec executable="phpmd">
<arg path="${basedir}" />
<arg value="xml" />
<arg value="${basedir}/tests/phpmd.xml" />
<arg value="--reportfile" />
<arg value="${basedir}/tests/logs/pmd.xml" />
</exec>
</target>
<target name="phpcs"
description="Find coding standard violations using PHP_CodeSniffer and print human readable output. Intended for usage on the command line before committing.">
<exec executable="phpcs">
<arg value="--standard=${basedir}/tests/phpcs.xml" />
<arg path="${basedir}" />
</exec>
</target>
<target name="phpcs-ci" description="Find coding standard violations using PHP_CodeSniffer creating a log file for the continuous integration server">
<exec executable="phpcs" output="/dev/null">
<arg value="--report=checkstyle" />
<arg value="--report-file=${basedir}/tests/logs/checkstyle.xml" />
<arg value="--standard=${basedir}/tests/phpcs.xml" />
<arg path="${basedir}" />
</exec>
</target>
<target name="simpletest" description="Run simpletests">
<simpletest>
<formatter type="plain"/>
<fileset dir="${basedir}/tests">
<include name="test_suite.php"/>
</fileset>
</simpletest>
</target>
<target name="phpdoc" description="Generate API documentation">
<exec executable="phpdoc">
<arg line="-d ${basedir} -t ${basedir}/logs/docs -i ${basedir}/tests,${basedir}/main/inc/entity,${basedir}/main/inc/lib/symfony,${basedir}/main/inc/lib/phpdocx,${basedir}/main/inc/lib/phpqrcode,${basedir}/main/inc/lib/mpdf,${basedir}/main/inc/lib/internationalization_database/transliteration,${basedir}/main/inc/lib/phpmailer,${basedir}/main/inc/lib/htmlpurifier,${basedir}/main/inc/lib/formvalidator,${basedir}/app/upload/users,${basedir}/main/lang,${basedir}/app/courses,${basedir}/app/cache,.htaccess" />
</exec>
</target>
<target name="phpcb" description="Aggregate tool output with PHP_CodeBrowser">
<exec executable="phpcb">
<arg value="--log" />
<arg path="${basedir}/tests/logs" />
<arg value="--source" />
<arg path="${basedir}" />
<arg value="--output" />
<arg path="${basedir}/tests/code-browser" />
</exec>
</target>
</project>

@ -1,115 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="Chamilo LMS" default="build">
<target name="build"
depends="prepare,phpunit,pdepend,phpdoc"/>
<target name="clean" description="Cleanup build artifacts">
<delete dir="${basedir}/../tests/api"/>
<delete dir="${basedir}/../tests/code-browser"/>
<delete dir="${basedir}/../tests/coverage"/>
<delete dir="${basedir}/../tests/logs"/>
<delete dir="${basedir}/../tests/pdepend"/>
</target>
<target name="prepare" depends="clean" description="Prepare for build">
<mkdir dir="${basedir}/../tests/api"/>
<mkdir dir="${basedir}/../tests/code-browser"/>
<mkdir dir="${basedir}/../tests/coverage"/>
<mkdir dir="${basedir}/../tests/logs"/>
<mkdir dir="${basedir}/../tests/pdepend"/>
<mkdir dir="${basedir}/../tests/phpdox"/>
</target>
<target name="lint" description="Perform syntax check of sourcecode files">
<apply executable="php" failonerror="true">
<arg value="-l" />
<fileset dir="${basedir}/../main">
<include name="**/*.php"/>
</fileset>
<fileset dir="${basedir}">
<include name="**/*.php"/>
</fileset>
</apply>
</target>
<target name="pdepend" description="Calculate software metrics using PHP_Depend">
<exec executable="pdepend">
<arg value="--jdepend-xml=${basedir}/tests/logs/jdepend.xml" />
<arg value="--jdepend-chart=${basedir}/tests/pdepend/dependencies.svg" />
<arg value="--overview-pyramid=${basedir}/tests/pdepend/overview-pyramid.svg" />
<arg path="${basedir}" />
</exec>
</target>
<target name="phpmd"
description="Perform project mess detection using PHPMD and print human readable output. Intended for usage on the command line before committing.">
<exec executable="phpmd">
<arg path="${basedir}" />
<arg value="text" />
<arg value="${basedir}/tests/phpmd.xml" />
</exec>
</target>
<target name="phpmd-ci" description="Perform project mess detection using PHPMD creating a log file for the continuous integration server">
<exec executable="phpmd">
<arg path="${basedir}" />
<arg value="xml" />
<arg value="${basedir}/tests/phpmd.xml" />
<arg value="--reportfile" />
<arg value="${basedir}/tests/logs/pmd.xml" />
</exec>
</target>
<target name="phpcs"
description="Find coding standard violations using PHP_CodeSniffer and print human readable output. Intended for usage on the command line before committing.">
<exec executable="phpcs">
<arg value="--standard=${basedir}/tests/phpcs.xml" />
<arg path="${basedir}" />
</exec>
</target>
<target name="phpcs-ci" description="Find coding standard violations using PHP_CodeSniffer creating a log file for the continuous integration server">
<exec executable="phpcs" output="/dev/null">
<arg value="--report=checkstyle" />
<arg value="--report-file=${basedir}/tests/logs/checkstyle.xml" />
<arg value="--standard=${basedir}/tests/phpcs.xml" />
<arg path="${basedir}" />
</exec>
</target>
<!--target name="simpletest" description="Run simpletests">
<simpletest>
<formatter type="plain"/>
<fileset dir="${basedir}/tests">
<include name="test_suite.php"/>
</fileset>
</simpletest>
</target-->
<target name="phpunit" description="Run unit tests with PHPUnit" depends="lint">
<!--exec executable="phpunit" failonerror="true"-->
<exec executable="phpunit">
<arg line="-c ${basedir}/phpunit/phpunit.xml" />
</exec>
</target>
<target name="phpdoc" description="Generate API documentation">
<exec executable="phpdoc">
<arg line="-d ${basedir}/../ -t ${basedir}/logs/docs -ti ChamiloLMS -i archive/,home/,entity/,symfony/,phpdocx/,phpqrcode/,mpdf/,transliteration/*,phpmailer/*,htmlpurifier/,formvalidator/*,app/upload/users/,lang/,app/courses/,main/inc/lib/internationalization_database/,.htaccess -ct covers,assert" />
</exec>
</target>
<target name="phpcb" description="Aggregate tool output with PHP_CodeBrowser">
<exec executable="phpcb">
<arg value="--log" />
<arg path="${basedir}/tests/logs" />
<arg value="--source" />
<arg path="${basedir}" />
<arg value="--output" />
<arg path="${basedir}/tests/code-browser" />
</exec>
</target>
</project>

@ -1,6 +0,0 @@
<?php require_once('../main/inc/global.inc.php');
var_dump(api_is_windows_os());
//echo (api_is_windows_os()?'true':'false');
?>

@ -1,8 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
</head>
<body>
<br />
</body>
</html>

@ -1,42 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This script contains the data to fill (or empty) the database with using
* the fillers in this directory.
* @author Yannick Warnier <yannick.warnier@dokeos.com>
*
*/
$courses = array();
$courses[] = array(
'code' => 'ENGLISH101',
'title' => 'English for beginners',
'description' => 'English course',
'category_code' => 'PROJ',
'course_language' => 'english',
'user_id' => 1,
'expiration_date' => '2020-09-01 00:00:00',
'exemplary_content' => true,
);
$courses[] = array(
'code' => 'SPANISH101',
'title' => 'Español para iniciantes',
'description' => 'Curso de español',
'category_code' => 'PROJ',
'course_language' => 'spanish',
'user_id' => 1,
'expiration_date' => '2020-09-01 00:00:00',
'exemplary_content' => true,
);
$courses[] = array(
'code' => 'FRENCH101',
'title' => 'Français pour débutants',
'description' => 'Cours de français',
'category_code' => 'PROJ',
'course_language' => 'french',
'user_id' => 1,
'expiration_date' => '2020-09-01 00:00:00',
'exemplary_content' => true,
);

@ -1,226 +0,0 @@
<?php //$id$
/**
* This script contains the data to fill (or empty) the database with using
* the fillers in this directory.
* Most names were inspired by Hobbit names from the Lord of the Rings.
* See https://en.wikipedia.org/wiki/List_of_Hobbits
* @author Yannick Warnier <yannick.warnier@dokeos.com>
*
*/
/**
* Initialisation section
*/
$users = array();
$users[] = array(
'username' => 'ywarnier',
'pass' => 'ywarnier',
'firstname' => 'Yannick',
'lastname' => 'Warnier',
'status' => 1,
'auth_source' => 'platform',
'email' => 'yannick.warnier@example.com',
'creator_id' => 1,
'active' => 1,
);
$users[] = array(
'username' => 'mmosquera',
'pass' => 'mmosquera',
'firstname' => 'Michela',
'lastname' => 'Mosquera Guardamino',
'status' => 1,
'auth_source' => 'platform',
'email' => 'michela.mosquera@example.com',
'creator_id' => 1,
'active' => 1,
);
$users[] = array(
'username' => 'mlanoix',
'pass' => 'mlanoix',
'firstname' => 'Michel',
'lastname' => 'Lanoix',
'status' => 5,
'auth_source' => 'platform',
'email' => 'michel.lanoix@example.com',
'creator_id' => 1,
'active' => 1
);
$users[] = array(
'username' => 'jmontoya',
'pass' => 'jmontoya',
'firstname' => 'Julio',
'lastname' => 'Montoya',
'status' => 1,
'auth_source' => 'platform',
'email' => 'julio.montoya@example.com',
'creator_id' => 1,
'active' => 1
);
$users[] = array(
'username' => 'agarcia',
'pass' => 'agarcia',
'firstname' => 'Alan',
'lastname' => 'Garcia',
'status' => 1,
'auth_source' => 'platform',
'email' => 'agarcia@example.com',
'creator_id' => 1,
'active' => 1
);
$users[] = array(
'username' => 'pperez',
'pass' => 'pperez',
'firstname' => 'Pedro',
'lastname' => 'Perez',
'status' => 5,
'auth_source' => 'platform',
'email' => 'pperez@example.com',
'creator_id' => 1,
'active' => 1
);
$users[] = array(
'username' => 'ggerard',
'pass' => 'ggerard',
'firstname' => 'Gabrielle',
'lastname' => 'Gérard',
'status' => 5,
'auth_source' => 'platform',
'email' => 'ggerard@example.com',
'creator_id' => 1,
'active' => 1
);
$users[] = array(
'username' => 'norizales',
'pass' => 'norizales',
'firstname' => 'Noa',
'lastname' => 'Orizales',
'status' => 5,
'auth_source' => 'platform',
'email' => 'norizales@example.com',
'creator_id' => 1,
'active' => 1
);
$users[] = array(
'username' => 'fbaggins',
'pass' => 'fbaggins',
'firstname' => 'Frodo',
'lastname' => 'Baggins',
'status' => 5,
'auth_source' => 'platform',
'email' => 'fbaggins@example.com',
'creator_id' => 1,
'active' => 1
);
$users[] = array(
'username' => 'bbaggins',
'pass' => 'bbagins',
'firstname' => 'Bilbo',
'lastname' => 'Baggins',
'status' => 5,
'auth_source' => 'platform',
'email' => 'bbaggins@example.com',
'creator_id' => 1,
'active' => 1
);
$users[] = array(
'username' => 'sgamgee',
'pass' => 'sgamgee',
'firstname' => 'Samwise',
'lastname' => 'Gamgee',
'status' => 5,
'auth_source' => 'platform',
'email' => 'sgamgee@example.com',
'creator_id' => 1,
'active' => 1
);
$users[] = array(
'username' => 'jbrion',
'pass' => 'jbrion',
'firstname' => 'Jon',
'lastname' => 'Brion',
'status' => 5,
'auth_source' => 'platform',
'email' => 'jbrion@example.com',
'creator_id' => 1,
'active' => 1
);
$users[] = array(
'username' => 'fapple',
'pass' => 'fapple',
'firstname' => 'Fiona',
'lastname' => 'Apple Maggart',
'status' => 5,
'auth_source' => 'platform',
'email' => 'fapple@example.com',
'creator_id' => 1,
'active' => 1
);
$users[] = array(
'username' => 'acalabaza',
'pass' => 'acalabaza',
'firstname' => 'Aldo',
'lastname' => 'Calabaza',
'status' => 5,
'auth_source' => 'platform',
'email' => 'acalabaza@example.com',
'creator_id' => 1,
'active' => 1
);
$users[] = array('username' => 'mbrandybuck', 'pass' => 'mbrandybuck', 'firstname' => 'Meriadoc', 'lastname' => 'Brandybuck', 'status' => 5, 'auth_source' => 'platform', 'email' => 'mbrandybuck@example.com', 'creator_id' => 1, 'active' => 1);
$users[] = array('username' => 'amaurichard', 'pass' => 'amaurichard', 'firstname' => 'Anabelle', 'lastname' => 'Maurichard', 'status' => 3, 'auth_source' => 'platform', 'email' => 'amaurichard@example.com', 'creator_id' => 1, 'active' => 1);
$users[] = array('username' => 'ptook', 'pass' => 'ptook', 'firstname' => 'Peregrin', 'lastname' => 'Took', 'status' => 4, 'auth_source' => 'platform', 'email' => 'ptook@example.com', 'creator_id' => 1, 'active' => 1);
$users[] = array('username' => 'abaggins', 'pass' => 'abaggins', 'firstname' => 'Angelica', 'lastname' => 'Baggins', 'status' => 17, 'auth_source' => 'platform', 'email' => 'abaggins@example.com', 'creator_id' => 1, 'active' => 1);
$users[] = array('username' => 'bproudfoot', 'pass' => 'bproudfoot', 'firstname' => 'Bodo', 'lastname' => 'Proudfoot', 'status' => 20, 'auth_source' => 'platform', 'email' => 'bproudfoot@example.com', 'creator_id' => 1, 'active' => 1);
$users[] = array('username' => 'csackville', 'pass' => 'csackville', 'firstname' => 'Camelia', 'lastname' => 'Sackville', 'status' => 5, 'auth_source' => 'platform', 'email' => 'csackville@example.com', 'creator_id' => 1, 'active' => 1);
$users[] = array('username' => 'dboffin', 'pass' => 'dboffin', 'firstname' => 'Donnamira', 'lastname' => 'Boffin', 'status' => 5, 'auth_source' => 'platform', 'email' => 'dboffin@example.com', 'creator_id' => 1, 'active' => 1);
$users[] = array('username' => 'efairbairn', 'pass' => 'efairbairn', 'firstname' => 'Elfstan', 'lastname' => 'Fairbairn', 'status' => 5, 'auth_source' => 'platform', 'email' => 'efairbairn@example.com', 'creator_id' => 1, 'active' => 1);
$users[] = array('username' => 'fgreenholm', 'pass'=> 'fgreenholm', 'firstname' => 'Fastred', 'lastname' => 'of Greenholm', 'status' => 5, 'auth_source' => 'platform', 'email' => 'fgreenholm@example.com', 'creator_id' => 1, 'active' => 1);
$users[] = array('username' => 'gboffin', 'pass'=> 'gboffin', 'firstname' => 'Griffo', 'lastname' => 'Boffin', 'status' => 5, 'auth_source' => 'platform', 'email' => 'gboffin@example.com', 'creator_id' => 1, 'active' => 1);
$users[] = array('username' => 'hbrandybuck', 'pass'=> 'hbrandybuck', 'firstname' => 'Hilda', 'lastname' => 'Brandybuck', 'status' => 5, 'auth_source' => 'platform', 'email' => 'hbrandybuck@example.com', 'creator_id' => 1, 'active' => 1);
$users[] = array('username' => 'itook', 'pass'=> 'itook', 'firstname' => 'Isengar', 'lastname' => 'Took', 'status' => 5, 'auth_source' => 'platform', 'email' => 'itook@example.com', 'creator_id' => 1, 'active' => 1);
$users[] = array('username' => 'mcotillard', 'pass'=> 'mcotillard', 'firstname' => 'Marion', 'lastname' => 'Cotillard', 'status' => 5, 'auth_source' => 'platform', 'email' => 'mcotillard@example.com', 'creator_id' => 1, 'active' => 1);
$users[] = array('username' => 'jcotton', 'pass'=> 'jcotton', 'firstname' => 'Jolly', 'lastname' => 'Cotton', 'status' => 5, 'auth_source' => 'platform', 'email' => 'jcotton@example.com', 'creator_id' => 1, 'active' => 1);
$users[] = array('username' => 'lcotton', 'pass'=> 'lcotton', 'firstname' => 'Lily', 'lastname' => 'Cotton', 'status' => 5, 'auth_source' => 'platform', 'email' => 'lcotton@example.com', 'creator_id' => 1, 'active' => 1);
$users[] = array('username' => 'mburrows', 'pass'=> 'mburrows', 'firstname' => 'Milo', 'lastname' => 'Burrows', 'status' => 5, 'auth_source' => 'platform', 'email' => 'mburrows@example.com', 'creator_id' => 1, 'active' => 1);
$users[] = array('username' => 'obolger', 'pass'=> 'obolger', 'firstname' => 'Odovacar', 'lastname' => 'Bolger', 'status' => 5, 'auth_source' => 'platform', 'email' => 'obolger@example.com', 'creator_id' => 1, 'active' => 1);
$users[] = array('username' => 'pbolger', 'pass'=> 'pbolger', 'firstname' => 'Prisca', 'lastname' => 'Bolger', 'status' => 5, 'auth_source' => 'platform', 'email' => 'pbolger@example.com', 'creator_id' => 1, 'active' => 1);
$users[] = array('username' => 'rgardner', 'pass'=> 'rgardner', 'firstname' => 'Ruby', 'lastname' => 'Gardner', 'status' => 5, 'auth_source' => 'platform', 'email' => 'rgardner@example.com', 'creator_id' => 1, 'active' => 1);
$users[] = array('username' => 'stook', 'pass'=> 'stook', 'firstname' => 'Sigismond', 'lastname' => 'Took', 'status' => 5, 'auth_source' => 'platform', 'email' => 'stook@example.com', 'creator_id' => 1, 'active' => 1);
$users[] = array('username' => 'sgollum', 'pass'=> 'sgollum', 'firstname' => 'Smeagol', 'lastname' => 'Gollum', 'status' => 5, 'auth_source' => 'platform', 'email' => 'sgollum@example.com', 'creator_id' => 1, 'active' => 1);
$users[] = array('username' => 'tsandyman', 'pass'=> 'tsandyman', 'firstname' => 'Ted', 'lastname' => 'Sandyman', 'status' => 5, 'auth_source' => 'platform', 'email' => 'tsandyman@example.com', 'creator_id' => 1, 'active' => 1);
$users[] = array('username' => 'wgamwich', 'pass'=> 'wgamwich', 'firstname' => 'Wiseman', 'lastname' => 'Gamwich', 'status' => 5, 'auth_source' => 'platform', 'email' => 'wgamwich@example.com', 'creator_id' => 1, 'active' => 1);
$users[] = array('username' => 'mhalles','pass' => 'mhalles','firstname' => 'Maria','lastname' => 'Halles','status' => 5,'auth_source' => 'platform','email' => 'mhalles@example.com','creator_id' => 1,'active' => 1);
$users[] = array('username' => 'adaniel','pass' => 'adaniel','firstname' => 'Anna','lastname' => 'Daniel','status' => 5,'auth_source' => 'platform','email' => 'adaniel@example.com','creator_id' => 1,'active' => 1);
$users[] = array('username' => 'hstein','pass' => 'ppiedra','firstname' => 'Hansel','lastname' => 'Stein','status' => 5,'auth_source' => 'platform','email' => 'ppiedra@example.com','creator_id' => 1,'active' => 1);
$users[] = array('username' => 'amartin','pass' => 'amartin','firstname' => 'Angel','lastname' => 'Martin','status' => 5,'auth_source' => 'platform','email' => 'amartin@example.com','creator_id' => 1,'active' => 1);
$users[] = array('username' => 'mhiggins','pass' => 'mhingis','firstname' => 'Marc','lastname' => 'Higgins','status' => 5,'auth_source' => 'platform','email' => 'mhingis@example.com','creator_id' => 1,'active' => 1);
$users[] = array('username' => 'jlennon','pass' => 'jlennon','firstname' => 'Johnny','lastname' => 'Lennon','status' => 5,'auth_source' => 'platform','email' => 'jlennon@example.com','creator_id' => 1,'active' => 1);
$users[] = array('username' => 'pchavez','pass' => 'pchavez','firstname' => 'Parol','lastname' => 'Chavez','status' => 5,'auth_source' => 'platform','email' => 'pchavez@example.com','creator_id' => 1,'active' => 1);
$users[] = array('username' => 'cvallejo','pass' => 'cvallejo','firstname' => 'César','lastname' => 'Vallejo','status' => 5,'auth_source' => 'platform','email' => 'cvallejo@example.com','creator_id' => 1,'active' => 1);
$users[] = array('username' => 'ftruffaut','pass'=> 'ftruffaut','firstname' => 'François','lastname' => 'Truffaut','status' => 5,'auth_source' => 'platform','email' => 'ftruffaut@example.com','creator_id' => 1,'active' => 1);
$users[] = array('username' => 'mjoy','pass'=> 'mjoy','firstname' => 'Mary','lastname' => 'Joy','status' => 5,'auth_source' => 'platform','email' => 'marion@example.com','creator_id' => 1,'active' => 1);
$users[] = array('username' => 'dmassa','pass'=> 'dmassa','firstname' => 'Diego','lastname' => 'Massa','status' => 5,'auth_source' => 'platform','email' => 'dmassa@example.com','creator_id' => 1,'active' => 1);
$users[] = array('username' => 'mjagger','pass'=> 'mjagger','firstname' => 'Mick','lastname' => 'Jagger','status' => 5,'auth_source' => 'platform','email' => 'mjagger@example.com','creator_id' => 1,'active' => 1);
$users[] = array('username' => 'mcotilla','pass'=> 'mcotilla','firstname' => 'Marion','lastname' => 'Cotillard','status' => 5,'auth_source' => 'platform','email' => 'mcotilla@example.com','creator_id' => 1,'active' => 1);
$users[] = array('username' => 'pepelepew','pass'=> 'pepelepew','firstname' => 'Pepe','lastname' => 'Le Pew','status' => 5,'auth_source' => 'platform','email' => 'pepelepew@example.com','creator_id' => 1,'active' => 1);
$users[] = array('username' => 'nrubio','pass'=> 'nrubia','firstname' => 'Nathalie','lastname' => 'Rubio','status' => 5,'auth_source' => 'platform','email' => 'nrubia@example.com','creator_id' => 1,'active' => 1);
$users[] = array('username' => 'psanchez','pass'=> 'psanchez','firstname' => 'Peri','lastname' => 'Sanchez','status' => 5,'auth_source' => 'platform','email' => 'psanchez@example.com','creator_id' => 1,'active' => 1);
$users[] = array('username' => 'acostea','pass'=> 'acostea','firstname' => 'Andrea','lastname' => 'Costea','status' => 5,'auth_source' => 'platform','email' => 'acostea@example.com','creator_id' => 1,'active' => 1);
$users[] = array('username' => 'telera','pass'=> 'telera','firstname' => 'Tania','lastname' => 'Helera','status' => 5,'auth_source' => 'platform','email' => 'telera@example.com','creator_id' => 1,'active' => 1);
$users[] = array('username' => 'dstrauss','pass'=> 'dstrauss','firstname' => 'Domingo','lastname' => 'Strauss','status' => 5,'auth_source' => 'platform','email' => 'dstrauss@example.com','creator_id' => 1,'active' => 1);
$users[] = array('username' => 'helena','pass'=> 'helena','firstname' => 'Helena','lastname' => 'Duarte','status' => 5,'auth_source' => 'platform','email' => 'helena@example.com','creator_id' => 1,'active' => 1);
$users[] = array('username' => 'cgonzales','pass'=> 'cgonzales','firstname' => 'Cecilia','lastname' => 'Gonzales','status' => 5,'auth_source' => 'platform','email' => 'cgonzales@example.com','creator_id' => 1,'active' => 1);
$users[] = array('username' => 'amann','pass'=> 'amann','firstname' => 'Aimee','lastname' => 'Mann','status' => 5,'auth_source' => 'platform','email' => 'amann@example.com','creator_id' => 1,'active' => 1);
$users[] = array('username' => 'zzaouidi','pass'=> 'zazup','firstname' => 'Zatar','lastname' => 'Zaouidi','status' => 5,'auth_source' => 'platform','email' => 'zazup@example.com','creator_id' => 1,'active' => 1);

@ -1,48 +0,0 @@
<?php //$id$
/**
* This script contains calls to the various filling scripts that allow a
* demo presenter to fill his Dokeos with demo data.
* This script is locked against execution from the browser, to avoid malicious
* insertion on production portals.
* To execute, you need the PHP5 Command Line Interface (CLI) to be installed
* on your system and t launch this script manually using: php5 fill_all.php
* @author Yannick Warnier <yannick.warnier@dokeos.com>
*/
/**
* Initialisation section
*/
$incdir = dirname(__FILE__).'/../../main/inc/';
require $incdir.'global.inc.php';
/**
* Code logic
*/
//Avoid execution if not from the command line
if (PHP_SAPI != 'cli') { die('This demo-data filling script can only be run from the command line. Please launch it from the command line using: php5 fill_all.php. To enable it from your browser (very highly dangerous), remove the first line of code from the "logic" section of this file.'); }
$eol = PHP_EOL;
$output = '';
$files = scandir(dirname(__FILE__));
foreach ($files as $file) {
if (substr($file,0,1) == '.' or substr($file,0,5) != 'fill_') { ; } //skip
else {
if ($file == basename(__FILE__)) {
//skip, this is the current file
} else {
$output .= $eol.'Reading file: '.$file.$eol;
require_once $file;
$function = basename($file,'.php');
if (function_exists($function)) {
$output .= $eol.'Executing function '.$function.$eol;
$function();
} else {
//function not found
}
}
}
}
/**
* Display
*/
echo $output.$eol;
echo "Done all$eol";

@ -1,32 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This script contains a data filling procedure for users
* @author Yannick Warnier <yannick.warnier@beeznest.com>
*
*/
/**
* Loads the data and injects it into the Chamilo database, using the Chamilo
* internal functions.
* @return array List of user IDs for the users that have just been inserted
*/
function fill_courses()
{
$eol = PHP_EOL;
$courses = array(); //declare only to avoid parsing notice
require_once 'data_courses.php'; //fill the $users array
$output = array();
$output[] = array('title'=>'Courses Filling Report: ');
$i = 1;
foreach ($courses as $i => $course) {
//first check that the first item doesn't exist already
$output[$i]['line-init'] = $course['title'];
$res = CourseManager::create_course($course);
$output[$i]['line-info'] = $res ? get_lang('Added') : get_lang('NotInserted');
$i++;
}
return $output;
}

@ -1,38 +0,0 @@
<?php //$id$
/**
* This script contains a data filling procedure for users
* @author Yannick Warnier <yannick.warnier@beeznest.com>
*
*/
/**
* Initialisation section
*/
require '../../main/inc/global.inc.php';
/**
* Executing
*/
fill_many_users(100000);
/**
* Loads the data and injects it into the Chamilo database, using the Chamilo
* internal functions.
* @return array List of user IDs for the users that have just been inserted
*/
function fill_many_users($num) {
$eol = PHP_EOL;
$users = array(); //declare only to avoid parsing notice
require_once 'data_users.php'; //fill the $users array
$i = 1;
while ($i < $num) {
$output = array();
$output[] = array('title'=>'Users Filling Report:');
foreach ($users as $j => $user) {
//first check that the first item doesn't exist already
$output[$i]['line-init'] = $user['firstname'];
$res = UserManager::create_user($user['firstname'],$user['lastname'],$user['status'],$user['email'],$user['username'].$i,$user['pass'],null,null,null,null,$user['auth_source'],null,$user['active']);
$output[$i]['line-info'] = ($res ? get_lang('Inserted') : get_lang('NotInserted')).' '.$user['username'].$i;
$i++;
}
print_r($output);
}
//return $output;
}

@ -1,44 +0,0 @@
<?php //$id$
/**
* This script contains a data filling procedure for users
* @author Yannick Warnier <yannick.warnier@beeznest.com>
*
*/
/**
* Initialisation section
*/
/**
* Loads the data and injects it into the Chamilo database, using the Chamilo
* internal functions.
* @return array List of user IDs for the users that have just been inserted
*/
function fill_users()
{
$users = array(); //declare only to avoid parsing notice
require_once 'data_users.php'; //fill the $users array
$output = array();
$output[] = array('title'=>'Users Filling Report:');
foreach ($users as $i => $user) {
//first check that the first item doesn't exist already
$output[$i]['line-init'] = $user['firstname'];
$res = UserManager::create_user(
$user['firstname'],
$user['lastname'],
$user['status'],
$user['email'],
$user['username'],
$user['pass'],
null,
null,
null,
null,
$user['auth_source'],
null,
$user['active']
);
$output[$i]['line-info'] = $res ? get_lang('Inserted') : get_lang('NotInserted');
}
return $output;
}

@ -1,28 +0,0 @@
<?php
/**
* This script contains a data filling procedure for users
* @author Julio Montoya <gugli100@gmail.com>
*
*/
/**
* Loads the data and injects it into the Dokeos database, using the Dokeos
* internal functions.
* @return array List of user IDs for the users that have just been inserted
*/
function fill_whoisonline()
{
$table_e_online = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE);
$max = 100;
//Cleaning the table
$sql = "TRUNCATE $table_e_online";
$rs = Database::query($sql);
//filling the table
for ($i=1;$i <=$max;$i++) {
$date = api_get_utc_datetime();
$sql = "INSERT INTO $table_e_online (login_id, login_user_id, login_date, user_ip, c_id, session_id, access_url_id)
VALUES ('$i', '$i', '$date', '127.0.0.1', '', '0','1')";
$rs = Database::query($sql);
}
}

@ -1,8 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
</head>
<body>
<br />
</body>
</html>

@ -1,20 +0,0 @@
@administration
Feature: Access to company reports as admin
In order to analyse reports of time spent on the platform
As an administrator
I need to be able to access the company reports
Scenario: See the company reports link on the admin page
Given I am a platform administrator
And I am on "/main/admin/index.php"
Then I should see "Reports"
Scenario: Access the company report
Given I am a platform administrator
And I am on "/main/mySpace/company_reports.php"
Then I should not see "not authorized"
Scenario: Access the resumed version of the company report
Given I am a platform administrator
And I am on "/main/admin/company_reports_resumed.php"
Then I should not see "not authorized"

@ -1,191 +0,0 @@
<?php
use Behat\Behat\Context\ClosuredContextInterface,
Behat\Behat\Context\TranslatedContextInterface,
Behat\Behat\Context\BehatContext,
Behat\Behat\Context\Step\Given,
Behat\Behat\Exception\PendingException,
Behat\Behat\Event\SuiteEvent;
use Behat\Gherkin\Node\PyStringNode,
Behat\Gherkin\Node\TableNode;
use Behat\MinkExtension\Context\MinkContext;
//
// Require 3rd-party libraries here:
//
// require_once 'PHPUnit/Autoload.php';
// require_once 'PHPUnit/Framework/Assert/Functions.php';
//
/**
* Features context. (MinkContext extends BehatContext)
*/
class FeatureContext extends MinkContext
{
/**
* Initializes context.
* Every scenario gets its own context object.
*
* @param array $parameters context parameters (set them up through behat.yml)
*/
public function __construct(array $parameters)
{
// Initialize your context here
}
/**
* @Given /^I am a platform administrator$/
*/
public function iAmAPlatformAdministrator()
{
return array(
new Given('I am on "/index.php?logout=logout"'),
new Given('I am on homepage'),
new Given('I fill in "login" with "admin"'),
new Given('I fill in "password" with "admin"'),
new Given('I press "submitAuth"')
);
}
/**
* @Given /^I am a session administrator$/
*/
public function iAmASessionAdministrator()
{
return array(
new Given('I am on "/index.php?logout=logout"'),
new Given('I am on homepage'),
new Given('I fill in "login" with "amaurichard"'),
new Given('I fill in "password" with "amaurichard"'),
new Given('I press "submitAuth"')
);
}
/**
* @Given /^I am a teacher$/
*/
public function iAmATeacher()
{
return array(
new Given('I am on "/index.php?logout=logout"'),
new Given('I am on homepage'),
new Given('I fill in "login" with "mmosquera"'),
new Given('I fill in "password" with "mmosquera"'),
new Given('I press "submitAuth"')
);
}
/**
* @Given /^I am a teacher in course "([^"]*)"$/
* @Todo implement
*/
public function iAmATeacherInCourse($course)
{
//$sql = "SELECT * FROM course_rel_user WHERE c_id = X AND user_id = ";
//$result = ...
//if ($result !== false) { ... }
}
/**
* @Given /^I am a student$/
*/
public function iAmAStudent()
{
return array(
new Given('I am on "/index.php?logout=logout"'),
new Given('I am on homepage'),
new Given('I fill in "login" with "mbrandybuck"'),
new Given('I fill in "password" with "mbrandybuck"'),
new Given('I press "submitAuth"')
);
}
/**
* @Given /^I am an HR manager$/
*/
public function iAmAnHR()
{
return array(
new Given('I am on "/index.php?logout=logout"'),
new Given('I am on homepage'),
new Given('I fill in "login" with "ptook"'),
new Given('I fill in "password" with "ptook"'),
new Given('I press "submitAuth"')
);
}
/**
* @Given /^I am a student boss$/
*/
public function iAmAStudentBoss()
{
return array(
new Given('I am on "/index.php?logout=logout"'),
new Given('I am on homepage'),
new Given('I fill in "login" with "abaggins"'),
new Given('I fill in "password" with "abaggins"'),
new Given('I press "submitAuth"')
);
}
/**
* @Given /^I am an invitee$/
*/
public function iAmAnInvitee()
{
return array(
new Given('I am on "/index.php?logout=logout"'),
new Given('I am on homepage'),
new Given('I fill in "login" with "bproudfoot"'),
new Given('I fill in "password" with "bproudfoot"'),
new Given('I press "submitAuth"')
);
}
/**
* @Given /^course "([^"]*)" exists$/
*/
public function courseExists($argument)
{
return array(
new Given('I am a platform administrator'),
new Given('I am on "/main/admin/course_list.php?keyword=' . $argument . '"'),
new Given('I should see "' . $argument . '"'),
);
}
/**
* @Given /^course "([^"]*)" is deleted$/
*/
public function courseIsDeleted($argument)
{
return array(
new Given('I am a platform administrator'),
new Given('I am on "/main/admin/course_list.php?keyword=' . $argument . '"'),
new Given('I follow "Delete"')
);
}
/**
* @Given /^I am in course "([^"]*)"$/
* @Todo redefine function to be different from I am on course TEMP homepage
*/
public function iAmInCourse($argument)
{
return array(
new Given('I am on "/main/course_home/course_home.php?cDir=' . $argument . '"'),
new Given('I should not see an ".alert-danger" element')
);
}
/**
* @Given /^I am on course "([^"]*)" homepage$/
*/
public function iAmOnCourseXHomepage($argument)
{
return array(
new Given('I am on "/main/course_home/course_home.php?cDir=' . $argument . '"'),
new Given('I should not see an ".alert-danger" element')
);
}
/**
* @Given /^I am a "([^"]*)" user$/
*/
public function iAmAXUser($argument)
{
return array(
new Given('I am on "/main/auth/profile.php"'),
new Given('the "language" field should contain "' . $argument . '"')
);
}
}

@ -1,143 +0,0 @@
# features/courseTools.feature
@common @tools
Feature: Course tools basic testing
In order to use a course
As a teacher
I need to be able to enter a course and each of its tools
Background:
Given I am a platform administrator
And I am a "English" user
# This is executed just before each scenario below
Scenario: Create a course before testing
Given I am on "/main/admin/course_add.php"
When I fill in "title" with "TEMP"
And I press "submit"
Then I should see "Course list"
Scenario: Make sure the course exists
Given course "TEMP" exists
Then I should not see an ".alert-danger" element
Scenario: Make sure the course description tool is available
Given I am on course "TEMP" homepage
And I am on "/main/course_description/index.php"
Then I should not see an ".alert-danger" element
Scenario: Make sure the documents tool is available
Given I am on course "TEMP" homepage
And I am on "/main/document/document.php"
Then I should not see an ".alert-danger" element
Scenario: Make sure the learning path tool is available
Given I am on course "TEMP" homepage
And I am on "/main/newscorm/lp_controller.php"
Then I should not see an ".alert-danger" element
Scenario: Make sure the links tool is available
Given I am on course "TEMP" homepage
And I am on "/main/link/link.php"
Then I should not see an ".alert-danger" element
Scenario: Make sure the tests tool is available
Given I am on course "TEMP" homepage
And I am on "/main/exercice/exercice.php"
Then I should not see an ".alert-danger" element
Scenario: Make sure the announcements tool is available
Given I am on course "TEMP" homepage
And I am on "/main/announcements/announcements.php"
Then I should not see an ".alert-danger" element
Scenario: Make sure the assessments tool is available
Given I am on course "TEMP" homepage
And I am on "/main/gradebook/index.php"
Then I should not see an ".alert-danger" element
Scenario: Make sure the glossary tool is available
Given I am on course "TEMP" homepage
And I am on "/main/glossary/index.php"
Then I should not see an ".alert-danger" element
Scenario: Make sure the attendances tool is available
Given I am on course "TEMP" homepage
And I am on "/main/attendances/index.php"
Then I should not see an ".alert-danger" element
Scenario: Make sure the course progress tool is available
Given I am on course "TEMP" homepage
And I am on "/main/course_progress/index.php"
Then I should not see an ".alert-danger" element
Scenario: Make sure the agenda tool is available
Given I am on course "TEMP" homepage
And I am on "/main/calendar/agenda.php"
Then I should not see an ".alert-danger" element
Scenario: Make sure the forums tool is available
Given I am on course "TEMP" homepage
And I am on "/main/forum/index.php"
Then I should not see an ".alert-danger" element
Scenario: Make sure the dropbox tool is available
Given I am on course "TEMP" homepage
And I am on "/main/dropbox/index.php"
Then I should not see an ".alert-danger" element
Scenario: Make sure the users tool is available
Given I am on course "TEMP" homepage
And I am on "/main/user/index.php"
Then I should not see an ".alert-danger" element
Scenario: Make sure the groups tool is available
Given I am on course "TEMP" homepage
And I am on "/main/group/group.php"
Then I should not see an ".alert-danger" element
Scenario: Make sure the chat tool is available
Given I am on course "TEMP" homepage
And I am on "/main/chat/index.php"
Then I should not see an ".alert-danger" element
Scenario: Make sure the assignments tool is available
Given I am on course "TEMP" homepage
And I am on "/main/work/work.php"
Then I should not see an ".alert-danger" element
Scenario: Make sure the surveys tool is available
Given I am on course "TEMP" homepage
And I am on "/main/survey/index.php"
Then I should not see an ".alert-danger" element
Scenario: Make sure the wiki tool is available
Given I am on course "TEMP" homepage
And I am on "/main/wiki/index.php"
Then I should not see an ".alert-danger" element
Scenario: Make sure the notebook tool is available
Given I am on course "TEMP" homepage
And I am on "/main/notebook/index.php"
Then I should not see an ".alert-danger" element
Scenario: Make sure the projects tool is available
Given I am on course "TEMP" homepage
And I am on "/main/blog/blog_admin.php"
Then I should not see an ".alert-danger" element
Scenario: Make sure the reporting tool is available
Given I am on course "TEMP" homepage
And I am on "/main/tracking/courseLog.php"
Then I should not see an ".alert-danger" element
Scenario: Make sure the settings tool is available
Given I am on course "TEMP" homepage
And I am on "/main/course_info/infocours.php"
Then I should not see an ".alert-danger" element
Scenario: Make sure the backup tool is available
Given I am on course "TEMP" homepage
And I am on "/main/course_info/maintenance.php"
Then I should not see an ".alert-danger" element

@ -1,36 +0,0 @@
@administration
Feature: Courses management as admin
In order to add courses
As an administrator
I need to be able to create new courses from the admin page
Background:
Given I am a platform administrator
# This is executed just before each scenario below
Scenario: See the courses list
Given I am on "/main/admin/course_list.php"
Then I should see "Course list"
And I should not see "not authorized"
Scenario: See the course creation link on the admin page
Given I am on "/main/admin/index.php"
Then I should see "Create a course"
Scenario: Access the course creation page
Given I am on "/main/admin/course_add.php"
Then I should not see "not authorized"
Scenario: Access the course creation page
Given I am on "/main/admin/course_add.php"
When I fill in "title" with "TESTCOURSE1"
And I press "submit"
Then I should see "Course list"
Scenario: Search and delete a course
Given I am on "/main/admin/course_list.php"
And I fill in "course-search-keyword" with "TESTCOURSE1"
And I press "submit"
When I follow "Delete"
Then I should see "Course list"
And I should not see "not be deleted"

@ -1,33 +0,0 @@
@administration
Feature: Users management as admin
In order to add users
As an administrator
I need to be able to create new users
Scenario: See the users list link on the admin page
Given I am a platform administrator
And I am on "/main/admin/index.php"
Then I should see "Users list"
Scenario: See the user creation link on the admin page
Given I am a platform administrator
And I am on "/main/admin/index.php"
Then I should see "Add a user"
Scenario: Create a user with only basic info
Given I am a platform administrator
And I am on "/main/admin/user_add.php"
When I fill in "firstname" with "Sammy"
And I fill in "lastname" with "Marshall"
And I fill in "username" with "smarshall"
And I fill in "email" with "smarshall@example.com"
And I press "submit"
Then I should see "The user has been added"
Scenario: Search and delete a user
Given I am a platform administrator
And I am on "/main/admin/user_list.php"
And I fill in "keyword" with "smarshall"
And I press "submit"
When I follow "Delete"
Then I should see "The user has been deleted"

@ -1,35 +0,0 @@
# features/login.feature
@common
Feature: User login
In order to log in
As any registered user
I need to be able to enter my details in the form and get in
Scenario: Login as admin user successfully
Given I am a platform administrator
Then I should not see an ".alert-danger" element
Scenario: Create tests users successfully
Given I am a platform administrator
And I am on "/main/admin/filler.php?fill=users"
Then I should not see an ".alert-danger" element
Scenario: Login as student user successfully
Given I am a student
Then I should not see an ".alert-danger" element
Scenario: Login as teacher successfully
Given I am a teacher
Then I should not see an ".alert-danger" element
Scenario: Login as HRD successfully
Given I am an HR manager
Then I should not see an ".alert-danger" element
Scenario: Login as student bott successfully
Given I am a student boss
Then I should not see an ".alert-danger" element
Scenario: Login as invitee successfully
Given I am an invitee
Then I should not see an ".alert-danger" element

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 213 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 111 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 113 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 226 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 171 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 89 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 964 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 192 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

@ -1,8 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
</head>
<body>
<br />
</body>
</html>

@ -1,49 +0,0 @@
<?php
/**
* A standalone test for the internationalization library.
* @author Ricardo Rodriguez Salazar, 2009.
* @author Ivan Tcholakov, September 2009.
* For licensing terms, see /license.txt
*/
//ini_set('memory_limit','128M');
$_current_dir = dirname(__FILE__).'/';
$_sys_code_path = $_current_dir.'../main/';
$_sys_include_path = $_sys_code_path.'inc/';
$_sys_library_path = $_sys_code_path.'inc/lib/';
$_test_sys_code_path = $_current_dir.'main/';
$_test_sys_include_path = $_test_sys_code_path.'inc/';
$_test_sys_library_path = $_test_sys_code_path.'inc/lib/';
require_once($_current_dir.'simpletest/unit_tester.php');
require_once($_sys_include_path.'global.inc.php');
//header('Content-Type: text/html; charset=' . $charset);
header('Content-Type: text/html; charset=' . 'UTF-8');
require_once($_current_dir.'simpletest/web_tester.php');
require_once($_current_dir.'simpletest/mock_objects.php');
require_once($_current_dir.'simpletest/autorun.php');
$_SESSION['_user']['user_id'] = 1;
class InternationalizationTests extends TestSuite {
function InternationalizationTests() {
$this->TestSuite('Internationalization Tests');
global $_test_sys_library_path;
$this->addTestFile($_test_sys_library_path.'internationalization.lib.test.php');
}
}
$test = & new InternationalizationTests();
//$test-> run( new HtmlReporter());
?>

@ -1 +0,0 @@
Code browser report will be generated in this directory

@ -1,4 +0,0 @@
<html>
<body>
</body>
</html>

@ -1,114 +0,0 @@
<?php
class TestCalendar extends UnitTestCase
{
public function TestCalendar(){
$this->UnitTestCase('Admin calendar library - main/admin/calendar.inc.test.php');
}
public function testToJavascript(){
$res = to_javascript();
$this->assertTrue($res);
$this->assertTrue(is_string($res));
//var_dump($res);
}
public function testStoreNewAgendaItem(){
global $_user;
$res_store = store_new_agenda_item();
$this->assertTrue(is_numeric($res_store));
//delete the new agenda item in the database
if (is_numeric($res_store)) {
$res_delete = delete_agenda_item($res_store);
$this->assertTrue(is_numeric($res_store));
}
}
public function testAddWeek(){
$timestamp=12;
$num=1;
$res = add_week($timestamp,$num);
$this->assertTrue(is_numeric($res));
//var_dump($res);
}
public function testAddMonth(){
$timestamp=5;
$num=1;
$res = add_month($timestamp,$num);
$this->assertTrue(is_numeric($res));
//var_dump($res);
}
public function testAddYear(){
$timestamp=9999;
$num=1;
$res = add_year($timestamp,$num);
$this->assertTrue(is_numeric($res));
//var_dump($res);
}
/**
* Adds a repetitive item to the database
* @param array Course info
* @param int The original event's id
* @param string Type of repetition
* @param int Timestamp of end of repetition (repeating until that date)
* @param array Original event's destination
* @return boolean False if error, True otherwise
*/
public function testAgendaAddRepeatItem(){
//this function is not used or deprecated
}
public function testCalculateStartEndOfWeek(){
$week_number=4;
$year=2011;
$res = calculate_start_end_of_week($week_number, $year);
$this->assertTrue(is_array($res));
$this->assertTrue($res);
//var_dump($res);
}
public function testGetDayAgendaitems() {
$courses_dbs=array();
$month=01;
$year=2010;
$day='1';
$res = get_day_agendaitems($courses_dbs, $month, $year, $day);
$this->assertTrue(is_array($res));
}
public function testDeleteAgendaItem(){
$id=1;
$res = delete_agenda_item($id);
$this->assertTrue(is_bool($res));
}
public function testDisplayMinimonthcalendar(){
ob_start();
global $DaysShort;
$agendaitems=array('test','test2');
$month=01;
$year=2010;
$monthName='';
$res = display_minimonthcalendar($agendaitems, $month, $year, $monthName);
ob_end_clean();
$this->assertTrue(is_null($res));
//var_dump($res);
}
public function testShowUserFilterForm(){
ob_start();
$res = show_user_filter_form();
ob_end_clean();
$this->assertTrue(is_null($res));
}
public function testIsRepeatedEvent() {
//This is deprecated or not used
}
}

@ -1,188 +0,0 @@
<?php
class TestStatistics extends UnitTestCase
{
public function TestStatistics()
{
$this->UnitTestCase('this File test the provides some function for statistics ');
}
public function setUp()
{
$this->statisc = new Statistics();
}
public function tearDown()
{
$this->statisc = null;
}
public function testMakeSizeString()
{
$size = 20960000;
$res = Statistics::makeSizeString($size);
$this->assertTrue(is_string($res));
//var_dump($res);
}
/**
* Count courses
* @param string $category_code Code of a course category. Default: count
* all courses.
* @return int Number of courses counted
*/
public function testCountCourses()
{
$res = Statistics::countCourses();
$this->assertTrue(is_numeric($res));
//var_dump($res);
}
public function testCountUsers()
{
$user_id = '1';
$category_code = null;
$course_code = 'ABC';
$firstName = 'Jhon';
$lastName = 'Doe';
$status = '1';
$email = 'localhost@localhost.com';
$loginName = 'admin';
$password = 'admin';
$count_invisible_courses = true;
$res = Statistics::countUsers($status, $category_code,
$count_invisible_courses);
$this->assertTrue(is_numeric($res));
$this->assertTrue(count($res) === 0 || count($res) !== 0);
}
public function testGetNumberOfActivities()
{
$resu = Statistics::getNumberOfActivities();
if (!is_null($resu)) {
$this->assertTrue(is_numeric($resu));
$this->assertTrue(count($resu) == 0 || count($resu) !== 0);
}
}
/**
* Get activities data to display
*/
public function testGetActivitiesData()
{
global $dateTimeFormatLong;
$from = 0;
$number_of_items = 30;
$column = '';
$direction = 'ASC';
$resu = Statistics::getActivitiesData($from, $number_of_items, $column,
$direction);
$this->assertTrue(is_array($resu));
}
/**
* Get all course categories
* @return array All course categories (code => name)
*/
public function testGetCourseCategories()
{
$res = Statistics::getCourseCategories();
$this->assertTrue($res);
//var_dump($res);
}
public function testRescale()
{
$data = array('test', 'test2', 'test3');
$max = 500;
$res = Statistics::rescale($data, $max);
$this->assertTrue($res);
$this->assertTrue(is_array($res));
//var_dump($res);
}
public function testPrintStats()
{
ob_start();
$title = 'testing';
$stats = array('test', 'test2', 'test3');
$show_total = true;
$is_file_size = false;
$res = Statistics::printStats(
$title,
$stats,
$show_total = true,
$is_file_size = false
);
ob_end_clean();
$this->assertTrue(is_null($res));
//var_dump($res);
}
public function testPrintLoginStats()
{
ob_start();
$type = 'month';
$resu = Statistics::printLoginStats($type);
ob_end_clean();
$this->assertTrue(is_null($resu));
//var_dump($resu);
}
public function testPrintRecentLoginStats()
{
ob_start();
$res = Statistics::printRecentLoginStats();
ob_end_clean();
$this->assertTrue(is_null($res));
//var_dump($res);
}
public function testPrintToolStats()
{
ob_start();
$resu = Statistics::printToolStats();
ob_end_clean();
$this->assertTrue(is_null($resu));
}
public function testPrintCourseByLanguageStats()
{
ob_start();
$resu = Statistics::printCourseByLanguageStats();
ob_end_clean();
$this->assertTrue(is_null($resu));
//var_dump($resu);
}
public function testPrintUserPicturesStats()
{
ob_start();
$resu = Statistics::printUserPicturesStats();
ob_end_clean();
$this->assertTrue(is_null($resu));
}
public function testPrintActivitiesStats()
{
ob_start();
$res = Statistics::printActivitiesStats();
ob_end_clean();
$this->assertTrue(is_null($res));
//var_dump($res);
}
public function testPrintCourseLastVisit()
{
ob_start();
$column = '';
$direction = '';
$parameters['action'] = 'courselastvisit';
$res = Statistics::printCourseLastVisit();
ob_end_clean();
$this->assertTrue(is_null($res));
}
}
?>

@ -1,206 +0,0 @@
<?php
class TestSubLanguageManager extends UnitTestCase
{
public $clean = array();
public function __construct() {
$this->UnitTestCase('Sublanguage Manager library - main/admin/sub_language.class.test.php');
}
/**
* Testing who get all data of lang folder
* @param String to url path folder
* @param bool true if we only want the subname
* @return Array All file of lang folder
*/
public function testget_lang_folder_files_list(){
$path = api_get_path(SYS_LANG_PATH).'english';
$res = SubLanguageManager::get_lang_folder_files_list($path, $only_main_name = false);
$this->assertTrue(is_array($res));
$this->assertTrue(count($res)>0);
}
/**
*
*
*/
public function testget_all_information_of_sub_language(){
$parent_id = 13;
$language_id = 10;
$res = SubLanguageManager::get_all_information_of_sub_language($parent_id, $language_id);
// under normal circumstances, there is no language 10 child of language 13
$this->assertFalse($res);
}
/**
*
*/
public function testget_all_information_of_language(){
$parent_id = 11;
$res = SubLanguageManager::get_all_information_of_language($parent_id);
$this->assertTrue(is_array($res));
}
/**
* Get variables within a language file
*/
public function testget_all_language_variable_in_file(){
$system_path_folder = api_get_path(SYS_LANG_PATH);
$system_path_file = $system_path_folder.'spanish/link.inc.php';
$res = SubLanguageManager::get_all_language_variable_in_file($system_path_file);
$this->assertTrue(is_array($res));
}
/**
* Add directory for sub-language
* @param String The sub-language path directory ( /var/www/my_lms/main/lang/spanish_corporate )
* @return boolean
*/
public function testadd_language_directory() {
$res = SubLanguageManager :: add_language_directory('test');
$this->assertTrue($res);
$res = SubLanguageManager :: remove_language_directory('test');
}
/**
*
*/
public function testadd_file_in_language_directory(){
$res = SubLanguageManager :: add_language_directory('test');
$this->assertTrue($res);
$system_path_file = api_get_path(SYS_LANG_PATH).'test/spanish.inc.php';
$res = SubLanguageManager::add_file_in_language_directory($system_path_file);
$this->assertTrue($res);
$res = SubLanguageManager :: remove_language_directory('test');
}
public function testwrite_data_in_file(){
$dirname = api_get_path(SYS_LANG_PATH);
$file = $dirname.'spanish.inc.php';
$path_file = $file;
$new_sub_language='spanishtest';
$variable_sub_language='test';
$res = SubLanguageManager::write_data_in_file($path_file,$new_sub_language,$variable_sub_language);
$this->assertTrue($res);
}
/**
* Delete sub language of database
* @param Integer id's.
* @return null
*/
public function Testremove_sub_language() {
$parent_id = '';
$sub_language_id = 1;
$res = SubLanguageManager :: remove_sub_language($parent_id, $sub_language_id);
$this->assertFalse($res);
// var_dump($res);
}
/**
* Test of Check if language exist by id
* @param Integer
* @return Boolean
*/
public function Testcheck_if_exist_language_by_id() {
$language_id = 14;
$res = SubLanguageManager :: check_if_exist_language_by_id($language_id);
$this->assertTrue($res);
// var_dump($res);
}
/**
* Show the name of language by id
* @param Integer id
* @return String the name of language
*/
public function Testget_name_of_language_by_id() {
$language_id = 13;
$tbl_admin_languages = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
$sql='SELECT original_name FROM '.$tbl_admin_languages.' WHERE id=13';
$rs=Database::query($sql);
$name ='';
if (Database::num_rows($rs)>0) {
$name = Database::result($rs,0,'original_name');
}
$res = SubLanguageManager :: get_name_of_language_by_id($language_id);
$this->assertEqual($res,$name,'The language name from function does not match the database value');
}
/**
* Verified if language is an sub-language
* @param Integer
* @return Boolean
*/
public function Testcheck_if_language_is_sub_language_for_non_existing_sublanguage() {
$language_id = 112;
$res = SubLanguageManager :: check_if_language_is_sub_language($language_id);
$this->assertFalse($res);
// var_dump($res);
}
/**
*
*/
public function Testcheck_if_language_is_father() {
$language_id = 12;
$res = SubLanguageManager :: check_if_language_is_father($language_id);
$this->assertFalse($res);
// var_dump($res);
}
/**
*
*/
public function Testmake_language_unavailable_and_back() {
$language_id = 11;
$res = SubLanguageManager :: make_unavailable_language($language_id);
$this->assertTrue($res,'Language could not be made unavailable');
$res = SubLanguageManager :: make_available_language($language_id);
// var_dump($res);
}
/**
*
*/
public function Testmake_available_language() {
$language_id= 11;
$res = SubLanguageManager :: make_unavailable_language($language_id);
$res = SubLanguageManager :: make_available_language ($language_id);
$this->assertTrue($res,'Language could not be made available');
// var_dump($res);
}
/**
*
*
*/
public function Testset_platform_language_empty(){
$backup = SubLanguageManager :: get_platform_language_id();
$language_id = '';
$res = SubLanguageManager :: set_platform_language($language_id);
$this->assertFalse($res);
$res = SubLanguageManager :: set_platform_language($backup);
// var_dump($res);
}
public function Testset_platform_language_2(){
$backup = SubLanguageManager :: get_platform_language_id();
$language_id = 2;
$res = SubLanguageManager :: set_platform_language($language_id);
$this->assertTrue($res);
$res = SubLanguageManager :: set_platform_language($backup);
// var_dump($res);
}
/**
*
*
*/
public function Testremove_directory_of_sub_language(){
$res = SubLanguageManager :: remove_language_directory('test');
// create a directory of sub language
$res = SubLanguageManager :: add_language_directory('test');
$this->assertTrue($res);
$res = SubLanguageManager :: remove_language_directory('test');
// var_dump($res);
}
}
?>

@ -1,80 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
class TestAnnouncements extends UnitTestCase {
function TestAnnouncements(){
$this->UnitTestCase('Displays one specific announcement test');
}
public function Testconstruct_not_selected_select_form(){
$courseSysCode= '123';
$course_code = $courseSysCode;
ob_start();
$to_already_selected="";
$_SESSION['_cid'] = 'CURSO1';
$user_list = array( 0=>array(
0 => '1','user_id' => '1',
1 =>'Doe','lastname' =>'Doe',
2 =>'John','firstname' =>'John',
3 => 'admin','username' =>'admin'
));
$res = construct_not_selected_select_form($group_list=null, $user_list,$to_already_selected);
ob_end_clean();
$this->assertTrue(is_null($res));
//var_dump($res);
}
public function Testconstruct_selected_select_form(){
$to_already_selected="";
ob_start();
$res = construct_selected_select_form($group_list=null, $user_list=null,$to_already_selected);
ob_end_clean();
$this->assertTrue(is_null($res));
//var_dump($res);
}
public function Testshow_to_form_group(){
ob_start();
$group_id=1;
$group_users=GroupManager::get_subscribed_users($group_id);
$res = show_to_form_group($group_id);
ob_end_clean();
$this->assertTrue(is_null($res));
//var_dump($res);
}
public function Testget_course_users(){
$_SESSION['id_session'] = 'CURSO1';
$user_list = CourseManager::get_real_and_linked_user_list(api_get_course_id(), true, $_SESSION['id_session']);
$res = get_course_users();
if($res = array($res)){
$this->assertTrue(is_array($res));
} else {
$this->assertTrue(is_null($res));
}
//var_dump($res);
}
public function Testget_course_groups(){
$_SESSION['id_session']='CURSO1';
$new_group_list = CourseManager::get_group_list_of_course(api_get_course_id(), intval($_SESSION['id_session']));
$res = get_course_groups();
$this->assertFalse($res);
$this->assertTrue(is_array($res));
var_dump($res);
}
public function Testload_edit_users(){
$_SESSION['id_session']='CURSO1';
global $_course;
global $tbl_item_property;
$tbl_item_property = Database::get_course_table(TABLE_ITEM_PROPERTY);
$tool = '';
$id = '';
$res = load_edit_users($tool, $id);
$this->assertTrue(is_null($res));
var_dump($res);
}
}

@ -1,71 +0,0 @@
<?php
require_once(api_get_path(SYS_CODE_PATH).'auth/openid/xrds.lib.php');
class TestXrds extends UnitTestCase {
public function __construct(){
$this->UnitTestCase('XRDS library for OpenID - main/auth/openid/xrds.lib.test.php');
}
/*
function testxrds_cdata() {
global $xrds_open_elements, $xrds_services, $xrds_current_service;
$parser='';
$data='';
$res=_xrds_cdata(&$parser, $data);
$this->assertTrue(is_null($res));
//var_dump($res);
}
*/
function testxrdsparse() {
$xml = <<<XML
<xml version="1.0">
<users>
<fname>Christian</fname>
<lname>Fasa Fasa</lname>
</users>
XML;
$parser = xrds_parse($xml);
if (is_resource($parser)) {
$this->assertTrue(is_resource($parser));
} else {
$this->assertTrue(is_null($parser));
}
}
/*
function test_xrds_element_end() {
global $xrds_open_elements, $xrds_services, $xrds_current_service;
$parser='';
$name='';
$xrds_current_service['version'] = 2;
$xrds_current_service['version'] = 1;
$xrds_services[] = $xrds_current_service;
$xrds_current_service= array();
$res=_xrds_element_end(&$parser, $name);
$this->assertTrue(is_null($res));
//var_dump($xrds_current_service);
}
function test_xrds_element_start() {
global $xrds_open_elements;
$name='';
$attribs='';
$res=_xrds_element_start(&$parser, $name, $attribs);
$this->assertTrue(is_null($res));
//var_dump($res);
}
function test_xrds_strip_namespace() {
$name='';
$res=_xrds_strip_namespace($name);
$this->assertTrue(is_string($res));
//var_dump($res);
}*/
}
?>

@ -1,79 +0,0 @@
<?php
require_once(api_get_path(SYS_CODE_PATH).'chat/chat_functions.lib.php');
require_once(api_get_path(LIBRARY_PATH).'course.lib.php');
class TestChatFunctions extends UnitTestCase {
public function __construct(){
$this->UnitTestCase('Chat library - main/chat/chat_functions.lib.test.php');
}
public function setUp() {
$this->tcourse = new CourseManager();
}
public function tearDown() {
$this->tcourse = null;
}
function testuser_connected_in_chat () {
$course_code = 'COURSETEST';
$user_id = 1;
$res = user_connected_in_chat($user_id);
$this->assertTrue(is_bool($res));
}
function testUsersListInChat () {
$course_code = 'COURSETEST';
$course_info = api_get_course_info($course_code);
$database_name = $course_info['dbName'];
$res = users_list_in_chat($database_name);
$this->assertTrue(is_array($res));
//var_dump($res);
}
function CreateChatConnection($database_name) {
$session_id = 1;
$tbl_chat_connected = Database::get_main_table(TABLE_MAIN_CHAT);
$sql = "SELECT user_id FROM $tbl_chat_connected WHERE user_id = 1";
$result = Database::query($sql);
//The user_id exists so we must do an UPDATE and not a INSERT
$current_time = date('Y-m-d H:i:s');
if (Database::num_rows($result)==0) {
$query="INSERT INTO $tbl_chat_connected(user_id,last_connection,session_id)
VALUES(1,'$current_time','$session_id')";
} else {
$query="UPDATE $tbl_chat_connected set last_connection='".$current_time."'
WHERE user_id=1 AND session_id='$session_id'";
}
Database::query($query);
}
function testExitOfChat () {
$course_code = 'COURSETEST';
$course_info = api_get_course_info($course_code);
$database_name = $course_info['dbName'];
$this->CreateChatConnection($database_name);
$user_id = 1;
$res = exit_of_chat($user_id);
//$resu = $this->tcourse->delete_course($course_code);
$this->assertTrue(is_null($res));
//var_dump($res);
}
function testDisconnectUserOfChat() {
$_SESSION['is_courseAdmin'] = 1;
$course_code = 'COURSETEST';
$course_info = api_get_course_info($course_code);
$database_name = $course_info['dbName'];
$this->CreateChatConnection($database_name);
$res = disconnect_user_of_chat($database_name);
$this->assertTrue(is_null($res));
}
}
?>

@ -1,16 +0,0 @@
<?php
require_once(api_get_path(SYS_CODE_PATH).'conference/get_translation.lib.php');
class TestGetTranslation extends UnitTestCase {
public function __construct() {
$this->UnitTestCase('Conference translation getter library - main/conference/get_translation.lib.test.php');
}
function testget_language_file_as_xml(){
ob_start();
$res=get_language_file_as_xml($language='english');
ob_end_clean();
$this->assertTrue(is_string($res));
}
}

@ -1,319 +0,0 @@
<?php
class TestDropbox extends UnitTestCase {
public $ddropboxwork;
public $ddropboxsentwork;
public $dperson;
public function TestDropbox() {
$this->UnitTestCase('');
}
public function setUp() {
global $dropbox_cnf;
$dropbox_cnf['tbl_post'] = Database::get_course_table(TABLE_DROPBOX_POST);
$dropbox_cnf['tbl_file'] = Database::get_course_table(TABLE_DROPBOX_FILE);
$dropbox_cnf['tbl_person'] = Database::get_course_table(TABLE_DROPBOX_PERSON);
$dropbox_cnf['tbl_intro'] = Database::get_course_table(TABLE_TOOL_INTRO);
$dropbox_cnf['tbl_user'] = Database::get_main_table(TABLE_MAIN_USER);
$dropbox_cnf['tbl_course_user'] = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$dropbox_cnf['tbl_category'] = Database::get_course_table(TABLE_DROPBOX_CATEGORY);
$dropbox_cnf['tbl_feedback'] = Database::get_course_table(TABLE_DROPBOX_FEEDBACK);
$this->ddropboxwork = new Dropbox_Work(1);
$this->ddropboxsentwork = new Dropbox_SentWork(1);
$this->dperson = new Dropbox_Person(1, 1, 1);
}
public function tearDown() {
$this-> ddropboxwork = null;
$this-> ddropboxsentwork = null;
$this-> dperson = null;
}
//Class Dropbox_Work
/**
* Constructor calls private functions to create a new work or retreive an existing work from DB
* depending on the number of parameters
*
* @param unknown_type $arg1
* @param unknown_type $arg2
* @param unknown_type $arg3
* @param unknown_type $arg4
* @param unknown_type $arg5
* @param unknown_type $arg6
* @return Dropbox_Work
*/
function testDropbox_Work() {
$arg1=1;
$resu= $this->ddropboxwork->Dropbox_Work($arg1, $arg2=null, $arg3=null, $arg4=null, $arg5=null, $arg6=null);
$this->assertTrue(is_null($resu));
//var_dump($resu);
}
/**
* private function creating a new work object
*
* @param unknown_type $uploader_id
* @param unknown_type $title
* @param unknown_type $description
* @param unknown_type $author
* @param unknown_type $filename
* @param unknown_type $filesize
*
* @todo $author was originally a field but this has now been replaced by the first and lastname of the uploader (to prevent anonymous uploads)
* As a consequence this parameter can be removed
*/
function testCreateNewWork() {
global $dropbox_cnf;
$uploader_id=1;
$title='test';
$description = 'testing';
$author= 'test';
$filename='test.txt';
$filesize=125;
$resu= $this->ddropboxwork->_createNewWork($uploader_id, $title, $description, $author, $filename, $filesize);
$this->assertTrue(is_null($resu));
//var_dump($resu);
}
/**
* private function creating existing object by retreiving info from db
*
* @param unknown_type $id
*/
function testCreateExistingWork() {
global $dropbox_cnf;
$dropbox_cnf['tbl_file'] = Database::get_course_table(TABLE_DROPBOX_FILE);
$dropbox_cnf['tbl_feedback'] = Database::get_course_table(TABLE_DROPBOX_FEEDBACK);
$id = 1;
$resu= $this->ddropboxwork->_createExistingWork($id);
$this->assertTrue(is_null($resu));
//var_dump($resu);
}
//Class Dropbox_SentWork
/**
* Constructor calls private functions to create a new work or retreive an existing work from DB
* depending on the number of parameters
*
* @param unknown_type $arg1
* @param unknown_type $arg2
* @param unknown_type $arg3
* @param unknown_type $arg4
* @param unknown_type $arg5
* @param unknown_type $arg6
* @param unknown_type $arg7
* @return Dropbox_SentWork
*/
function testDropbox_SentWork() {
$arg1 = 1;
$resu= $this->ddropboxsentwork->Dropbox_SentWork($arg1, $arg2=null, $arg3=null, $arg4=null, $arg5=null, $arg6=null, $arg7=null);
$this->assertTrue(is_null($resu));
}
/**
* private function creating a new SentWork object
*
* @param unknown_type $uploader_id
* @param unknown_type $title
* @param unknown_type $description
* @param unknown_type $author
* @param unknown_type $filename
* @param unknown_type $filesize
* @param unknown_type $recipient_ids
*/
function testCreateNewSentWork() {
$recipient_ids = array(1,2);
$uploader_id=1;
$title='test';
$description = 'testing';
$author= 'test';
$filename='test.txt';
$filesize=125;
$resu= $this->ddropboxsentwork->_createNewSentWork($uploader_id, $title, $description, $author, $filename, $filesize, $recipient_ids);
$this->assertTrue(is_null($resu));
}
/**
* private function creating existing object by retreiving info from db
*
* @param unknown_type $id
*/
function testCreateExistingSentWork() {
$id = 1;
$resu= $this->ddropboxsentwork->_createExistingSentWork($id);
$this->assertTrue(is_null($resu));
}
//Class Dropbox_SentWork
/**
* Constructor for recreating the Dropbox_Person object
*
* @param unknown_type $userId
* @param unknown_type $isCourseAdmin
* @param unknown_type $isCourseTutor
* @return Dropbox_Person
*/
function testDropbox_Person() {
$userId = 1;
$isCourseAdmin = 1;
$isCourseTutor = 1;
$resu= $this->dperson->Dropbox_Person($userId, $isCourseAdmin, $isCourseTutor);
$this->assertTrue(is_null($resu));
}
/**
* This private method is used by the usort function in the
* orderSentWork and orderReceivedWork methods.
* It compares 2 work-objects by 1 of the properties of that object, dictated by the
* private property _orderBy
*
* @param unknown_type $a
* @param unknown_type $b
* @return -1, 0 or 1 dependent of the result of the comparison.
*/
function testCmpWork() {
$a = 1;
$b = 1;
$resu= $this->dperson->_cmpWork($a, $b);
if(!is_numeric($resu)) {
$this->assertTrue(is_null($resu));
}
}
/**
* method that sorts the objects in the sentWork array, dependent on the $sort parameter.
* $sort can be lastDate, firstDate, title, size, ...
*
* @param unknown_type $sort
*/
function testorderSentWork() {
$sort = 1;
$resu= $this->dperson->orderSentWork($sort);
if(!is_numeric($resu)) {
$this->assertTrue(is_null($resu));
}
}
/**
* method that sorts the objects in the receivedWork array, dependent on the $sort parameter.
* $sort can be lastDate, firstDate, title, size, ...
* @param unknown_type $sort
*/
function testorderReceivedWork() {
$sort = 1;
$resu= $this->dperson->orderReceivedWork($sort);
if(!is_numeric($resu)) {
$this->assertTrue(is_null($resu));
}
}
/**
* Updates feedback for received work of this person with id=$id
*
* @param unknown_type $id
* @param unknown_type $text
*/
function testupdateFeedback() {
$id = 1;
$text = 'test';
$resu= $this->dperson->updateFeedback($id, $text);
if(!is_bool($resu)) {
$this->assertTrue(is_null($resu));
}
}
/**
* Filter the received work
* @param string $type
* @param string $value
*/
function testfilter_received_work() {
$type = 1;
$value = 1;
$resu= $this->dperson->filter_received_work($type,$value);
if(!is_bool($resu)) {
$this->assertTrue(is_null($resu));
}
}
/**
* Deletes all the received work of this person
*
*/
function testdeleteAllReceivedWork() {
$resu= $this->dperson->deleteAllReceivedWork();
if(!is_numeric($resu)) {
$this->assertTrue(is_null($resu));
}
}
/**
* Deletes all the received categories and work of this person
*/
function testdeleteReceivedWorkFolder() {
$id = 1;
$resu= $this->dperson->deleteReceivedWorkFolder($id);
if(!is_bool($resu)) {
$this->assertTrue(is_null($resu));
}
}
/**
* Deletes a received dropbox file of this person with id=$id
*
* @param integer $id
*/
function testdeleteReceivedWork() {
$id = 1;
$resu= $this->dperson->deleteReceivedWork($id);
if(!is_bool($resu)) {
$this->assertTrue(is_null($resu));
}
}
/**
* Deletes all the sent dropbox files of this person
*/
function testdeleteAllSentWork() {
$resu= $this->dperson->deleteAllSentWork();
if(!is_bool($resu)) {
$this->assertTrue(is_null($resu));
}
}
/**
* Deletes a sent dropbox file of this person with id=$id
*
* @param unknown_type $id
*/
function testdeleteSentWork() {
$id = 1;
$resu= $this->dperson->deleteSentWork($id);
if(!is_bool($resu)) {
$this->assertTrue(is_null($resu));
}
}
}
?>

@ -1,505 +0,0 @@
<?php
//include_once(api_get_path(LIBRARY_PATH)."/pclzip/pclzip.lib.php");
require_once(api_get_path(LIBRARY_PATH).'document.lib.php');
class TestDropboxFunctions extends UnitTestCase {
/**
* This function is a wrapper function for the multiple actions feature.
* @return Mixed If there is a problem, return a string message, otherwise nothing
*/
function testhandle_multiple_actions() {
global $_user, $is_courseAdmin, $is_courseTutor;
$res= handle_multiple_actions();
if(!is_null($res)){
$this->assertTrue(is_string($res));
}
//var_dump($res);
}
/**
* Displays the form to move one individual file to a category
* @return html code of the form that appears in a dokeos message box.
*/
function testdisplay_move_form() {
ob_start();
$id= 1;
$part = 'test';
$res= display_move_form($part, $id, $target=array());
ob_end_clean();
if(!is_null($res)){
$this->assertTrue(is_string($res));
}
//var_dump($res);
}
/**
* This functions displays all teh possible actions that can be performed on multiple files. This is the dropdown list that
* appears below the sortable table of the sent / or received files.
* @return html value for the dropdown list
*/
function testdisplay_action_options() {
ob_start();
$categories= 1;
$part = 'test';
$res= display_action_options($part, $categories, $current_category=0);
ob_end_clean();
if(!is_null($res)){
$this->assertTrue(is_string($res));
}
//var_dump($res);
}
/**
* this function returns the html code that displays the checkboxes next to the files so that
* multiple actions on one file are possible.
* @param $id the unique id of the file
* @param $part are we dealing with a sent or with a received file?
* @return html code
*/
function testdisplay_file_checkbox() {
$id= 1;
$part = 'test';
$res= display_file_checkbox($id, $part);
if(!is_null($res)){
$this->assertTrue(is_string($res));
}
//var_dump($res);
}
/**
* This function displays the form to add a new category.
*
* @param $category_name this parameter is the name of the category (used when no section is selected)
* @param $id this is the id of the category we are editing.
*
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @version march 2006
*/
function testdisplay_addcategory_form() {
global $dropbox_cnf;
ob_start();
$action= 'test';
$res= display_addcategory_form($category_name='', $id='',$action);
ob_end_clean();
if(!is_null($res)){
$this->assertTrue(is_string($res));
}
//var_dump($res);
}
/**
* this function displays the form to upload a new item to the dropbox.
*
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @version march 2006
*/
function testDisplay_add_form() {
global $_user, $is_courseAdmin, $is_courseTutor, $course_info, $origin, $dropbox_unid;
ob_start();
$res= display_add_form();
ob_end_clean();
if(!is_null($res)){
$this->assertTrue(is_string($res));
}
//var_dump($res);
}
/**
* This function displays the firstname and lastname of the user as a link to the user tool.
* @see this is the same function as in the new forum, so this probably has to move to a user library.
* @todo move this function to the user library
*/
function testdisplayuserlink() {
global $_otherusers;
$user_id = 1;
$res= display_user_link($user_id, $name='');
if(!is_null($res)){
$this->assertTrue(is_string($res));
}
//var_dump($res);
}
/**
* returns username or false if user isn't registered anymore
* @todo check if this function is still necessary. There might be a library function for this.
*/
function testGetUserNameFromId() {
global $dropbox_cnf;
$id = 1;
$res= getUserNameFromId($id);
if(!is_null($res)){
$this->assertTrue(is_string($res));
}
//var_dump($res);
}
/**
* returns loginname or false if user isn't registered anymore
* @todo check if this function is still necessary. There might be a library function for this.
*/
function testGetLoginFromId() {
$id = 1;
$res= getLoginFromId($id);
if(!is_null($res)){
$this->assertTrue(is_string($res));
}
//var_dump($res);
}
/**
* @desc This function retrieves the number of feedback messages on every document. This function might become obsolete when
* the feedback becomes user individual.
*/
function testget_total_number_feedback() {
global $dropbox_cnf;
$res= get_total_number_feedback($file_id='');
if(!is_null($res)){
$this->assertTrue(is_string($res));
}
//var_dump($res);
}
/**
* This function retrieves all the dropbox categories and returns them as an array
* @param $filter default '', when we need only the categories of the sent or the received part.
* @return array
*/
function testGetdropbox_categories() {
$res= get_dropbox_categories($filter='');
if(!is_null($res)){
$this->assertTrue(is_array($res));
}
//var_dump($res);
}
/**
* Mailing zip-file is posted to (dest_user_id = ) mailing pseudo_id
* and is only visible to its uploader (user_id).
* Mailing content files have uploader_id == mailing pseudo_id, a normal recipient,
* and are visible initially to recipient and pseudo_id.
* @todo check if this function is still necessary.
*/
function testgetUserOwningThisMailing() {
global $dropbox_cnf;
$mailingPseudoId = '1';
$res= getUserOwningThisMailing($mailingPseudoId, $owner = 0, $or_die = '');
if(!is_null($res)){
$this->assertTrue(is_string($res));
}
//var_dump($res);
}
/**
* Get the last access to a given tool of a given user
* @param $tool string the tool constant
* @param $course_code the course_id
* @param $user_id the id of the user
* @return string last tool access date
* @todo consider moving this function to a more appropriate place.
*/
function testget_last_tool_access() {
global $_course, $_user;
$tool = '1';
$res= get_last_tool_access($tool, $course_code='', $user_id='');
if(!is_null($res)){
$this->assertTrue(is_string($res));
}
//var_dump($res);
}
/**
* This functions stores a new dropboxcategory
* @var it might not seem very elegant if you create a category in sent and in received with the same name that you get two entries in the
* dropbox_category table but it is the easiest solution. You get
* cat_name | received | sent | user_id
* test | 1 | 0 | 237
* test | 0 | 1 | 237
* more elegant would be
* test | 1 | 1 | 237
*/
function teststoreaddcategory() {
global $_user,$dropbox_cnf;
$res= store_addcategory();
if(!is_null($res)){
$this->assertTrue(is_string($res));
}
//var_dump($res);
}
/**
* This function moves a file to a different category
* @param $id the id of the file we are moving
* @param $target the id of the folder we are moving to
* @param $part are we moving a received file or a sent file?
* @return language string
*/
function testStoremove() {
$id= 1;
$part = 'test';
$target = array();
$res= store_move($id, $target, $part);
if(!is_null($res)){
$this->assertTrue(is_string($res));
}
//var_dump($res);
}
/**
*@return selected string
*/
function teststoreadddropbox() {
global $dropbox_cnf;
global $_user;
global $_course;
$res= store_add_dropbox();
if(!is_null($res)){
$this->assertTrue(is_string($res));
}
//var_dump($res);
}
/**
* @return boolean indicating if user with user_id=$user_id is a course member
* @todo eliminate global
* @todo check if this function is still necessary. There might be a library function for this.
*/
function testIsCourseMember() {
$user_id = 1;
$res= isCourseMember($user_id);
if(!is_null($res)){
$this->assertTrue(is_bool($res));
}
//var_dump($res);
}
/**
* this function transforms the array containing all the feedback into something visually attractive.
* @param an array containing all the feedback about the given message.
*/
function testfeedback() {
$array = array();
$res= feedback($array);
if(!is_null($res)){
$this->assertTrue(is_string($res));
}
//var_dump($res);
}
/**
* This function returns the html code to display the feedback messages on a given dropbox file
* @param $feedback_array an array that contains all the feedback messages about the given document.
* @return html code
* @todo add the form for adding new comment (if the other party has not deleted it yet).
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @version march 2006
*/
function testformat_feedback() {
$feedback = array();
$res= format_feedback($feedback);
if(!is_null($res)){
$this->assertTrue(is_string($res));
}
//var_dump($res);
}
/**
* this function returns the code for the form for adding a new feedback message to a dropbox file.
* @return html code
*/
function testfeedback_form() {
global $dropbox_cnf;
$res= feedback_form();
if(!is_null($res)){
$this->assertTrue(is_string($res));
}
//var_dump($res);
}
/**
* @return a language string (depending on the success or failure.
*/
function teststore_feedback() {
global $dropbox_cnf;
global $_user;
$res= store_feedback();
if(!is_null($res)){
$this->assertTrue(is_string($res));
}
//var_dump($res);
}
/**
* @desc This function checks if the real filename of the dropbox files doesn't already exist in the temp folder. If this is the case then
* it will generate a different filename;
*/
function testcheck_file_name() {
global $_course;
$file_name_2_check = 'test';
$res= check_file_name($file_name_2_check, $counter=0);
if(!is_null($res)){
$this->assertTrue(is_string($res));
}
//var_dump($res);
}
/**
* @desc this function checks if the key exists. If this is the case it returns the value, if not it returns 0
*/
function testcheck_number_feedback() {
$key = 'test';
$array = array();
$res= check_number_feedback($key, $array);
if(!is_null($res)){
$this->assertTrue(is_numeric($res));
}
//var_dump($res);
}
/**
* @desc generates the contents of a html file that gives an overview of all the files in the zip file.
* This is to know the information of the files that are inside the zip file (who send it, the comment, ...)
*/
function testgenerate_html_overview() {
$files = array();
$res= generate_html_overview($files, $dont_show_columns=array(), $make_link=array());
if(!is_null($res)){
$this->assertTrue(is_string($res));
}
//var_dump($res);
}
/**
* This function downloads all the files of the inputarray into one zip
* @param $array an array containing all the ids of the files that have to be downloaded.
* @todo consider removing the check if the user has received or sent this file (zip download of a folder already sufficiently checks for this).
* @todo integrate some cleanup function that removes zip files that are older than 2 days
*/
/*
function testzip_download() {
global $_course;
global $dropbox_cnf;
global $_user;
global $files;
$array = array();
$res= zip_download($array);
if(!is_string($res)){
$this->assertTrue(is_null($res));
}
//var_dump($res);
}
*/
/**
* Function that finds a given config setting
*/
function testdropbox_cnf() {
$variable = 'test';
$res= dropbox_cnf($variable);
if(!is_null($res)){
$this->assertTrue(is_string($res));
}
//var_dump($res);
}
/**
* This is a callback function to decrypt the files in the zip file to their normal filename (as stored in the database)
* @param $p_event a variable of PCLZip
* @param $p_header a variable of PCLZip
*/
function testmy_pre_add_callback() {
global $files;
$p_event = 'test';
$res= my_pre_add_callback($p_event, &$p_header);
if(!is_null($res)){
$this->assertTrue(is_numeric($res));
}
//var_dump($res);
}
/**
* @desc Cleans the temp zip files that were created when users download several files or a whole folder at once.
* T
* @return true
*/
function testcleanup_temp_dropbox() {
global $_course;
$res= cleanup_temp_dropbox();
if(!is_null($res)){
$this->assertTrue(is_bool($res));
}
//var_dump($res);
}
/**
* This function deletes a dropbox category
* @todo give the user the possibility what needs to be done with the files in this category: move them to the root, download them as a zip, delete them
*/
function testdelete_category() {
global $_user, $is_courseAdmin, $is_courseTutor,$dropbox_cnf;
$id= 1;
$action = 'test';
$res= delete_category($action, $id);
if(!is_null($res)){
$this->assertTrue(is_string($res));
}
//var_dump($res);
}
/**
* Checks if there are files in the dropbox_file table that aren't used anymore in dropbox_person table.
* If there are, all entries concerning the file are deleted from the db + the file is deleted from the server
*/
function testremoveUnusedFiles() {
$res= removeUnusedFiles();
if(!is_null($res)){
$this->assertTrue(is_array($res));
}
//var_dump($res);
}
/**
* @todo check if this function is still necessary.
*/
function testremoveMoreIfMailing() {
$file_id = 1;
$res= removeMoreIfMailing($file_id);
if(!is_null($res)){
$this->assertTrue(is_array($res));
}
//var_dump($res);
}
}
?>

@ -1,389 +0,0 @@
<?php
class TestAnswer extends UnitTestCase {
public $aAnswer;
public function TestAnswer() {
$this->UnitTestCase('');
}
public function setUp() {
/*
//Create a new exercise
require_once api_get_path(SYS_CODE_PATH).'exercice/exercise.class.php';
require_once api_get_path(SYS_CODE_PATH).'inc/lib/pear/HTML/QuickForm.php';
$this->aAnswer = new Answer(2);
$this->aAnswer->read();
$this->aAnswer = new Exercise();
$form = array(
'exerciseTitle'=>'testtitle',
'exerciseDescription'=>'testdescription',
'exerciseAttempts'=>'0',
'exerciseFeedbackType'=>'0',
'exerciseType'=>'1',
'randomQuestions'=>'0',
'randomAnswers'=>'0',
'results_disabled'=>'0',
'enabletimercontroltotalminutes'=>'0');
$res = Exercise::processCreation($form,$type='1');
*/
$this->aAnswer = new Answer(2);
}
public function tearDown() {
$this->aAnswer = null;
}
/**
* constructor of the class
*
* @author Olivier Brouckaert
* @param integer Question ID that answers belong to
*/
/*
function testAnswerConstructor() {
$questionId = 1;
$res = $this->aAnswer->Answer($questionId);
$this->assertTrue(is_null($res));
//var_dump($res);
}
*/
/**
* creates a new answer
*
* @author Olivier Brouckaert
* @param string answer title
* @param integer 0 if bad answer, not 0 if good answer
* @param string answer comment
* @param integer answer weighting
* @param integer answer position
* @param coordinates Coordinates for hotspot exercises (optional)
* @param integer Type for hotspot exercises (optional)
*/
function testcreateAnswer() {
$answer = 'test';
$correct = 1;
$comment ='test';
$weighting = 2;
$position = 1;
$res = $this->aAnswer->createAnswer($answer,$correct,$comment,$weighting,$position,$new_hotspot_coordinates = 1, $new_hotspot_type = 1,$destination='');
$this->assertTrue(is_null($res));
//var_dump($res);
}
/**
* duplicates answers by copying them into another question
* @param - integer $newQuestionId - ID of the new question
*/
function testduplicate() {
$newQuestionId = 1;
$res = $this->aAnswer->duplicate($newQuestionId);
$this->assertTrue(is_null($res));
//var_dump($res);
}
/**
* Returns a list of answers
* @return array List of answers where each answer is an array of (id, answer, comment, grade) and grade=weighting
*/
function testgetAnswersList() {
$res = $this->aAnswer->getAnswersList();
$this->assertTrue(is_array($res));
//var_dump($res);
}
/**
* Returns a list of grades
* @return array List of grades where grade=weighting (?)
*/
function testgetGradesList() {
$res = $this->aAnswer->getGradesList();
$this->assertTrue(is_array($res));
//var_dump($res);
}
/**
* Returns the question type
* @return integer The type of the question this answer is bound to
*/
function testgetQuestionType() {
$res = $this->aAnswer->getQuestionType();
if(!is_null($res)){
$this->assertTrue(is_numeric($res));
}
//var_dump($res);
}
/**
* tells if answer is correct or not
* @param - integer $id - answer ID
* @return - integer - 0 if bad answer, not 0 if good answer
*/
function testisCorrect() {
$id = 1;
$res = $this->aAnswer->isCorrect($id);
if(!is_null($res)){
$this->assertTrue(is_numeric($res));
}
//var_dump($res);
}
/**
* reads answer informations from the data base
*/
function testread() {
$res = $this->aAnswer->read();
$this->assertTrue(is_null($res));
//var_dump($res);
}
/**
* reads answer informations from the data base ordered by parameter
* @param string Field we want to order by
* @param string DESC or ASC
*/
function testreadOrderedBy() {
global $_course;
$field = 'position';
$res = $this->aAnswer->readOrderedBy($field,$order=ASC);
$this->assertTrue(is_null($res));
//var_dump($res);
}
/**
* records answers into the data base
*/
function testsave() {
$res = $this->aAnswer->save();
$this->assertTrue(is_null($res));
//var_dump($res);
}
/**
* returns the answer title
* @param - integer $id - answer ID
* @return - string - answer title
*/
function testselectAnswer() {
$id = 1;
$res = $this->aAnswer->selectAnswer($id);
if(!is_null($res)){
$this->assertTrue(is_string($res));
}
//var_dump($res);
}
/**
* @param - integer $id - answer ID
* @return - bool - answer by id
*/
function testselectAnswerByAutoId() {
$auto_id = 1;
$res = $this->aAnswer->selectAnswerByAutoId($auto_id);
if(!is_null($res)){
$this->assertTrue(is_array($res));
} else {
$this->assertTrue(is_bool($res));
}
//var_dump($res);
}
/**
* returns the answer title from an answer's position
* @param - integer $id - answer ID
* @return - bool - answer title
*/
function testselectAnswerIdByPosition() {
$pos = 1;
$res = $this->aAnswer->selectAnswerIdByPosition($pos);
if(!is_null($res)){
$this->assertTrue(is_bool($res));
}
//var_dump($res);
}
/**
* returns the autoincrement id identificator
* @return - integer - answer num
*/
function testselectAutoId() {
$id = 1;
$res = $this->aAnswer->selectAutoId($id);
if(!is_null($res)){
$this->assertTrue(is_numeric($res));
}
//var_dump($res);
}
/**
* returns answer comment
* @param - integer $id - answer ID
* @return - string - answer comment
*/
function testselectComment() {
$id = 1;
$res = $this->aAnswer->selectComment($id);
if(!is_null($res)){
$this->assertTrue(is_string($res));
}
//var_dump($res);
}
/**
* returns the question ID of the destination question
* @return - integer - the question ID
*/
function testselectDestination() {
$id = 1;
$res = $this->aAnswer->selectDestination($id);
if(!is_null($res)){
$this->assertTrue(is_string($res));
}
//var_dump($res);
}
/**
* returns answer hotspot coordinates
* @param integer Answer ID
* @return integer Answer position
*/
function testselectHotspotCoordinates() {
$id = 1;
$res = $this->aAnswer->selectHotspotCoordinates($id);
if(!is_null($res)){
$this->assertTrue(is_string($res));
}
}
/**
* returns answer hotspot type
*
* @author Toon Keppens
* @param integer Answer ID
* @return integer Answer position
*/
function testselectHotspotType() {
$id = 1;
$res = $this->aAnswer->selectHotspotType($id);
if(!is_null($res)){
$this->assertTrue(is_string($res));
}
}
/**
* returns the number of answers in this question
*
* @author - Olivier Brouckaert
* @return - integer - number of answers
*/
function testselectNbrAnswers() {
$res = $this->aAnswer->selectNbrAnswers();
if(!is_null($res)){
$this->assertTrue(is_numeric($res));
}
}
/**
* returns answer position
*
* @author - Olivier Brouckaert
* @param - integer $id - answer ID
* @return - integer - answer position
*/
function testselectPosition() {
$id = 1;
$res = $this->aAnswer->selectPosition($id);
if(!is_null($res)){
$this->assertTrue(is_numeric($res));
}
}
/**
* returns the question ID which the answers belong to
*
* @author - Olivier Brouckaert
* @return - integer - the question ID
*/
function testselectQuestionId() {
$res = $this->aAnswer->selectQuestionId();
if(!is_null($res)){
$this->assertTrue(is_numeric($res));
}
}
/**
* returns answer weighting
*
* @author - Olivier Brouckaert
* @param - integer $id - answer ID
* @return - integer - answer weighting
*/
function testselectWeighting() {
$id = 1;
$res = $this->aAnswer->selectWeighting($id);
if(!is_null($res)){
$this->assertTrue(is_numeric($res));
}
}
/**
* updates an answer
*
* @author Toon Keppens
* @param string Answer title
* @param string Answer comment
* @param integer Answer weighting
* @param integer Answer position
*/
function testupdateAnswers() {
$answer = '';
$comment = '';
$weighting=2;
$position=1;
$destination='0@@0@@0@@0';
$res = $this->aAnswer->updateAnswers($answer,$comment,$weighting,$position,$destination);
if(!is_null($res)){
$this->assertTrue(is_numeric($res));
}
}
/**
* clears $new_* arrays
*/
function testcancel() {
$res = $this->aAnswer->cancel();
$this->assertTrue(is_null($res));
//var_dump($res);
}
}
?>

@ -1,539 +0,0 @@
<?php
class TestExercise extends UnitTestCase {
public $eExercise;
public function TestExercise() {
$this->UnitTestCase('');
}
public function setUp() {
$this->eExercise = new Exercise();
}
public function tearDown() {
$this->eExercise = null;
}
/**
* adds a question into the question list
* @param - integer $questionId - question ID
* @return - boolean - true if the question has been added, otherwise false
*/
function testaddToList() {
$questionId = 1;
$res = $this->eExercise->addToList($questionId);
$this->assertTrue(is_bool($res));
//var_dump($res);
}
/**
* Creates the form to create / edit an exercise
* @param FormValidator $form the formvalidator instance (by reference)
*/
function testcreateForm() {
global $id;
$form = new FormValidator('introduction_text');
$res = $this->eExercise->createForm($form, $type='full');
$this->assertTrue(is_null($res));
//var_dump($res);
}
/**
* disables the exercise
*/
function testdisable() {
$res = $this->eExercise->disable();
$this->assertTrue(is_null($res));
//var_dump($res);
}
function testdisable_results() {
$res = $this->eExercise->disable_results();
$this->assertTrue(is_null($res));
//var_dump($res);
}
/**
* enables the exercise
*/
function testenable() {
$res = $this->eExercise->enable();
$this->assertTrue(is_null($res));
//var_dump($res);
}
function testenable_results() {
$res = $this->eExercise->enable_results();
$this->assertTrue(is_null($res));
//var_dump($res);
}
/**
* Same as isRandom() but has a name applied to values different than 0 or 1
*/
function testgetShuffle() {
$res = $this->eExercise->getShuffle();
$this->assertTrue(is_numeric($res));
//var_dump($res);
}
/**
* returns 'true' if the question ID is in the question list
*
* @author - Olivier Brouckaert
* @param - integer $questionId - question ID
* @return - boolean - true if in the list, otherwise false
*/
function testisInList() {
$questionId = 1;
$res = $this->eExercise->isInList($questionId);
$this->assertTrue(is_bool($res));
//var_dump($res);
}
/**
* tells if questions are selected randomly, and if so returns the draws
*
* @author - Olivier Brouckaert
* @return - integer - 0 if not random, otherwise the draws
*/
function testisRandom() {
$res = $this->eExercise->isRandom();
$this->assertTrue(is_bool($res));
//var_dump($res);
}
/**
* moves a question down in the list
* @param - integer $id - question ID to move down
*/
function testmoveDown() {
$id=1;
$res = $this->eExercise->moveDown($id);
if(!is_null($res)){
$this->assertTrue(is_numeric($res));
}
//var_dump($res);
}
/**
* moves a question up in the list
* @param - integer $id - question ID to move up
*/
function testmoveUp() {
$id=1;
$res = $this->eExercise->moveUp($id);
if(!is_null($res)){
$this->assertTrue(is_numeric($res));
}
//var_dump($res);
}
/**
* function which process the creation of exercises
* @param FormValidator $form the formvalidator instance
*/
/*
function testprocessCreation() {
$form = new FormValidator('exerciseTitle');
$res = $this->eExercise->processCreation($form,$type='');
if(!is_null($res)){
$this->assertTrue(is_numeric($res));
}
//var_dump($res);
}*/
/**
* reads exercise informations from the data base
* @param - integer $id - exercise ID
* @return - boolean - true if exercise exists, otherwise false
*/
function testread() {
global $_course;
global $_configuration;
global $questionList;
$id=1;
$res = $this->eExercise->read($id);
if(!is_null($res)){
$this->assertTrue(is_bool($res));
}
//var_dump($res);
}
/**
* removes a question from the question list
* @param - integer $questionId - question ID
* @return - boolean - true if the question has been removed, otherwise false
*/
function testremoveFromList() {
global $_course;
global $_configuration;
global $questionList;
$questionId=1;
$res = $this->eExercise-> removeFromList($questionId);
if(!is_null($res)){
$this->assertTrue(is_bool($res));
}
//var_dump($res);
}
/**
* updates the exercise in the data base
*/
function testsave() {
global $_course,$_user;
$res = $this->eExercise-> save($type_e='');
$this->assertTrue(is_null($res));
//var_dump($res);
}
function testsearch_engine_delete() {
$res = $this->eExercise-> search_engine_delete();
$this->assertTrue(is_null($res));
//var_dump($res);
}
function testsearch_engine_save() {
$res = $this->eExercise-> search_engine_save();
$this->assertTrue(is_null($res));
//var_dump($res);
}
/**
* returns the number of attempts setted
* @return - numeric - exercise attempts
*/
function testselectAttempts() {
$res = $this->eExercise-> selectAttempts();
$this->assertTrue(is_null($res));
//var_dump($res);
}
/**
* returns the exercise description
* @return - string - exercise description
*/
function testselectDescription() {
$res = $this->eExercise-> selectDescription();
$this->assertTrue(is_string($res));
//var_dump($res);
}
/**
* returns the expired time
* @return - string - expired time
*/
function testselectExpiredTime() {
$res = $this->eExercise-> selectExpiredTime();
$this->assertTrue(is_string($res));
//var_dump($res);
}
/** returns the number of FeedbackType *
* 0=>Feedback , 1=>DirectFeedback, 2=>NoFeedback
* @return - numeric - exercise attempts
*/
function testselectFeedbackType() {
$res = $this->eExercise-> selectFeedbackType();
$this->assertTrue(is_null($res));
//var_dump($res);
}
/**
* returns the exercise ID
* @return - integer - exercise ID
*/
function testselectId() {
$res = $this->eExercise-> selectId();
$this->assertTrue(is_numeric($res));
//var_dump($res);
}
/**
* returns the number of questions in this exercise
* @return - integer - number of questions
*/
function testselectNbrQuestions() {
$res = $this->eExercise-> selectNbrQuestions();
$this->assertTrue(is_numeric($res));
//var_dump($res);
}
/**
* returns the array with the question ID list
* @return - array - question ID list
*/
function testselectQuestionList() {
$res = $this->eExercise-> selectQuestionList();
$this->assertTrue(is_array($res));
//var_dump($res);
}
/**
* returns random answers status.
*/
function testselectRandomAnswers() {
$res = $this->eExercise-> selectRandomAnswers();
$this->assertTrue(is_numeric($res));
//var_dump($res);
}
/**
* selects questions randomly in the question list
*
* @author - Olivier Brouckaert
* @return - array - if the exercise is not set to take questions randomly, returns the question list
* without randomizing, otherwise, returns the list with questions selected randomly
*/
function testselectRandomList() {
$res = $this->eExercise-> selectRandomList();
$this->assertTrue(is_array($res));
//var_dump($res);
}
/**
* tells if questions are selected randomly, and if so returns the draws
* @return - integer - results disabled exercise
*/
function testselectResultsDisabled() {
$res = $this->eExercise-> selectResultsDisabled();
$this->assertTrue(is_numeric($res));
//var_dump($res);
}
/**
* returns the exercise sound file
* @return - string - exercise description
*/
function testselectSound() {
$res = $this->eExercise-> selectSound();
$this->assertTrue(is_string($res));
//var_dump($res);
}
/**
* returns the exercise status (1 = enabled ; 0 = disabled)
* @return - int - true if enabled, otherwise false
*/
function testselectStatus() {
$res = $this->eExercise-> selectStatus();
$this->assertTrue(is_numeric($res));
//var_dump($res);
}
/**
* returns the time limit
* @return int
*/
function testselectTimeLimit() {
$res = $this->eExercise-> selectTimeLimit();
$this->assertTrue(is_numeric($res));
//var_dump($res);
}
/**
* returns the exercise title
* @return - string - exercise title
*/
function testselectTitle() {
$res = $this->eExercise-> selectTitle();
$this->assertTrue(is_string($res));
//var_dump($res);
}
/**
* returns the exercise type
* @return - integer - exercise type
*/
function testselectType() {
$res = $this->eExercise-> selectType();
$this->assertTrue(is_numeric($res));
//var_dump($res);
}
/**
* sets to 0 if questions are not selected randomly
* if questions are selected randomly, sets the draws
* @param - integer $random - 0 if not random, otherwise the draws
* @return void
*/
function testsetRandom() {
$random = 1;
$res = $this->eExercise-> setRandom($random);
$this->assertTrue(is_null($res));
//var_dump($res);
}
/**
* update the table question
* @return void
*/
function testupdate_question_positions() {
$res = $this->eExercise-> update_question_positions();
$this->assertTrue(is_null($res));
//var_dump($res);
}
/**
* changes the exercise max attempts
* @param - numeric $attempts - exercise max attempts
* @return void
*/
function testupdateAttempts() {
$attempts = 1;
$res = $this->eExercise-> updateAttempts($attempts);
$this->assertTrue(is_null($res));
//var_dump($res);
}
/**
* changes the exercise description
* @param - string $description - exercise description
* @return void
*/
function testupdateDescription() {
$description = 'testdescription';
$res = $this->eExercise-> updateDescription($description);
$this->assertTrue(is_null($res));
//var_dump($res);
}
/**
* changes the exercise expired_time
* @param - int The expired time of the quiz
* @return void
*/
function testupdateExpiredTime() {
$expired_time = 1;
$res = $this->eExercise-> updateExpiredTime($expired_time);
$this->assertTrue(is_null($res));
//var_dump($res);
}
/**
* changes the exercise feedback type
* @param - numeric $attempts - exercise max attempts
* @return void
*/
function testupdateFeedbackType() {
$feedback_type = 1;
$res = $this->eExercise-> updateFeedbackType($feedback_type);
$this->assertTrue(is_null($res));
//var_dump($res);
}
/**
* sets to 0 if answers are not selected randomly
* if answers are selected randomly
* @param - integer $random_answers - random answers
* @return void
*/
function testupdateRandomAnswers() {
$random_answers = 0;
$res = $this->eExercise-> updateRandomAnswers($random_answers);
$this->assertTrue(is_null($res));
//var_dump($res);
}
/**
* update the results
* @return void
*/
function testupdateResultsDisabled() {
$results_disabled = 1;
$res = $this->eExercise->updateResultsDisabled($results_disabled);
$this->assertTrue(is_null($res));
//var_dump($res);
}
/**
* changes the exercise sound file
* @param - string $sound - exercise sound file
* @param - string $delete - ask to delete the file
* @return void
*/
function testupdateSound() {
global $audioPath, $documentPath,$_course, $_user;
$sound = 'test';
$delete = 'test';
$res = $this->eExercise->updateSound($sound,$delete);
$this->assertTrue(is_null($res));
//var_dump($res);
}
/**
* changes the exercise title
* @param - string $title - exercise title
* @return void
*/
function testupdateTitle() {
$title = 'test';
$res = $this->eExercise->updateTitle($title);
$this->assertTrue(is_null($res));
//var_dump($res);
}
/**
* changes the exercise type
* @param - integer $type - exercise type
*/
function testupdateType() {
$type = 1;
$res = $this->eExercise->updateType($type);
$this->assertTrue(is_null($res));
//var_dump($res);
}
/**
* deletes the exercise from the database
* Notice : leaves the question in the data base
*/
function testdelete() {
global $_course,$_user;
$res = $this->eExercise->delete();
$this->assertTrue(is_null($res));
//var_dump($res);
}
}
?>

@ -1,42 +0,0 @@
<?php
require_once api_get_path(SYS_CODE_PATH).'exercice/question.class.php';
class TestExerciseLib extends UnitTestCase {
/*public $eQuestion;
public function TestExerciseLib() {
$this->UnitTestCase('');
}
public function setUp() {
$this->eQuestion = new Question();
}
public function tearDown() {
$this->eQuestion = null;
}*/
/**
* @param int question id
* @param boolean only answers
* @param boolean origin i.e = learnpath
* @param int current item from the list of questions
* @param int number of total questions
*/
function testshowQuestion() {
global $_course;
$questionId = 1;
$current_item = 1 ;
$total_item = 1;
//$objQuestionTmp = $question->read($questionId);
$res = ExerciseLib::showQuestion($questionId, $onlyAnswers=false, $origin=false,$current_item, $total_item);
$this->assertTrue(is_null($res));
var_dump($res);
}
}
?>

@ -1,83 +0,0 @@
<?php
class TestExerciseResult extends UnitTestCase
{
public $eExerciseResult;
public function TestExerciseResult() {
$this->UnitTestCase('');
}
public function setUp() {
$this->eExerciseResult = new ExerciseResult();
}
public function tearDown() {
$this->eExerciseResult = null;
}
/**
* Gets the results of all students (or just one student if access is limited)
* @param string The document path (for HotPotatoes retrieval)
* @param integer User ID. Optional. If no user ID is provided, we take all the results. Defauts to null
*/
function test_getExercisesReporting() {
global $user_id;
$document_path = api_get_path(SYS_COURSE_PATH).'document/';
$res = $this->eExerciseResult->_getExercisesReporting($document_path,$user_id,$filter=0);
if(!is_null($res)) {
$this->assertTrue(is_bool($res));
}
//var_dump($res);
}
/**
* Exports the complete report as a CSV file
* @param string Document path inside the document tool
* @param integer Optional user ID
* @param boolean Whether to include user fields or not
* @return boolean False on error
*/
function testexportCompleteReportCSV() {
global $user_id;
$document_path = api_get_path(SYS_COURSE_PATH).'document/';
if(!headers_sent()){
$res = $this->eExerciseResult->exportCompleteReportCSV($document_path,$user_id, $export_user_fields = array(), $export_filter = 0);
}
if(!is_null($res)) {
$this->assertTrue(is_bool($res));
}
//var_dump($res);
}
/**
* Exports the complete report as an XLS file
* @return boolean False on error
*/
function testexportCompleteReportXLS() {
global $user_id;
$document_path = api_get_path(SYS_COURSE_PATH).'document/';
if(!headers_sent()){
$res = $this->eExerciseResult->exportCompleteReportXLS($document_path='',$user_id, $export_user_fields=array(), $export_filter = 0);
}
if(!is_null($res)) {
$this->assertTrue(is_bool($res));
}
//var_dump($res);
}
}
?>

@ -1,100 +0,0 @@
<?php
//Is possible than this functions still are not implemented int he Chamilo systems or some are deprecated
class TestExerciseImport extends UnitTestCase {
function testelementData() {
global $element_pile;
$element_pile = array();
$parser= array();
$data = array();
$res = elementData($parser,$data);
$this->assertFalse(is_array($res));
if(!is_null){
$this->assertTrue($res);
}
//var_dump($res);
}
function testendElement() {
global $element_pile;
$element_pile = array();
$parser= array();
$data = array();
$res = endElement($parser,$data);
$this->assertFalse(is_array($res));
if(!is_null){
$this->assertTrue($res);
}
//var_dump($res);
}
/**
* possible deprecated
* @return the path of the temporary directory where the exercise was uploaded and unzipped
*/
/*function testgetandunzipuploadedexercise() {
include_once (realpath(dirname(__FILE__) . '/../../inc/lib/pclzip/') . '/pclzip.lib.php');
$res = get_and_unzip_uploaded_exercise();
$this->assertFalse(is_array($res));
if(!is_null){
$this->assertTrue($res);
}
//var_dump($res);
} */
/**
* main function to import an exercise,
* Possible deprecated
* @return an array as a backlog of what was really imported, and error or debug messages to display
*/
/*function testimport_exercise() {
$file = '';
$res = import_exercise($file);
$this->assertFalse(is_array($res));
if(!is_null){
$this->assertTrue($res);
}
var_dump($res);
}*/
function testparse_file() {
$file = '';
$exercisePath = '';
$questionFile = '';
$res = parse_file($exercisePath, $file, $questionFile);
$this->assertTrue(is_array($res));
if(!is_null){
$this->assertTrue($res);
}
//var_dump($res);
}
function teststartElement() {
$parser = 'test';
$name = 'test';
$attributes = array();
$res = startElement($parser, $name, $attributes);
$this->assertFalse(is_array($res));
if(!is_null){
$this->assertTrue($res);
}
//var_dump($res);
}
function testtempdir() {
$dir = '/tmp';
$res = tempdir($dir, $prefix='tmp', $mode=0777);
$this->assertFalse(is_array($res));
if(!is_null){
$this->assertTrue(is_string($res));
}
//var_dump($res);
}
}
?>

@ -1,189 +0,0 @@
<?php
require_once(api_get_path(SYS_CODE_PATH).'/exercice/answer.class.php');
require_once(api_get_path(SYS_CODE_PATH).'/exercice/question.class.php');
require_once(api_get_path(SYS_CODE_PATH).'/exercice/exercise.class.php');
require_once(api_get_path(SYS_CODE_PATH).'/exercice/hotspot.class.php');
require_once(api_get_path(SYS_CODE_PATH).'/exercice/unique_answer.class.php');
require_once(api_get_path(SYS_CODE_PATH).'/exercice/multiple_answer.class.php');
require_once(api_get_path(SYS_CODE_PATH).'/exercice/matching.class.php');
require_once(api_get_path(SYS_CODE_PATH).'/exercice/freeanswer.class.php');
require_once(api_get_path(SYS_CODE_PATH).'/exercice/fill_blanks.class.php');
class TestQti2 extends UnitTestCase {
public $qIms2Question;
public $qImsAnswerFillInBlanks;
public $qImsAnswerFree;
public $qImsAnswerHotspot;
public $qImsAnswerMatching;
public $qImsAnswerMultipleChoice;
public function __construct() {
$this->UnitTestCase('QTI2 library - main/exercice/export/qti2/qti2_classes.test.php');
}
public function setUp() {
$this->qIms2Question = new Ims2Question();
$this->qImsAnswerFillInBlanks = new ImsAnswerFillInBlanks(1);
$this->qImsAnswerFree = new ImsAnswerFree(1);
$this->qImsAnswerHotspot = new ImsAnswerHotspot(1);
$this->qImsAnswerMatching = new ImsAnswerMatching(1);
$this->qImsAnswerMultipleChoice = new ImsAnswerMultipleChoice(1);
}
public function tearDown() {
$this-> qIms2Question = null;
$this-> qImsAnswerFillInBlanks = null;
$this-> qImsAnswerFree = null;
$this-> qImsAnswerHotspot = null;
$this-> qImsAnswerMatching = null;
$this-> qImsAnswerMultipleChoice = null;
}
//Class qIms2Question
/**
* Include the correct answer class and create answer
*/
function testsetAnswer() {
$res=Ims2Question::setAnswer();
if(!is_null){
$this->assertTrue(is_bool($res));
}
//var_dump($res);
}
function testcreateAnswersForm() {
$form = array(1);
$res=Ims2Question::createAnswersForm($form);
$this->assertTrue(is_bool($res));
//var_dump($res);
}
function testprocessAnswersCreation() {
$form = array(1);
$res=Ims2Question::processAnswersCreation($form);
$this->assertTrue(is_bool($res));
//var_dump($res);
}
//Class qImsAnswerFillInBlanks
/**
* Export the text with missing words.
*
*
*/
function testimsExportResponses() {
$questionIdent = array(1);
$questionStatment = array(1);
$res=$this->qImsAnswerFillInBlanks->imsExportResponses($questionIdent, $questionStatment);
if(!is_null){
$this->assertTrue(is_bool($res));
}
//var_dump($res);
}
function testimsExportResponsesDeclaration() {
$questionIdent = array(1);
$res=$this->qImsAnswerFillInBlanks->imsExportResponsesDeclaration($questionIdent);
if(!is_null){
$this->assertTrue(is_bool($res));
}
//var_dump($res);
}
//Class qImsAnswerFree
/**
* TODO implement
* Export the question part as a matrix-choice, with only one possible answer per line.
*/
function testImsExportResponsesqImsAnswerFree() {
$questionIdent = array('');
$questionStatment = array('');
$res=$this->qImsAnswerFree->imsExportResponses($questionIdent, $questionStatment, $questionDesc='', $questionMedia='');
$this->assertTrue(is_string($res));
//var_dump($res);
}
function testImsExportResponsesDeclarationqImsAnswerFree() {
$questionIdent = array(1);
$res=$this->qImsAnswerFree->imsExportResponsesDeclaration($questionIdent);
$this->assertTrue(is_string($res));
//var_dump($res);
}
//Class qImsAnswerHotspot
/**
* TODO update this to match hotspots instead of copying matching
* Export the question part as a matrix-choice, with only one possible answer per line.
*/
function testimsExportResponsesqImsAnswerHotspot() {
$questionIdent = array(1);
$questionStatment = array(1);
$res=$this->qImsAnswerHotspot->imsExportResponses($questionIdent, $questionStatment, $questionDesc='', $questionMedia='');
$this->assertTrue(is_string($res));
//var_dump($res);
}
function testimsExportResponsesDeclarationqImsAnswerHotspot() {
$questionIdent = array(1);
$res=$this->qImsAnswerHotspot->imsExportResponsesDeclaration($questionIdent);
$this->assertTrue(is_string($res));
//var_dump($res);
}
//Class qImsAnswerMatching
/**
* Export the question part as a matrix-choice, with only one possible answer per line.
*/
function testimsExportResponsesqImsAnswerMatching() {
$questionIdent = array(1);
$questionStatment = array(1);
$res=$this->qImsAnswerMatching->imsExportResponses($questionIdent, $questionStatment, $questionDesc='', $questionMedia='');
$this->assertTrue(is_string($res));
//var_dump($res);
}
function testimsExportResponsesDeclarationqImsAnswerMatching() {
$questionIdent = array(1);
$res=$this->qImsAnswerMatching->imsExportResponsesDeclaration($questionIdent);
$this->assertTrue(is_string($res));
//var_dump($res);
}
//Class qImsAnswerMultipleChoice
/**
* Return the XML flow for the possible answers.
*
*/
function testimsExportResponsesqImsAnswerMultipleChoice() {
$questionIdent = array(1);
$questionStatment = array(1);
$res=$this->qImsAnswerMultipleChoice->imsExportResponses($questionIdent, $questionStatment, $questionDesc='', $questionMedia='');
$this->assertTrue(is_string($res));
//var_dump($res);
}
function testimsExportResponsesDeclarationqImsAnswerMultipleChoice() {
$questionIdent = array(1);
$res=$this->qImsAnswerMultipleChoice->imsExportResponsesDeclaration($questionIdent);
$this->assertTrue(is_string($res));
//var_dump($res);
}
}
?>

@ -1,86 +0,0 @@
<?php
//Is possible than this functions are not implemented or some are deprecated, this file will not
//available for the test suite.
class TestQti2Export extends UnitTestCase {
public $qImsAssessmentItem;
public $qImsItem;
public $qImsSection;
public function TestQti2Export() {
$this->UnitTestCase('');
}
public function setUp() {
//$objQuestion = Question::read(1);
$objQuestion = Question::read(1);
$question = new Ims2Question();
/*
$qst = $question->read(1);
if( !$qst or $qst->type == FREE_ANSWER)
{
return '';
}
$question->id = $qst->id;
$question->type = $qst->type;
$question->question = $qst->question;
$question->description = $qst->description;
$question->weighting=$qst->weighting;
$question->position=$qst->position;
$question->picture=$qst->picture;
*/
$this->qImsAssessmentItem = new ImsAssessmentItem($question);
//$this->qImsItem = new ImsItem(1);
//$this->qImsSection = new ImsSection(1);
}
public function tearDown() {
$this-> qImsAssessmentItem = null;
$this-> qImsItem = null;
$this-> qImsSection = null;
}
//Class ImsAssessmentItem
/**
* Constructor.
* @param $question The Question object we want to export.
*/
/*
function testImsAssessmentItem() {
$question = array();
$res = $this->qImsAssessmentItem->ImsAssessmentItem($question);
if(!is_null){
$this->assertTrue(is_bool($res));
}
var_dump($res);
}
*/
function teststart_item() {
/*
$res = $this->qImsAssessmentItem->start_item();
if(!is_null){
$this->assertTrue(is_bool($res));
}
var_dump($res);
*/
}
}
?>

@ -1,219 +0,0 @@
<?php
require_once(api_get_path(SYS_CODE_PATH).'exercice/question.class.php');
require_once(api_get_path(SYS_CODE_PATH).'exercice/exercise.class.php');
require_once(api_get_path(SYS_CODE_PATH).'exercice/unique_answer.class.php');
require_once(api_get_path(SYS_CODE_PATH).'exercice/multiple_answer.class.php');
require_once(api_get_path(SYS_CODE_PATH).'exercice/multiple_answer_combination.class.php');
require_once(api_get_path(SYS_CODE_PATH).'exercice/fill_blanks.class.php');
require_once(api_get_path(SYS_CODE_PATH).'exercice/freeanswer.class.php');
require_once(api_get_path(SYS_CODE_PATH).'exercice/hotspot.class.php');
require_once(api_get_path(SYS_CODE_PATH).'exercice/matching.class.php');
require_once(api_get_path(SYS_CODE_PATH).'exercice/hotspot.class.php');
class TestScormClasses extends UnitTestCase {
public $sScormAnswerFillInBlanks;
public $sScormAnswerFree;
public $sScormAnswerHotspot;
public $sScormAnswerMatching;
public $sScormAnswerMultipleChoice;
public $sScormAnswerTrueFalse;
public $sScormQuestion;
public function __construct() {
$this->UnitTestCase('SCORM exercises export library - main/exercice/export/scorm/scorm_classes.test.php');
}
public function setUp() {
$this->sScormAnswerFillInBlanks = new ScormAnswerFillInBlanks(1);
$this->sScormAnswerFree = new ScormAnswerFree(1);
$this->sScormAnswerHotspot = new ScormAnswerHotspot(1);
$this->sScormAnswerMatching = new ScormAnswerMatching(1);
$this->sScormAnswerMultipleChoice = new ScormAnswerMultipleChoice(1);
$this->sScormAnswerTrueFalse = new ScormAnswerTrueFalse(1);
$this->sScormQuestion = new ScormQuestion(1);
}
public function tearDown() {
$this-> sScormAnswerFillInBlanks = null;
$this-> sScormAnswerFree = null;
$this-> sScormAnswerHotspot = null;
$this-> sScormAnswerMatching = null;
$this-> sScormAnswerMultipleChoice = null;
$this-> sScormAnswerTrueFalse = null;
$this-> sScormQuestion = null;
}
//Class sScormAnswerFillInBlanks
/**
* Export the text with missing words.
*
* As a side effect, it stores two lists in the class :
* the missing words and their respective weightings.
*/
function testexport() {
$res= $this->sScormAnswerFillInBlanks->export();
if(!is_null($res)){
$this->assertTrue(is_array($res));
}
//var_dump($res);
}
//Class sScormAnswerFree
/**
* Export the text with missing words.
*
* As a side effect, it stores two lists in the class :
* the missing words and their respective weightings.
*
*/
function testexportsScormAnswerFree() {
$res= $this->sScormAnswerFree->export();
if(!is_null($res)){
$this->assertTrue(is_array($res));
}
//var_dump($res);
}
//Class sScormAnswerHotspot
/**
* Returns the javascript code that goes with HotSpot exercises
* @return string The JavaScript code
*/
function testexportsScormAnswerHotspot() {
$res= $this->sScormAnswerHotspot->export();
if(!is_null($res)){
$this->assertTrue(is_array($res));
}
//var_dump($res);
}
function testgetjsheadersScormAnswerHotspot() {
$res= $this->sScormAnswerHotspot->get_js_header();
if(!is_null($res)){
$this->assertTrue(is_string($res));
}
//var_dump($res);
}
//Class sScormAnswerMatching
/**
* Export the question part as a matrix-choice, with only one possible answer per line.
* @author Amand Tihon <amand@alrj.org>
*/
function testexportsScormAnswerMatching() {
$res= $this->sScormAnswerMatching->export();
if(!is_null($res)){
$this->assertTrue(is_array($res));
}
//var_dump($res);
}
//Class sScormAnswerMultipleChoice
/**
* Return HTML code for possible answers
*/
function testexportsScormAnswerMultipleChoice() {
$res= $this->sScormAnswerMultipleChoice->export();
if(!is_null($res)){
$this->assertTrue(is_array($res));
}
//var_dump($res);
}
//Class sScormAnswerTrueFalse
/**
* Return the XML flow for the possible answers.
* That's one <response_lid>, containing several <flow_label>
*/
function testexportsScormAnswerTrueFalse() {
$res= $this->sScormAnswerTrueFalse->export();
if(!is_null($res)){
$this->assertTrue(is_array($res));
}
//var_dump($res);
}
//Class sScormQuestion
function testcreateAnswersFormsScormQuestion() {
$form = '';
$res= $this->sScormQuestion->createAnswersForm($form);
if(!is_null($res)){
$this->assertTrue(is_bool($res));
}
//var_dump($res);
}
/**
* Return the XML flow for the possible answers.
* That's one <response_lid>, containing several <flow_label>
*/
/*function testexportsScormQuestion() {
$res= $this->sScormQuestion->export();
if(!is_null($res)){
$this->assertTrue(is_array($res));
}
//var_dump($res);
}*/
/**
* Returns an HTML-formatted question
*/
/*
function testgetQuestionHTMLsScormQuestion() {
$res= $this->sScormQuestion->getQuestionHTML();
if(!is_null($res)){
$this->assertTrue(is_array($res));
}
//var_dump($res);
}*/
/**
* Return the JavaScript code bound to the question
*/
/*
function testgetQuestionJSsScormQuestion() {
$res= ScormQuestion::getQuestionJS();
if(!is_null($res)){
$this->assertTrue(is_array($res));
}
//var_dump($res);
}*/
function testprocessAnswersCreationJSsScormQuestion() {
$form = '';
$res= $this->sScormQuestion->processAnswersCreation($form);
if(!is_null($res)){
$this->assertTrue(is_bool($res));
}
//var_dump($res);
}
/**
* Include the correct answer class and create answer
*/
function testsetAnswersCreationJSsScormQuestion() {
$res= $this->sScormQuestion->setAnswer();
if(!is_null($res)){
$this->assertTrue(is_bool($res));
}
//var_dump($res);
}
}
?>

@ -1,45 +0,0 @@
<?php
class TestFillBlanksClass extends UnitTestCase {
public $fFillBlanks;
public function TestFillBlanksClass() {
$this->UnitTestCase('');
}
public function setUp() {
$this->fFillBlanks = new FillBlanks();
}
public function tearDown() {
$this->fFillBlanks = null;
}
/**
* function which redifines Question::createAnswersForm
* @param the formvalidator instance
*/
/*
function testcreateAnswersForm() {
$form = new FormValidator('introduction_text');
$res = $this->fFillBlanks->createAnswersForm($form);
$this->assertTrue(is_null($res));
var_dump($res);
}*/
/**
* abstract function which creates the form to create / edit the answers of the question
* @param the formvalidator instance
*/
/*
function testprocessAnswersCreation() {
global $charset;
$form = new FormValidator('introduction_text');
$res = $this->fFillBlanks->processAnswersCreation($form);
$this->assertTrue(is_null($res));
var_dump($res);
}*/
}
?>

@ -1,29 +0,0 @@
<?php
class TestFreeanswer extends UnitTestCase {
/**
* function which redifines Question::createAnswersForm
* @param the formvalidator instance
*/
function testcreateAnswersForm () {
$form = new FormValidator('exercise_admin', 'post', api_get_self().'?exerciseId='.$_GET['exerciseId']);
$res =FreeAnswer::createAnswersForm($form);
$this->assertTrue(is_null($res));
//var_dump($res);
}
/**
* abstract function which creates the form to create / edit the answers of the question
* @param the formvalidator instance
*/
function testprocessAnswersCreation () {
$form = new FormValidator('exercise_admin', 'post', api_get_self().'?exerciseId='.$_GET['exerciseId']);
$res =FreeAnswer::processAnswersCreation($form);
$this->assertTrue(is_null($res));
//var_dump($res);
}
}
?>

@ -1,178 +0,0 @@
<?php
require_once(api_get_path(SYS_CODE_PATH).'exercice/hotpotatoes.lib.php');
class TestHotpotatoes extends UnitTestCase {
public function __construct() {
$this->UnitTestCase('Hotpotatoes exercises library - main/exercice/hotpotatoes.lib.test.php');
}
function testCheckImageName() {
$imgparams=array();
$string='';
$checked = myarraysearch($imgparams,$string);
$res=CheckImageName(&$imgparams,$string);
$this->assertTrue(is_bool($res));
$this->assertTrue(is_bool($checked));
//var_dump($res);
}
function testCheckSubFolder() {
$path='Location: /main/exercice/';
$res=CheckSubFolder($path);
$this->assertTrue(is_numeric($res));
//var_dump($res);
}
function testFillFolderName() {
$name='testnameofthefolder';
$nsize=12;
$res=FillFolderName($name,$nsize);
$this->assertTrue(is_string($res));
//var_dump($res);
}
function testGenerateHiddenList() {
$imgparams=array('test');
$res=GenerateHiddenList($imgparams);
$this->assertTrue(is_string($res));
//var_dump($res);
}
function testGenerateHpFolder() {
$folder='main/exercice/hotpotatoes.lib.php';
$res=GenerateHpFolder($folder);
$this->assertTrue(is_string($res));
//var_dump($res);
}
function testGetComment() {
$course_code = 'COURSETEST';
$path = 'exercice_submit.php';
$query ="select comment from $dbTable where path='$path'";
$res=GetComment($path,$course_code);
$this->assertTrue(is_string($res));
//var_dump($res);
}
/* Deprecated
function testGetFileName() {
$fname='main/exercice/hotpotatoes.lib.php';
$res=GetFileName($fname);
$this->assertTrue(is_string($res));
//var_dump($res);
}*/
function testGetFolderName() {
$fname='main/exercice/hotpotatoes.lib.php';
$res=GetFolderName($fname);
$this->assertTrue(is_string($res));
//var_dump($res);
}
function testGetFolderPath() {
$fname='main/exercice/hotpotatoes.lib.php';
$res=GetFolderPath($fname);
$this->assertTrue(is_string($res));
//var_dump($res);
}
function testGetImgName() {
$imgtag='<img src="example.jpg">';
$res=GetImgName($imgtag);
$this->assertTrue(is_string($res));
//var_dump($res);
}
function testGetImgParams() {
$fname='/main/css/academica/images/bg.jpg';
$fpath='main/css/academica/images/';
$imgparams= array();
$imgcount='';
$res=GetImgParams($fname,$fpath,&$imgparams,&$imgcount);
$this->assertTrue(is_null($res));
//var_dump($res);
}
function testGetQuizName() {
$course_code = 'COURSETEST';
$fname='exercice_submit.php';
$fpath='main/exercice/exercice_submit.php';
$res=GetQuizName($fname,$fpath);
$this->assertTrue(is_string($res));
//var_dump($res);
}
function testGetSrcName() {
$imgtag='src="test.jpg""';
$res=GetSrcName($imgtag);
if(!is_string($res))$this->assertTrue(is_bool($res));
//var_dump($res);
}
function testhotpotatoes_init() {
$base = api_get_path(SYS_CODE_PATH);
$baseWorkDir=$base.'exercice/';
$res=hotpotatoes_init($baseWorkDir);
$this->assertFalse($res);
//var_dump($res);
}
function testHotPotGCt() {
$folder='/main/exercice';
$flag=4;
$userID=1;
$res=HotPotGCt($folder,$flag,$userID);
$this->assertTrue(is_null($res));
//var_dump($res);
}
function testmyarraysearch() {
$array=array();
$node='';
$res=myarraysearch($array,$node);
if(!is_bool($res))$this->assertTrue(is_null($res));
//var_dump($res);
}
function testReadFileCont() {
$full_file_path='';
$res=ReadFileCont($full_file_path);
if(!is_bool($res))$this->assertTrue(is_string($res));
//var_dump($res);
}
function testReplaceImgTag() {
$content='src="test2.jpg"';
$res=ReplaceImgTag($content);
$this->assertTrue(is_string($res));
//var_dump($res);
}
function testSetComment() {
global $dbTable;
$path='/main/exercice';
$comment='testing this function';
$comment = Database::escape_string($comment);
$query = "UPDATE $dbTable set comment='$comment' where path='$path'";
$result = Database::query($query);
$res=SetComment($path,$comment);
$this->assertTrue(is_string($res));
//var_dump($resu);
}
function testWriteFileCont() {
$course_code = 'COURSETEST';
$full_file_path='/main/exercice/';
$content='test test test';
$res=WriteFileCont($full_file_path,$content);
$this->assertTrue(is_bool($res));
//var_dump($res);
}
}
?>

File diff suppressed because it is too large Load Diff

@ -1,135 +0,0 @@
<?php
class TestAttendanceLink extends UnitTestCase {
public function TestAttendanceLink() {
$this->UnitTestCase('Test Attendance Link');
}
public function __construct() {
$this->UnitTestCase('Gradebook attendances library - main/gradebook/lib/be/attendancelink.class.test.php');
// The constructor acts like a global setUp for the class
global $date;
TestManager::create_test_course('COURSEATTENDANCELINK');
$this->attendance = new AttendanceLink();
$this->attendance->set_course_code('COURSEATTENDANCELINK');
$this->attendance->set_id (1);
$this->attendance->set_type (LINK_ATTENDANCE);
$this->attendance->set_ref_id (1) ;
$this->attendance->set_user_id (1);
$this->attendance->set_category_id(1);
$this->attendance->set_date ($date);
$this->attendance->set_weight (1);
$this->attendance->set_visible (1);
$this->attendance->set_session_id(1);
}
public function testcalc_score() {
$res = $this->attendance->calc_score($stud_id = null);
$this->assertTrue(is_null($res));
//var_dump($res);
}
/**
* Generate an array of all attendances available.
* @return array 2-dimensional array - every element contains 2 subelements (id, name)
*/
public function testget_all_links() {
$_SESSION['id_session'] = 1;
$res = $this->attendance->get_all_links();
if(!is_array($res)){
$this->assertTrue(is_null($res));
} else {
$this->assertTrue(is_array($res));
}
$_SESSION['id_session'] = null;
//var_dump($res);
}
/**
* @return string description
*/
public function testget_description() {
$res = $this->attendance->get_description();
$this->assertTrue(is_string($res));
//var_dump($res);
}
public function testget_link() {
$res = $this->attendance->get_link();
$this->assertTrue(is_string($res));
//var_dump($res);
}
public function testget_name() {
$res = $this->attendance->get_name();
$this->assertTrue(is_string($res));
//var_dump($res);
}
public function testget_not_created_links() {
$res = $this->attendance->get_not_created_links();
$this->assertTrue(is_array($res));
//var_dump($res);
}
public function testget_test_id() {
$res = $this->attendance->get_test_id();
$this->assertTrue(is_string($res));
//var_dump($res);
}
public function testget_type_name() {
$res = $this->attendance->get_type_name();
$this->assertTrue(is_string($res));
//var_dump($res);
}
/**
* Has anyone done this exercise yet ?
*/
public function testhas_results() {
$res = $this->attendance->has_results();
$this->assertTrue(is_bool($res));
//var_dump($res);
}
public function testis_allowed_to_change_name() {
$res = $this->attendance->is_allowed_to_change_name();
$this->assertTrue(is_bool($res));
//var_dump($res);
}
public function testis_valid_link() {
$res = $this->attendance->is_valid_link();
$this->assertTrue(is_bool($res));
//var_dump($res);
}
public function testneeds_max() {
$res = $this->attendance->needs_max();
$this->assertTrue(is_bool($res));
//var_dump($res);
}
public function testneeds_name_and_description() {
$res = $this->attendance->needs_name_and_description();
$this->assertTrue(is_bool($res));
//var_dump($res);
}
public function testneeds_results() {
$res = $this->attendance->needs_results();
$this->assertTrue(is_bool($res));
//var_dump($res);
}
public function __destruct() {
// The destructor acts like a global tearDown for the class
TestManager::delete_test_course('COURSEATTENDANCELINK');
}
}
?>

@ -1,423 +0,0 @@
<?php
class TestCategoryClass extends UnitTestCase {
public function TestCategoryClass() {
$this->UnitTestCase('Test Category Class');
}
public function __construct() {
$this->UnitTestCase('Gradebook categories library - main/gradebook/lib/be/category.class.test.php');
// The constructor acts like a global setUp for the class
TestManager::create_test_course('COURSECATEGORYCLASS');
$this->category = new Category();
$this->category->set_id(1);
$this->category->set_name('test');
$this->category->set_description('test description');
$this->category->set_user_id(1);
$this->category->set_course_code('COURSECATEGORYCLASS');
$this->category->set_certificate_min_score(20);
$this->category->set_parent_id(0);
$this->category->set_session_id(1);
$this->category->set_weight(1);
$this->category->set_visible(1);
}
/**
* Insert this category into the database
*/
public function testadd() {
$_SESSION['id_session'] = 1;
$res = $this->category->add();
$this->assertTrue(is_null($res));
$_SESSION['id_session'] = null;
//var_dump($res);
}
/**
* Apply the same visibility to every subcategory, evaluation and link
*/
public function testapply_visibility_to_children() {
$res = $this->category->apply_visibility_to_children();
$this->assertTrue(is_null($res));
//var_dump($res);
}
/**
* Calculate the score of this category
* @param $stud_id student id (default: all students - then the average is returned)
* @return array (score sum, weight sum)
* or null if no scores available
*/
public function testcalc_score() {
$res = $this->category->calc_score($stud_id = null);
$this->assertTrue(is_null($res));
//var_dump($res);
}
/**
* Check if a category name (with the same parent category) already exists
* @param $name name to check (if not given, the name property of this object will be checked)
* @param $parent parent category
* @return bool
*/
public function testdoes_name_exist() {
$name = 'test';
$parent=1;
$res = $this->category->does_name_exist($name, $parent);
$this->assertTrue(is_bool($res));
//var_dump($res);
}
/**
* Find category by name
* @param string $name_mask search string
* @return array category objects matching the search criterium
*/
public function testfind_category() {
$name_mask = 'test';
$allcat=array();
$res = $this->category->find_category($name_mask,$allcat);
$this->assertTrue(is_array($res));
//var_dump($res);
}
/**
* Generate an array of all courses that a teacher is admin of.
* @return array 2-dimensional array - every element contains 2 subelements (code, title)
*/
public function testget_all_courses() {
$user_id = 1;
$res = $this->category->get_all_courses($user_id);
$this->assertTrue(is_array($res));
//var_dump($res);
}
public function testget_certificate_min_score() {
$res = $this->category->get_certificate_min_score();
$this->assertTrue(is_numeric($res));
//var_dump($res);
}
public function testget_course_code() {
$res = $this->category->get_course_code();
$this->assertTrue(is_string($res));
//var_dump($res);
}
public function testget_description() {
$res = $this->category->get_description();
$this->assertTrue(is_string($res));
//var_dump($res);
}
/**
* Get appropriate evaluations visible for the user
* @param int $stud_id student id (default: all students)
* @param boolean $recursive process subcategories (default: no recursion)
*/
public function testget_evaluations() {
$res = $this->category->get_evaluations($stud_id = null, $recursive = false);
$this->assertTrue(is_array($res));
//var_dump($res);
}
public function testget_icon_name() {
$res = $this->category->get_icon_name();
$this->assertTrue(is_string($res));
//var_dump($res);
}
public function testget_id() {
$res = $this->category->get_id();
$this->assertTrue(is_numeric($res));
//var_dump($res);
}
public function testget_independent_categories_with_result_for_student() {
$cat_id=1;
$stud_id=1;
$res = $this->category->get_independent_categories_with_result_for_student($cat_id, $stud_id, $cats = array());
$this->assertTrue(is_array($res));
//var_dump($res);
}
public function testget_item_type() {
$res = $this->category->get_item_type();
$this->assertTrue(is_string($res));
//var_dump($res);
}
public function testget_links() {
$res = $this->category->get_links($stud_id = null, $recursive = false);
$this->assertTrue(is_array($res));
//var_dump($res);
}
public function testget_name() {
$res = $this->category->get_name();
$this->assertTrue(is_string($res));
//var_dump($res);
}
public function testget_not_created_course_categories() {
$user_id = 1;
$res = $this->category->get_not_created_course_categories($user_id);
$this->assertTrue(is_array($res));
//var_dump($res);
}
public function testget_parent_id() {
$res = $this->category->get_parent_id();
$this->assertTrue(is_numeric($res));
//var_dump($res);
}
/**
* Return array of Category objects where a student is subscribed to.
* @param int student id
* @param string Course code
* @param int Session id
*/
public function testget_root_categories_for_student() {
$stud_id=1;
$res = $this->category->get_root_categories_for_student($stud_id, $course_code = null, $session_id = null);
$this->assertTrue(is_array($res));
//var_dump($res);
}
/**
* Return array of Category objects where a teacher is admin for.
* @param int user id (to return everything, use 'null' here)
* @param string course code (optional)
* @param int session id (optional)
*/
public function testget_root_categories_for_teacher() {
$user_id=1;
$res = $this->category->get_root_categories_for_teacher($user_id, $course_code = null, $session_id = null);
$this->assertTrue(is_array($res));
//var_dump($res);
}
public function testget_session_id() {
$user_id=1;
$res = $this->category->get_session_id($user_id, $course_code = null, $session_id = null);
$this->assertTrue(is_numeric($res));
//var_dump($res);
}
/**
* Get appropriate subcategories visible for the user (and optionally the course and session)
* @param int $stud_id student id (default: all students)
* @param string Course code (optional)
* @param int Session ID (optional)
* @return array Array of subcategories
*/
public function testget_subcategories() {
$res = $this->category->get_subcategories($stud_id = null, $course_code = null, $session_id = null);
$this->assertTrue(is_array($res));
//var_dump($res);
}
/**
* Generate an array of possible categories where this category can be moved to.
* Notice: its own parent will be included in the list: it's up to the frontend
* to disable this element.
* @return array 2-dimensional array - every element contains 3 subelements (id, name, level)
*/
public function testget_target_categories() {
$res = $this->category->get_target_categories();
if(is_array($res)) {
$this->assertTrue(is_array($res));
} else {
$this->assertTrue(is_null($res));
}
var_dump($res);
}
/**
* Generate an array of all categories the user can navigate to
*/
public function testget_tree() {
$res = $this->category->get_tree();
$this->assertTrue(is_array($res));
//var_dump($res);
}
public function testget_user_id() {
$res = $this->category->get_user_id();
$this->assertTrue(is_numeric($res));
//var_dump($res);
}
public function testget_weight() {
$res = $this->category->get_weight();
$this->assertTrue(is_numeric($res));
//var_dump($res);
}
/**
* Check if a category contains evaluations with a result for a given student
*/
public function testhas_evaluations_with_results_for_student() {
$stud_id = 1;
$res = $this->category->has_evaluations_with_results_for_student($stud_id);
$this->assertTrue(is_bool($res));
//var_dump($res);
}
/**
* Checks if the certificate is available for the given user in this category
* @param integer User ID
* @return boolean True if conditions match, false if fails
*/
public function testis_certificate_available() {
$user_id = 1;
$res = $this->category->is_certificate_available($user_id);
$this->assertTrue(is_bool($res));
//var_dump($res);
}
/**
* Is this category a course ?
* A category is a course if it has a course code and no parent category.
*/
public function testis_course() {
$res = $this->category->is_course();
$this->assertTrue(is_bool($res));
//var_dump($res);
}
/**
* Can this category be moved to somewhere else ?
* The root and courses cannot be moved.
*/
public function testis_movable() {
$res = $this->category->is_movable();
$this->assertTrue(is_bool($res));
//var_dump($res);
}
public function testis_visible() {
$res = $this->category->is_visible();
$this->assertTrue(is_numeric($res));
//var_dump($res);
}
/**
* Retrieve categories and return them as an array of Category objects
* @param int category id
* @param int user id (category owner)
* @param string course code
* @param int parent category
* @param bool visible
* @param int session id (in case we are in a session)
* @param bool Whether to show all "session" categories (true) or hide them (false) in case there is no session id
*/
public function testload() {
$res = $this->category->load($id = null, $user_id = null, $course_code = null, $parent_id = null, $visible = null, $session = null, $show_session_categories = true);
$this->assertTrue(is_array($res));
//var_dump($res);
}
/**
* Move this category to the given category.
* If this category moves from inside a course to outside,
* its course code must be changed, as well as the course code
* of all underlying categories and evaluations. All links will
* be deleted as well !
*/
public function testmove_to_cat() {
$res = $this->category->move_to_cat($this->category);
$this->assertTrue(is_null($res));
//var_dump($res);
}
/**
* Update the properties of this category in the database
*/
public function testsave() {
$res = $this->category->save();
$this->assertTrue(is_null($res));
//var_dump($res);
}
/**
* Show message resource delete
*/
public function testshow_message_resource_delete() {
$course_id = 1;
$res = $this->category->show_message_resource_delete($course_id);
$this->assertTrue(is_bool($res));
//var_dump($res);
}
/**
* Shows all information of an category
*/
public function testshows_all_information_an_category() {
$res = $this->category->shows_all_information_an_category($selectcat='');
$this->assertTrue(is_null($res));
//var_dump($res);
}
/**
* Not delete this category from the database,when visible=3 is category eliminated
*/
public function testupdate_category_delete() {
$course_id = 1;
$res = $this->category->update_category_delete($course_id);
$this->assertTrue(is_null($res));
//var_dump($res);
}
/**
* Delete this evaluation from the database
*/
public function testdelete() {
$res = $this->category->delete();
$this->assertTrue(is_null($res));
//var_dump($res);
}
/**
* Delete this category and every subcategory, evaluation and result inside
*/
public function testdelete_all() {
$res = $this->category->delete_all();
$this->assertTrue(is_null($res));
//var_dump($res);
}
public function __destruct() {
// The destructor acts like a global tearDown for the class
TestManager::delete_test_course('COURSECATEGORYCLASS');
}
}
?>

@ -1,42 +0,0 @@
<?php
class TestDropBoxLink extends UnitTestCase {
public function TestDropBoxLink() {
$this->UnitTestCase('Test Drop Box Link');
}
public function __construct() {
$this->UnitTestCase('Gradebook dropbox library - main/gradebook/lib/be/dropboxlink.class.test.php');
// The constructor acts like a global setUp for the class
TestManager::create_test_course('COURSEDROPBOXLINK');
$this->dropbox = new DropboxLink();
$this->dropbox->set_course_code('COURSEDROPBOXLINK');
$this->dropbox->set_name('test');
}
public function testget_type_name() {
$res = $this->dropbox->get_type_name();
$this->assertTrue(is_string($res));
//var_dump($res);
}
public function testget_view_url() {
$stud_id = 1;
$res = $this->dropbox->get_view_url($stud_id);
//$this->assertTrue(is_null($res));
//var_dump($res);
}
public function testis_allowed_to_change_name() {
$res = $this->dropbox->is_allowed_to_change_name();
$this->assertTrue(is_bool($res));
//var_dump($res);
}
public function __destruct() {
// The destructor acts like a global tearDown for the class
TestManager::delete_test_course('COURSEDROPBOXLINK');
}
}
?>

@ -1,347 +0,0 @@
<?php
class TestEvaluation extends UnitTestCase {
public function TestEvaluation() {
$this->UnitTestCase('Test Evaluation');
}
public function __construct() {
$this->UnitTestCase('Gradebook evaluation library - main/gradebook/lib/be/evaluation.class.test.php');
// The constructor acts like a global setUp for the class
global $date;
TestManager::create_test_course('COURSEEVALUATION');
$this->evaluation = new Evaluation();
$this->evaluation-> set_id (1);
$this->evaluation-> set_name ('test');
$this->evaluation-> set_description ('test description');
$this->evaluation-> set_user_id (1);
$this->evaluation-> set_course_code ('COURSEEVALUATION');
$this->evaluation-> set_category_id (1);
$this->evaluation-> set_date ($date);
$this->evaluation-> set_weight (1);
$this->evaluation-> set_max (1);
$this->evaluation-> set_visible (1);
}
/**
* Insert this evaluation into the database
*/
public function testadd() {
$res = $this->evaluation->add();
$this->assertTrue(is_null($res));
//var_dump($res);
}
public function testadd_evaluation_log() {
$idevaluation = 1;
$res = $this->evaluation->add_evaluation_log($idevaluation);
$this->assertTrue(is_null($res));
//var_dump($res);
}
/**
* Calculate the score of this evaluation
* @param $stud_id student id (default: all students who have results for this eval - then the average is returned)
* @return array (score, max) if student is given
* array (sum of scores, number of scores) otherwise
* or null if no scores available
*/
public function testcalc_score() {
$res = $this->evaluation->calc_score($stud_id = null);
$this->assertTrue(is_null($res));
//var_dump($res);
}
/**
* Delete this evaluation from the database
*/
public function testdelete() {
$res = $this->evaluation->delete();
$this->assertTrue(is_null($res));
//var_dump($res);
}
/**
* Delete all results for this evaluation
*/
public function testdelete_results() {
$res = $this->evaluation->delete_results();
$this->assertTrue(is_null($res));
//var_dump($res);
}
/**
* Delete this evaluation and all underlying results.
*/
public function testdelete_with_results() {
$res = $this->evaluation->delete_with_results();
$this->assertTrue(is_null($res));
//var_dump($res);
}
/**
* Check if an evaluation name (with the same parent category) already exists
* @param $name name to check (if not given, the name property of this object will be checked)
* @param $parent parent category
*/
public function testdoes_name_exist() {
$name = 'test name';
$parent = 1;
$res = $this->evaluation->does_name_exist($name, $parent);
$this->assertTrue(is_bool($res));
//var_dump($res);
}
/**
* Find evaluations by name
* @param string $name_mask search string
* @return array evaluation objects matching the search criterium
* @todo can be written more efficiently using a new (but very complex) sql query
*/
//problem with the call get_evaluations(): Call to a member function get_evaluations() on a non-object
/*public function testfind_evaluations() {
$name_mask = 'test name mask';
$selectcat = 1;
$res = Evaluation::find_evaluations($name_mask,$selectcat);
$this->assertTrue(is_array($res));
//var_dump($res);
}*/
public function testget_category_id() {
$res = $this->evaluation->get_category_id();
$this->assertTrue(is_numeric($res));
//var_dump($res);
}
public function testget_course_code() {
$res = $this->evaluation->get_course_code();
$this->assertTrue(is_string($res));
//var_dump($res);
}
public function testget_date() {
$res = $this->evaluation->get_date();
$this->assertTrue(is_null($res));
//var_dump($res);
}
public function testget_description() {
$res = $this->evaluation->get_description();
$this->assertTrue(is_string($res));
//var_dump($res);
}
/**
* Retrieve evaluations where a student has results for
* and return them as an array of Evaluation objects
* @param $cat_id parent category (use 'null' to retrieve them in all categories)
* @param $stud_id student id
*/
public function testget_evaluations_with_result_for_student() {
$stud_id = 1;
$res = $this->evaluation->get_evaluations_with_result_for_student($cat_id = null, $stud_id);
$this->assertTrue(is_array($res));
//var_dump($res);
}
public function testget_icon_name() {
$res = $this->evaluation->get_icon_name();
$this->assertTrue(is_string($res));
//var_dump($res);
}
public function testget_id() {
$res = $this->evaluation->get_id();
$this->assertTrue(is_numeric($res));
//var_dump($res);
}
public function testget_item_type() {
$res = $this->evaluation->get_item_type();
$this->assertTrue(is_string($res));
//var_dump($res);
}
public function testget_max() {
$res = $this->evaluation->get_max();
$this->assertTrue(is_numeric($res));
//var_dump($res);
}
public function testget_name() {
$res = $this->evaluation->get_name();
$this->assertTrue(is_string($res));
//var_dump($res);
}
/**
* Get a list of students that do not have a result record for this evaluation
*/
public function testget_not_subscribed_students() {
$res = $this->evaluation->get_not_subscribed_students($first_letter_user = '');
$this->assertTrue(is_array($res));
//var_dump($res);
}
/**
* Generate an array of possible categories where this evaluation can be moved to.
* Notice: its own parent will be included in the list: it's up to the frontend
* to disable this element.
* @return array 2-dimensional array - every element contains 3 subelements (id, name, level)
*/
public function testget_target_categories() {
$res = $this->evaluation->get_target_categories();
$this->assertTrue(is_array($res));
//var_dump($res);
}
public function testget_user_id() {
$res = $this->evaluation->get_user_id();
$this->assertTrue(is_numeric($res));
//var_dump($res);
}
public function testget_weight() {
$res = $this->evaluation->get_weight();
$this->assertTrue(is_numeric($res));
//var_dump($res);
}
/**
* Are there any results for this evaluation yet ?
* The 'max' property should not be changed then.
*/
public function testhas_results() {
$res = $this->evaluation->has_results();
$this->assertTrue(is_bool($res));
//var_dump($res);
}
public function testis_valid_score() {
$score = 1;
$res = $this->evaluation->is_valid_score($score);
$this->assertTrue(is_bool($res));
//var_dump($res);
}
public function testis_visible() {
$res = $this->evaluation->is_visible();
$this->assertTrue(is_numeric($res));
//var_dump($res);
}
/**
* Retrieve evaluations and return them as an array of Evaluation objects
* @param $id evaluation id
* @param $user_id user id (evaluation owner)
* @param $course_code course code
* @param $category_id parent category
* @param $visible visible
*/
public function testload() {
$res = $this->evaluation->load($id = null, $user_id = null, $course_code = null, $category_id = null, $visible = null);
$this->assertTrue(is_array($res));
//var_dump($res);
}
/**
* Move this evaluation to the given category.
* If this evaluation moves from inside a course to outside,
* its course code is also changed.
*/
public function testmove_to_cat() {
$cat = $this->evaluation;
$res = $this->evaluation->move_to_cat($cat);
$this->assertTrue(is_null($res));
//var_dump($res);
}
/**
* Update the properties of this evaluation in the database
*/
public function testsave() {
$res = $this->evaluation->save();
$this->assertTrue(is_null($res));
//var_dump($res);
}
public function testset_category_id() {
$res = $this->evaluation->set_category_id(1);
$this->assertTrue(is_null($res));
//var_dump($res);
}
public function testset_course_code() {
$res = $this->evaluation->set_course_code('COURSEEVALUATION');
$this->assertTrue(is_null($res));
//var_dump($res);
}
public function testset_date() {
global $date;
$res = $this->evaluation->set_date('02/02/2010');
$this->assertTrue(is_null($res));
//var_dump($res);
}
public function testset_description() {
$res = $this->evaluation->set_description('test description');
$this->assertTrue(is_null($res));
//var_dump($res);
}
public function testset_id() {
$res = $this->evaluation->set_id(1);
$this->assertTrue(is_null($res));
//var_dump($res);
}
public function testset_max() {
$res = $this->evaluation->set_max(1);
$this->assertTrue(is_null($res));
//var_dump($res);
}
public function testset_name() {
$res = $this->evaluation->set_name('test name');
$this->assertTrue(is_null($res));
//var_dump($res);
}
public function testset_user_id() {
$res = $this->evaluation->set_user_id(1);
$this->assertTrue(is_null($res));
//var_dump($res);
}
public function testset_visible() {
$res = $this->evaluation->set_visible(1);
$this->assertTrue(is_null($res));
//var_dump($res);
}
public function testset_weight() {
$res = $this->evaluation->set_weight(1);
$this->assertTrue(is_null($res));
//var_dump($res);
}
public function __destruct() {
// The destructor acts like a global tearDown for the class
TestManager::delete_test_course('COURSEEVALUATION');
}
}
?>

@ -1,153 +0,0 @@
<?php
class TestExerciseLink extends UnitTestCase {
public function TestExerciseLink() {
$this->UnitTestCase('Test Exercise Link');
}
public function __construct() {
$this->UnitTestCase('Gradebook exercises library - main/gradebook/lib/be/exerciselink.class.test.php');
global $date;
// The constructor acts like a global setUp for the class
TestManager::create_test_course('COURSEEXERCISELINK');
$this->exerciselink = new ExerciseLink();
$this->exerciselink-> set_id (1);
$this->exerciselink-> set_name ('test');
$this->exerciselink-> set_description ('test description');
$this->exerciselink-> set_user_id (1);
$this->exerciselink-> set_course_code ('COURSEEXERCISELINK');
$this->exerciselink-> set_category_id (1);
$this->exerciselink-> set_date ($date);
$this->exerciselink-> set_weight (1);
$this->exerciselink-> set_max (1);
$this->exerciselink-> set_visible (1);
}
/**
* Generate an array of all exercises available.
* @return array 2-dimensional array - every element contains 2 subelements (id, name)
*/
public function testget_all_links() {
$res = $this->exerciselink->get_all_links();
$this->assertTrue(is_array($res));
//var_dump($res);
}
/**
* Get the score of this exercise. Only the first attempts are taken into account.
* @param $stud_id student id (default: all students who have results - then the average is returned)
* @return array (score, max) if student is given
* array (sum of scores, number of scores) otherwise
* or null if no scores available
*/
public function testcalc_score() {
$res = $this->exerciselink->calc_score($stud_id = null);
$this->assertTrue(is_null($res));
//var_dump($res);
}
/**
* Get description to display: same as exercise description
*/
public function testget_description() {
$res = $this->exerciselink->get_description();
$this->assertTrue(is_null($res));
//var_dump($res);
}
/**
* Get URL where to go to if the user clicks on the link.
* First we go to exercise_jump.php and then to the result page.
* Check this php file for more info.
*/
public function testget_link() {
$res = $this->exerciselink->get_link();
$this->assertTrue(is_string($res));
//var_dump($res);
}
/**
* Get name to display: same as exercise title
*/
public function testget_name() {
$res = $this->exerciselink->get_name();
$this->assertTrue(is_null($res));
//var_dump($res);
}
/**
* Generate an array of exercises that a teacher hasn't created a link for.
* @return array 2-dimensional array - every element contains 2 subelements (id, name)
*/
public function testget_not_created_links() {
$_SESSION['id_session'] = 1;
$res = $this->exerciselink->get_not_created_links();
$this->assertTrue(is_array($res));
$_SESSION['id_session'] = null;
//var_dump($res);
}
public function testget_type_name() {
$res = $this->exerciselink->get_type_name();
$this->assertTrue(is_string($res));
//var_dump($res);
}
/**
* Has anyone done this exercise yet ?
*/
public function testhas_results() {
$res = $this->exerciselink->has_results();
$this->assertTrue(is_bool($res));
//var_dump($res);
}
public function testis_allowed_to_change_name() {
$res = $this->exerciselink->is_allowed_to_change_name();
$this->assertTrue(is_bool($res));
//var_dump($res);
}
/**
* Check if this still links to an exercise
*/
public function testis_valid_link() {
$res = $this->exerciselink->is_valid_link();
$this->assertTrue(is_bool($res));
//var_dump($res);
}
public function testneeds_max() {
$res = $this->exerciselink->needs_max();
$this->assertTrue(is_bool($res));
//var_dump($res);
}
public function testneeds_name_and_description() {
$res = $this->exerciselink->needs_name_and_description();
$this->assertTrue(is_bool($res));
//var_dump($res);
}
public function testneeds_results() {
$res = $this->exerciselink->needs_results();
$this->assertTrue(is_bool($res));
//var_dump($res);
}
public function __destruct() {
// The destructor acts like a global tearDown for the class
TestManager::delete_test_course('COURSEEXERCISELINK');
}
}
?>

@ -1,42 +0,0 @@
<?php
class TestForumThreadLink extends UnitTestCase {
public function TestForumThreadLink() {
$this->UnitTestCase('Test Forum Thread Link');
}
public function __construct() {
$this->UnitTestCase('Gradebook forum library - main/gradebook/lib/be/forumthreadlink.class.test.php');
// The constructor acts like a global setUp for the class
TestManager::create_test_course('COURSEFORUMTHREAD');
$this->forumthreadlink = new ForumThreadLink();
$this->forumthreadlink->set_id(1);
$this->forumthreadlink->set_type(5);
$this->forumthreadlink->set_ref_id(1);
$this->forumthreadlink->set_user_id(1);
$this->forumthreadlink->set_course_code('COURSEFORUMTHREAD');
$this->forumthreadlink->set_category_id(1);
$this->forumthreadlink->set_date(date);
$this->forumthreadlink->set_weight(1);
$this->forumthreadlink->set_visible('visible');
}
public function testcalc_score() {
$res = $this->forumthreadlink->calc_score(null);
$this->assertNull($res);
//var_dump($res);
$res2 = $this->forumthreadlink->calc_score(1);
$this->assertTrue(is_array($res2));
//var_dump($res2);
}
public function __destruct() {
// The destructor acts like a global tearDown for the class
TestManager::delete_test_course('COURSEFORUMTHREAD');
}
}
?>

@ -1,21 +0,0 @@
<?php
class TestBanner extends UnitTestCase
{
public function TestBanner()
{
$this->UnitTestCase('Banners library - main/inc/banner.inc.test.php');
}
public function testGetTabs()
{
ob_start();
require_once(api_get_path(SYS_CODE_PATH).'inc/banner.inc.php');
ob_end_clean();
$res = get_tabs();
$this->assertTrue(is_array($res));
$this->assertTrue($res);
//var_dump($res);
}
}

@ -1,35 +0,0 @@
<?php
class Testcdocu extends UnitTestCase{
public function __construct(){
$this->UnitTestCase('Course documents display library - main/inc/course_document.inc.test.php');
}
public function testGetlist(){
global $is_allowed_in_course;
$is_allowed_in_course = true;
$directory = api_get_path(SYS_COURSE_PATH).'/document/audio/';
$res = getlist($directory);
if (is_bool($res)){
$this->assertTrue(is_bool($res));
$this->assertTrue($res ===false);
} else{
$this->assertTrue(is_null($res));
}
}
public function testCheckAndCreateResourceDirectory(){
global $_course, $_user;
global $group_properties, $to_group_id;
global $permissions_for_new_directories;
$repository_path='';
$resource_directory='';
$resource_directory_name='';
$res = check_and_create_resource_directory($repository_path, $resource_directory, $resource_directory_name);
$this->assertTrue(is_bool($res));
$this->assertTrue($res === true || $res === false);
}
}

@ -1,35 +0,0 @@
<?php
//require_once(api_get_path(INCLUDE_PATH).'global.inc.php');
//require_once(api_get_path(SYS_CODE_PATH).'admin/access_url_edit_courses_to_url.php');
require_once(api_get_path(LIBRARY_PATH).'access_url_edit_courses_to_url_functions.lib.php');
class TestAccessUrlEditCoursesToUrlFunctions extends UnitTestCase{
public function __construct(){
$this->UnitTestCase('Access URL courses library - main/inc/lib/access_url_edit_courses_to_url_functions.lib.test.php');
}
public function setUp(){
$this->AccessUrlEditCoursesToUrl = new Accessurleditcoursestourl();
}
public function tearDown(){
$this->AccessUrlEditCoursesToUrl = null;
}
public function TestSearchCourses(){
global $_course, $user_id;
$needle = '';
$id = $_course['id'];
$res = Accessurleditcoursestourl::search_courses($needle, $id);
$this->assertTrue($res);
$this->assertTrue(is_object($res));
$this->assertFalse(is_null($res));
//var_dump($res);
}
}
?>

@ -1,32 +0,0 @@
<?php
require_once(api_get_path(LIBRARY_PATH).'access_url_edit_sessions_to_url_functions.lib.php');
class TestAccessUrlEditSessionsToUrlFunctions extends UnitTestCase{
public function __construct(){
$this->UnitTestCase('Access URL sessions library - main/inc/lib/access_url_edit_sessions_to_url_functions.lib.test.php');
}
public function setUp(){
$this->AccessUrlEditSessionsToUrl = new Accessurleditsessionstourl();
}
public function tearDown(){
$this->AccessUrlEditSessionsToUrl = null;
}
public function TestSearchSessions(){
global $_courses;
$needle = '';
$id = $_courses['id'];
$res = Accessurleditsessionstourl::search_sessions($needle, $id);
$this->assertTrue($res);
$this->assertTrue(is_object($res));
$this->assertFalse(is_null($res));
//var_dump($res);
}
}
?>

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save