Class ExamplesTest Checks if all examples are implemented and properly returning strings.
More...
Class ExamplesTest Checks if all examples are implemented and properly returning strings.
Definition at line 32 of file ExamplesTest.php.
◆ getEntriesFromCrawler()
static ExamplesTest::getEntriesFromCrawler |
( |
| ) |
|
|
staticprotected |
◆ getFullFunctionNamesAndPathExample()
static ExamplesTest::getFullFunctionNamesAndPathExample |
( |
| ) |
|
|
static |
Definition at line 166 of file ExamplesTest.php.
168 $function_names = [];
169 foreach (static::getEntriesFromCrawler() as $entry) {
170 foreach ($entry->getExamples() as $name => $example_path) {
171 $function_names[$entry->getExamplesNamespace() .
"\\" . $name] = [
172 $entry->getExamplesNamespace() .
"\\" . $name,
177 return $function_names;
◆ getListOfFullscreenExamples()
static ExamplesTest::getListOfFullscreenExamples |
( |
| ) |
|
|
static |
Definition at line 194 of file ExamplesTest.php.
197 [
'ILIAS\UI\examples\MainControls\Footer\base',
"components/ILIAS/UI/src/examples/MainControls/Footer/base.php"],
198 [
'ILIAS\UI\examples\MainControls\MetaBar\renderMetaBarInFullscreenMode',
"components/ILIAS/UI/src/examples/MainControls/MetaBar/base_metabar.php"],
199 [
'ILIAS\UI\examples\Layout\Page\Standard\getUIMainbarExampleCondensed',
"components/ILIAS/UI/src/examples/Layout/Page/Standard/ui_mainbar.php"],
200 [
'ILIAS\UI\examples\Layout\Page\Standard\getUIMainbarExampleFull',
"components/ILIAS/UI/src/examples/Layout/Page/Standard/ui_mainbar.php"],
201 [
'ILIAS\UI\examples\Layout\Page\Standard\ui',
"components/ILIAS/UI/src/examples/Layout/Page/Standard/ui.php"],
202 [
'ILIAS\UI\examples\MainControls\ModeInfo\renderModeInfoFullscreenMode',
"components/ILIAS/UI/src/examples/MainControls/ModeInfo/modeinfo.php"]
◆ setUp()
Definition at line 50 of file ExamplesTest.php.
References $_SERVER, and setUpMockDependencies().
54 $_SERVER[
"SERVER_NAME"] =
"localhost";
58 $_SERVER[
'QUERY_STRING'] =
"param=1";
61 $_POST[
"ilfilehash"] =
"";
63 $this->example_parser =
new Crawler\ExamplesYamlParser();
setUpMockDependencies()
Some wiring up of dependencies to get all the examples running.
◆ setUpMockDependencies()
ExamplesTest::setUpMockDependencies |
( |
| ) |
|
|
protected |
Some wiring up of dependencies to get all the examples running.
If you examples needs additional dependencies, please add them here. However, please check carefully if those deps are really needed. Even if the examples, we try to keep them minimal. Note the most deps are wired up here as mocks only.
Definition at line 71 of file ExamplesTest.php.
References getLanguage(), and init().
Referenced by setUp().
74 $this->dic[
"tpl"] = $this->getTemplateFactory()->getTemplate(
"tpl.main.html",
false,
false);
76 $this->dic[
"refinery"] = new \ILIAS\Refinery\Factory(
83 $this->dic[
"ui.template_factory"] = $this->getTemplateFactory();
85 $this->dic[
"ilCtrl"] = $this->getMockBuilder(\ilCtrl::class)->disableOriginalConstructor()->onlyMethods([
86 "getFormActionByClass",
"setParameterByClass",
"saveParameterByClass",
"getLinkTargetByClass",
"isAsynch" 88 $this->dic[
"ilCtrl"]->method(
"getFormActionByClass")->willReturn(
"Testing");
89 $this->dic[
"ilCtrl"]->method(
"getLinkTargetByClass")->willReturn(
"2");
90 $this->dic[
"ilCtrl"]->method(
"isAsynch")->willReturn(
false);
92 $this->dic[
"upload"] = $this->getMockBuilder(FileUpload::class)->getMock();
94 $this->dic[
"tree"] = $this->getMockBuilder(ilTree::class)
95 ->disableOriginalConstructor()
96 ->onlyMethods([
"getNodeData"])->getMock();
98 $this->dic[
"tree"]->method(
"getNodeData")->willReturn([
100 "title" =>
"mock root node",
104 $component_factory = $this->createMock(ilComponentFactory::class);
105 $component_factory->method(
"getActivePluginsInSlot")->willReturn(
new ArrayIterator());
106 $this->dic[
"component.factory"] = $component_factory;
Interface Observer Contains several chained tasks and infos about them.
Customizing of pimple-DIC for ILIAS.
This is more or less a copy of the removed InitUIFramework file inside the Init component.
Responsible for loading the HTTP Service into the dependency injection container of ILIAS...
◆ testAllExamplesHaveExpectedOutcomeInDocs()
ExamplesTest::testAllExamplesHaveExpectedOutcomeInDocs |
( |
string |
$example_function_name, |
|
|
string |
$example_path |
|
) |
| |
Definition at line 151 of file ExamplesTest.php.
153 $docs = $this->example_parser->parseYamlStringArrayFromFile($example_path);
154 $this->assertArrayHasKey(
'expected output', $docs);
◆ testAllExamplesRenderAString()
ExamplesTest::testAllExamplesRenderAString |
( |
string |
$example_function_name, |
|
|
string |
$example_path |
|
) |
| |
Definition at line 137 of file ExamplesTest.php.
References $DIC, $dic, and Vendor\Package\$e.
142 include_once $example_path;
144 $this->assertIsString($example_function_name(),
" Example $example_function_name does not render a string");
146 $this->assertTrue(
true);
This exception indicates that an UI component was accepted by the JF but is not backed by a real impl...
◆ testAllNonAbstractComponentsShowcaseExamples()
ExamplesTest::testAllNonAbstractComponentsShowcaseExamples |
( |
| ) |
|
- Exceptions
-
Definition at line 116 of file ExamplesTest.php.
References $DIC, $dic, and getEntriesFromCrawler().
122 if (in_array(trim($entry->getNamespace(),
'\\'), self::MAY_NOT_HAVE_EXAMPLES,
true)) {
125 if (!$entry->isAbstract()) {
126 $this->assertGreaterThan(
128 count($entry->getExamples()),
129 "Non abstract Component " . $entry->getNamespace()
130 .
" does not provide any example. Please provide at least one in " . $entry->getExamplesNamespace() .
" at " . $entry->getExamplesPath()
static getEntriesFromCrawler()
◆ testFullscreenModeExamples()
ExamplesTest::testFullscreenModeExamples |
( |
string |
$example_function_name, |
|
|
string |
$example_path |
|
) |
| |
Definition at line 181 of file ExamplesTest.php.
References $DIC, $dic, and Vendor\Package\$e.
186 include_once $example_path;
188 $this->assertIsString($example_function_name($DIC),
" Example $example_function_name does not render a string");
190 $this->assertTrue(
true);
This exception indicates that an UI component was accepted by the JF but is not backed by a real impl...
◆ $dic
◆ $example_parser
Crawler ExamplesYamlParser ExamplesTest::$example_parser |
|
protected |
◆ $path_to_base_factory
string ExamplesTest::$path_to_base_factory = "components/ILIAS/UI/src/Factory.php" |
|
staticprotected |
◆ MAY_NOT_HAVE_EXAMPLES
const ExamplesTest::MAY_NOT_HAVE_EXAMPLES |
|
protected |
Initial value:= [
\ILIAS\UI\Help\Topic::class,
\ILIAS\UI\Component\Progress\State\Bar\State::class,
\ILIAS\UI\Component\Input\Field\Node\Node::class,
\ILIAS\UI\Component\Input\Field\Node\Async::class,
\ILIAS\UI\Component\Input\Field\Node\Leaf::class,
]
Definition at line 38 of file ExamplesTest.php.
The documentation for this class was generated from the following file: