ILIAS  release_8 Revision v8.24
ILIASSuite Class Reference

This is the global ILIAS test suite. More...

+ Inheritance diagram for ILIASSuite:
+ Collaboration diagram for ILIASSuite:

Static Public Member Functions

static suite ()
 

Data Fields

const REGEX_TEST_FILENAME = "#[a-zA-Z]+Test\.php#"
 
const PHP_UNIT_PARENT_CLASS = TestCase::class
 

Static Protected Member Functions

static addTestFolderToSuite (ILIASSuite $suite)
 Find and add all testSuits beneath ILIAS_ROOL/tests - folder. More...
 

Detailed Description

This is the global ILIAS test suite.

It searches automatically for components test suites by scanning all Modules/.../test and Services/.../test directories for test suite files.

Test suite files are identified automatically, if they are named "ilServices[ServiceName]Suite.php" or ilModules[ModuleName]Suite.php".

Author
alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e

Definition at line 22 of file ILIASSuite.php.

Member Function Documentation

◆ addTestFolderToSuite()

static ILIASSuite::addTestFolderToSuite ( ILIASSuite  $suite)
staticprotected

Find and add all testSuits beneath ILIAS_ROOL/tests - folder.

Definition at line 70 of file ILIASSuite.php.

71 {
72 $test_directories = array("tests");
73 while ($aux_dir = current($test_directories)) {
74 if ($handle = opendir($aux_dir)) {
75 $aux_dir .= DIRECTORY_SEPARATOR;
76 while (false !== ($entry = readdir($handle))) {
77 if ($entry === '.' || $entry === '..') {
78 continue;
79 }
80 if (is_dir($aux_dir . $entry)) {
81 $test_directories[] = $aux_dir . $entry;
82 } else {
83 if (1 === preg_match(self::REGEX_TEST_FILENAME, $entry)) {
84 $ref_declared_classes = get_declared_classes();
85 require_once $aux_dir . "/" . $entry;
86 $new_declared_classes = array_diff(get_declared_classes(), $ref_declared_classes);
87 foreach ($new_declared_classes as $entry_class) {
88 $reflection = new ReflectionClass($entry_class);
89 if (!$reflection->isAbstract() && $reflection->isSubclassOf(self::PHP_UNIT_PARENT_CLASS)) {
90 echo "Adding Test-Suite: " . $entry_class . "\n";
91 $suite->addTestSuite($entry_class);
92 }
93 }
94 }
95 }
96 }
97 }
98 next($test_directories);
99 }
100 return $suite;
101 }
This is the global ILIAS test suite.
Definition: ILIASSuite.php:23

Referenced by suite().

+ Here is the caller graph for this function:

◆ suite()

static ILIASSuite::suite ( )
static

Definition at line 30 of file ILIASSuite.php.

31 {
32 $suite = new ILIASSuite();
33 echo "ILIAS PHPUnit-Tests need installed dev-requirements, please install using 'composer install' in ./libs/composer \n";
34 echo "\n";
35
36 // scan Modules and Services directories
37 $basedirs = array("Services", "Modules");
38
39 foreach ($basedirs as $basedir) {
40 // read current directory
41 $dir = opendir($basedir);
42
43 while ($file = readdir($dir)) {
44 if ($file != "." && $file != ".." && is_dir($basedir . "/" . $file)) {
45 $suite_path =
46 $basedir . "/" . $file . "/test/il" . $basedir . $file . "Suite.php";
47 if (is_file($suite_path)) {
48 include_once($suite_path);
49
50 $name = "il" . $basedir . $file . "Suite";
51 $s = $name::suite();
52 echo "Adding Suite: " . $name . "\n";
53 $suite->addTest($s);
54 //$suite->addTestSuite("ilSettingTest");
55 }
56 }
57 }
58 }
59
60 $suite = self::addTestFolderToSuite($suite);
61
62 echo "\n";
63
64 return $suite;
65 }
static addTestFolderToSuite(ILIASSuite $suite)
Find and add all testSuits beneath ILIAS_ROOL/tests - folder.
Definition: ILIASSuite.php:70
if($format !==null) $name
Definition: metadata.php:247

References $name, and addTestFolderToSuite().

+ Here is the call graph for this function:

Field Documentation

◆ PHP_UNIT_PARENT_CLASS

const ILIASSuite::PHP_UNIT_PARENT_CLASS = TestCase::class

Definition at line 28 of file ILIASSuite.php.

◆ REGEX_TEST_FILENAME

const ILIASSuite::REGEX_TEST_FILENAME = "#[a-zA-Z]+Test\.php#"

Definition at line 27 of file ILIASSuite.php.


The documentation for this class was generated from the following file: