ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
ilComponentBuildPluginInfoObjectiveTest Class Reference
+ Inheritance diagram for ilComponentBuildPluginInfoObjectiveTest:
+ Collaboration diagram for ilComponentBuildPluginInfoObjectiveTest:

Public Member Functions

 testScanningTopLevel ()
 
 testScanningComplete ()
 
 testPluginsAdded ()
 
 testScanDir ()
 
 testIsDir ()
 
 testIsDotFile ()
 
 testAddPlugins ()
 
 testBuildPluginPath ()
 

Data Fields

array $scanned
 
array $dirs
 
array $read
 
array $files
 
array $added
 

Protected Member Functions

 setUp ()
 

Private Attributes

ilComponentBuildPluginInfoObjective $builder = null
 

Detailed Description

Definition at line 21 of file ilComponentBuildPluginInfoObjectiveTest.php.

Member Function Documentation

◆ setUp()

ilComponentBuildPluginInfoObjectiveTest::setUp ( )
protected

Definition at line 30 of file ilComponentBuildPluginInfoObjectiveTest.php.

References $data, XapiProxy\$plugin, and ILIAS\GlobalScreen\Provider\__construct().

30  : void
31  {
32  $this->scanned = [];
33  $this->dirs = [];
34  $this->read = [];
35  $this->files = [];
36  $this->added = [];
37  $this->builder = new class ($this) extends ilComponentBuildPluginInfoObjective {
38  protected const BASE_PATH = "plugins/";
40  public function __construct($test)
41  {
42  $this->test = $test;
43  }
44  protected function scanDir(string $dir): array
45  {
46  $this->test->scanned[] = $dir;
47  return $this->test->dirs[$dir] ?? [];
48  }
49  public function _scanDir(string $dir): array
50  {
51  return parent::scanDir($dir);
52  }
53  protected function isDir(string $dir): bool
54  {
55  return true;
56  }
57  public function _isDir(string $dir): bool
58  {
59  return parent::isDir($dir);
60  }
61  public function _isDotFile(string $file): bool
62  {
63  return parent::isDotFile($file);
64  }
65  protected function buildPluginPath(string $type, string $component, string $slot, string $plugin): string
66  {
67  return $this->test->files[parent::buildPluginPath($type, $component, $slot, $plugin)];
68  }
69 
70  public function _buildPluginPath(string $type, string $component, string $slot, string $plugin): string
71  {
72  return parent::buildPluginPath($type, $component, $slot, $plugin);
73  }
74  protected function addPlugin(array &$data, string $type, string $component, string $slot, string $plugin): void
75  {
76  $this->test->added[] = "$type/$component/$slot/$plugin";
77  }
78  public function _addPlugin(array &$data, string $type, string $component, string $slot, string $plugin): void
79  {
80  parent::addPlugin($data, $type, $component, $slot, $plugin);
81  }
82  };
83  }
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

◆ testAddPlugins()

ilComponentBuildPluginInfoObjectiveTest::testAddPlugins ( )

Definition at line 167 of file ilComponentBuildPluginInfoObjectiveTest.php.

References $data, and null.

167  : void
168  {
169  $data = [];
170  $this->files["plugins/Type1/Module1/Slot1/Plugin1/"] = __DIR__ . "/";
171  $this->builder->_addPlugin($data, "Type1", "Module1", "Slot1", "Plugin1");
172 
173  $expected = [
174  "tstplg" => [
175  "Type1",
176  "Module1",
177  "Slot1",
178  "Plugin1",
179  "1.9.1",
180  "8.0",
181  "8.999",
182  "Richard Klees",
183  "richard.klees@concepts-and-training.de",
184  true,
185  false,
186  null
187  ]
188  ];
189  $this->assertEquals($expected, $data);
190  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ testBuildPluginPath()

ilComponentBuildPluginInfoObjectiveTest::testBuildPluginPath ( )

Definition at line 192 of file ilComponentBuildPluginInfoObjectiveTest.php.

192  : void
193  {
194  $this->assertEquals("plugins/TYPE/COMPONENT/SLOT/PLUGIN/", $this->builder->_buildPluginPath("TYPE", "COMPONENT", "SLOT", "PLUGIN"));
195  }

◆ testIsDir()

ilComponentBuildPluginInfoObjectiveTest::testIsDir ( )

Definition at line 152 of file ilComponentBuildPluginInfoObjectiveTest.php.

152  : void
153  {
154  // Use the component directory, because this should be mostly stable.
155  $expected = true;
156  $actual = $this->builder->_isDir(__DIR__ . "/../..");
157  $this->assertEquals($expected, $actual);
158  }

◆ testIsDotFile()

ilComponentBuildPluginInfoObjectiveTest::testIsDotFile ( )

Definition at line 160 of file ilComponentBuildPluginInfoObjectiveTest.php.

160  : void
161  {
162  $expected = true;
163  $actual = $this->builder->_isDotFile(".DS_Store");
164  $this->assertEquals($expected, $actual);
165  }

◆ testPluginsAdded()

ilComponentBuildPluginInfoObjectiveTest::testPluginsAdded ( )

Definition at line 119 of file ilComponentBuildPluginInfoObjectiveTest.php.

References ILIAS\UI\examples\Symbol\Glyph\Sort\sort().

119  : void
120  {
121  $this->dirs = [
122  "plugins/" => ["Services"],
123  "plugins/Services/" => ["Module1"],
124  "plugins/Services/Module1" => ["Slot1"],
125  "plugins/Services/Module1/Slot1" => ["Plugin1", "Plugin2"],
126  ];
127 
128  $this->builder->build();
129 
130  $expected = [
131  "Services/Module1/Slot1/Plugin1",
132  "Services/Module1/Slot1/Plugin2"
133  ];
134  sort($expected);
135  sort($this->added);
136  $this->assertEquals($expected, $this->added);
137  }
sort()
description: > Example for rendering a Sort Glyph.
Definition: sort.php:41
+ Here is the call graph for this function:

◆ testScanDir()

ilComponentBuildPluginInfoObjectiveTest::testScanDir ( )

Definition at line 139 of file ilComponentBuildPluginInfoObjectiveTest.php.

139  : void
140  {
141  // Use the component directory without artifacts, because this should be mostly stable.
142  $expected = ["Component.php", "README.md", "ROADMAP.md", "classes", "exceptions", "maintenance.json", "service.xml", "src", "tests"];
143  $actual = array_values(
144  array_diff(
145  $this->builder->_scanDir(__DIR__ . "/../.."),
146  ["artifacts", ".DS_Store"] // .DS_Store is a macOS artifact which is not relevant for the test.
147  )
148  );
149  $this->assertEquals($expected, $actual);
150  }

◆ testScanningComplete()

ilComponentBuildPluginInfoObjectiveTest::testScanningComplete ( )

Definition at line 95 of file ilComponentBuildPluginInfoObjectiveTest.php.

References ILIAS\UI\examples\Symbol\Glyph\Sort\sort().

95  : void
96  {
97  $this->dirs = [
98  "plugins/" => ["Services"],
99  "plugins/Services/" => ["Module1", "Module2"],
100  "plugins/Services/Module1" => ["Slot1", "Slot2"],
101  "plugins/Services/Module2" => []
102  ];
103 
104  $this->builder->build();
105 
106  $expected = [
107  "plugins/Modules/",
108  "plugins/Services/",
109  "plugins/Services/Module1",
110  "plugins/Services/Module1/Slot1",
111  "plugins/Services/Module1/Slot2",
112  "plugins/Services/Module2",
113  ];
114  sort($expected);
115  sort($this->scanned);
116  $this->assertEquals($expected, $this->scanned);
117  }
sort()
description: > Example for rendering a Sort Glyph.
Definition: sort.php:41
+ Here is the call graph for this function:

◆ testScanningTopLevel()

ilComponentBuildPluginInfoObjectiveTest::testScanningTopLevel ( )

Definition at line 85 of file ilComponentBuildPluginInfoObjectiveTest.php.

References ILIAS\UI\examples\Symbol\Glyph\Sort\sort().

85  : void
86  {
87  $this->builder->build();
88 
89  $expected = ["plugins/Modules/", "plugins/Services/"];
90  sort($expected);
91  sort($this->scanned);
92  $this->assertEquals($expected, $this->scanned);
93  }
sort()
description: > Example for rendering a Sort Glyph.
Definition: sort.php:41
+ Here is the call graph for this function:

Field Documentation

◆ $added

array ilComponentBuildPluginInfoObjectiveTest::$added

Definition at line 28 of file ilComponentBuildPluginInfoObjectiveTest.php.

◆ $builder

ilComponentBuildPluginInfoObjective ilComponentBuildPluginInfoObjectiveTest::$builder = null
private

Definition at line 23 of file ilComponentBuildPluginInfoObjectiveTest.php.

◆ $dirs

array ilComponentBuildPluginInfoObjectiveTest::$dirs

Definition at line 25 of file ilComponentBuildPluginInfoObjectiveTest.php.

◆ $files

array ilComponentBuildPluginInfoObjectiveTest::$files

Definition at line 27 of file ilComponentBuildPluginInfoObjectiveTest.php.

◆ $read

array ilComponentBuildPluginInfoObjectiveTest::$read

Definition at line 26 of file ilComponentBuildPluginInfoObjectiveTest.php.

◆ $scanned

array ilComponentBuildPluginInfoObjectiveTest::$scanned

Definition at line 24 of file ilComponentBuildPluginInfoObjectiveTest.php.


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