ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilUITestRailExampleTestCasesObjective Class Reference
+ Inheritance diagram for ilUITestRailExampleTestCasesObjective:
+ Collaboration diagram for ilUITestRailExampleTestCasesObjective:

Public Member Functions

 __construct (protected bool $only_new_cases)
 
 getArtifactName ()
 
 getPreconditions (Setup\Environment $environment)
 
 achieve (Setup\Environment $environment)
 
 build ()
 
 buildIn (Setup\Environment $env)
 

Protected Member Functions

 getPath ()
 

Private Attributes

const TESTCASEWRITER = 'ui.testrail.xmlwriter'
 
const FILENAME_UPDATE = 'testcases_update.xml'
 
const FILENAME_NEW = 'testcases_new.xml'
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilUITestRailExampleTestCasesObjective::__construct ( protected bool  $only_new_cases)

Definition at line 31 of file class.ilUITestRailExampleTestCasesObjective.php.

33 {
34 }

Member Function Documentation

◆ achieve()

ilUITestRailExampleTestCasesObjective::achieve ( Setup\Environment  $environment)

Definition at line 53 of file class.ilUITestRailExampleTestCasesObjective.php.

53 : Setup\Environment
54 {
55 $component_factory = $environment->getResource(Setup\Environment::RESOURCE_COMPONENT_FACTORY);
56 $plugin_admin = $environment->getResource(Setup\Environment::RESOURCE_PLUGIN_ADMIN);
57
58 $ORIG_DIC = $GLOBALS["DIC"];
59 $GLOBALS["DIC"] = new DI\Container();
60 $GLOBALS["DIC"]["component.factory"] = $component_factory;
61 $GLOBALS["DIC"]["ilPluginAdmin"] = $plugin_admin;
62
63 $path = 'components/ILIAS/Style/classes/Setup/templates/testrail.case.xml';
64 $tpl = new ilTemplate($path, true, true);
65 $parser = new Crawler\ExamplesYamlParser();
66 $testcases = new TestRailXMLWriter($tpl, $parser, $this->only_new_cases);
67
68 $environment = $environment->withResource(self::TESTCASEWRITER, $testcases);
69
70 parent::achieve($environment);
71 $GLOBALS["DIC"] = $ORIG_DIC;
72 return $environment;
73 }
special template class to simplify handling of ITX/PEAR
$path
Definition: ltiservices.php:30
$GLOBALS["DIC"]
Definition: wac.php:54

References $GLOBALS, $path, and ILIAS\Setup\Environment\getResource().

+ Here is the call graph for this function:

◆ build()

ilUITestRailExampleTestCasesObjective::build ( )

Definition at line 75 of file class.ilUITestRailExampleTestCasesObjective.php.

75 : Setup\Artifact
76 {
77 }

◆ buildIn()

ilUITestRailExampleTestCasesObjective::buildIn ( Setup\Environment  $env)

Definition at line 79 of file class.ilUITestRailExampleTestCasesObjective.php.

79 : Setup\Artifact
80 {
81 $crawler = new Crawler\FactoriesCrawler();
83
84 $sorted = [];
85 foreach ($data as $entry) {
86 $path = explode('/', $entry->getPath());
87 if (end($path) === 'Factory') {
88 continue;
89 }
90 $path = array_slice($path, 3);
91 $section = array_shift($path);
92 $section = array_shift($path);
93 $section = array_shift($path);
94 if (! array_key_exists($section, $sorted)) {
95 $sorted[$section] = [];
96 }
97 $path = array_slice($path, 0, -1);
98 $path[] = $entry->getTitle();
99 $sorted[$section][] = [implode('/', $path), $entry];
100 }
101 ksort($sorted);
102
103 $writer = $env->getResource(self::TESTCASEWRITER)
104 ->withData($sorted);
105 return new Setup\Artifact\XMLArtifact($writer->getXML());
106 }

References $data, $path, and ilKitchenSinkDataCollectedObjective\ROOT_FACTORY_PATH.

◆ getArtifactName()

ilUITestRailExampleTestCasesObjective::getArtifactName ( )

Definition at line 36 of file class.ilUITestRailExampleTestCasesObjective.php.

References FILENAME_NEW, and FILENAME_UPDATE.

Referenced by getPath().

+ Here is the caller graph for this function:

◆ getPath()

ilUITestRailExampleTestCasesObjective::getPath ( )
protected

Definition at line 48 of file class.ilUITestRailExampleTestCasesObjective.php.

48 : string
49 {
50 return Setup\Artifact\BuildArtifactObjective::ARTIFACTS . "/" . $this->getArtifactName();
51 }

References getArtifactName().

+ Here is the call graph for this function:

◆ getPreconditions()

ilUITestRailExampleTestCasesObjective::getPreconditions ( Setup\Environment  $environment)

Definition at line 41 of file class.ilUITestRailExampleTestCasesObjective.php.

41 : array
42 {
43 return [
44 new \ilComponentFactoryExistsObjective()
45 ];
46 }

Field Documentation

◆ FILENAME_NEW

const ilUITestRailExampleTestCasesObjective::FILENAME_NEW = 'testcases_new.xml'
private

Definition at line 29 of file class.ilUITestRailExampleTestCasesObjective.php.

Referenced by getArtifactName().

◆ FILENAME_UPDATE

const ilUITestRailExampleTestCasesObjective::FILENAME_UPDATE = 'testcases_update.xml'
private

Definition at line 28 of file class.ilUITestRailExampleTestCasesObjective.php.

Referenced by getArtifactName().

◆ TESTCASEWRITER

const ilUITestRailExampleTestCasesObjective::TESTCASEWRITER = 'ui.testrail.xmlwriter'
private

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