ILIAS  trunk Revision v11.0_alpha-1744-gb0451eebef4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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.

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

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  }
$path
Definition: ltiservices.php:29
$GLOBALS["DIC"]
Definition: wac.php:53
+ 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.

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

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  }
$path
Definition: ltiservices.php:29

◆ getArtifactName()

ilUITestRailExampleTestCasesObjective::getArtifactName ( )

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

Referenced by getPath().

36  : string
37  {
38  return ($this->only_new_cases) ? self::FILENAME_NEW : self::FILENAME_UPDATE;
39  }
+ Here is the caller graph for this function:

◆ getPath()

ilUITestRailExampleTestCasesObjective::getPath ( )
protected

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

References getArtifactName().

48  : string
49  {
50  return Setup\Artifact\BuildArtifactObjective::ARTIFACTS . "/" . $this->getArtifactName();
51  }
+ 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

◆ FILENAME_UPDATE

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

◆ TESTCASEWRITER

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

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