30 $ilias_ini_path = __DIR__.
"/../../../ilias.ini.php";
32 if(!is_file($ilias_ini_path)) {
35 require_once
'./Services/Init/classes/class.ilIniFile.php';
36 $ilias_ini =
new ilIniFile($ilias_ini_path);
38 $client_data_path = $ilias_ini->readVariable(
"server",
"absolute_path").
"/".$ilias_ini->readVariable(
"clients",
"path");
40 if(!is_dir($client_data_path)) {
44 include_once($ilias_ini->readVariable(
"server",
"absolute_path").
"/Services/PHPUnit/config/cfg.phpunit.php");
46 if(!isset(
$_GET[
"client_id"])) {
50 $phpunit_client =
$_GET[
"client_id"];
52 if(!$phpunit_client) {
56 if(!is_file($client_data_path.
"/".$phpunit_client.
"/client.ini.php")) {
66 echo "ILIAS PHPUnit-Tests need installed dev-requirements, please install using 'composer install' in ./libs/composer \n";
70 $basedirs =
array(
"Services",
"Modules");
72 foreach ($basedirs as $basedir)
75 $dir = opendir($basedir);
77 while(
$file = readdir($dir))
82 $basedir.
"/".
$file.
"/test/il".$basedir.$file.
"Suite.php";
83 if (is_file($suite_path))
85 include_once($suite_path);
87 $name =
"il".$basedir.$file.
"Suite";
89 echo "Adding Suite: ".$name.
"\n";
101 if (!
$suite->hasInstalledILIAS()) {
102 echo "Removing tests requiring an installed ILIAS.\n";
103 $ff =
new PHPUnit_Runner_Filter_Factory();
105 (
new ReflectionClass(
"PHPUnit_Runner_Filter_Group_Exclude")
106 ,
array(self::PHPUNIT_GROUP_FOR_TESTS_REQUIRING_INSTALLED_ILIAS)
108 $suite->injectFilter($ff);
111 echo "Found installed ILIAS, running all tests.\n";
124 $test_directories =
array(
"tests");
125 while($aux_dir = current($test_directories)) {
126 if($handle = opendir($aux_dir)) {
127 $aux_dir .= DIRECTORY_SEPARATOR;
128 while (
false !== ($entry = readdir($handle))) {
129 if($entry ===
'.' || $entry ===
'..') {
132 if(is_dir($aux_dir.$entry)) {
133 $test_directories[] = $aux_dir.$entry;
135 if(1 === preg_match(self::REGEX_TEST_FILENAME, $entry)) {
136 $ref_declared_classes = get_declared_classes();
137 require_once $aux_dir.
"/".$entry;
138 $new_declared_classes = array_diff(get_declared_classes(),$ref_declared_classes );
139 foreach ($new_declared_classes as $entry_class) {
140 $reflection =
new ReflectionClass($entry_class);
141 if(!$reflection->isAbstract() && $reflection->isSubclassOf(self::PHP_UNIT_PARENT_CLASS)) {
142 echo "Adding Test-Suite: ".$entry_class.
"\n";
143 $suite->addTestSuite($entry_class);
150 next($test_directories);
const PHPUNIT_GROUP_FOR_TESTS_REQUIRING_INSTALLED_ILIAS
const PHP_UNIT_PARENT_CLASS
hasInstalledILIAS()
Check if there is an installed ILIAS to run tests on.
This is the global ILIAS test suite.
const REGEX_TEST_FILENAME
Create styles array
The data for the language used.
static addTestFolderToSuite(ilGlobalSuite $suite)
Find and add all testSuits beneath ILIAS_ROOL/tests - folder.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file