ILIAS  release_8 Revision v8.25-1-g13de6a5eca6
PlayerVideoTest Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for PlayerVideoTest:
+ Collaboration diagram for PlayerVideoTest:

Public Member Functions

 getUIFactory ()
 
 getFactory ()
 
 test_implements_factory_interface ()
 
 test_get_title_get_source ()
 
 test_get_title_get_poster ()
 
 test_get_title_get_subtitle_file ()
 
 test_render_video ()
 
 test_render_with_poster ()
 
 test_render_with_subtitles ()
 
- Public Member Functions inherited from ILIAS_UI_TestBase
 setUp ()
 
 tearDown ()
 
 getUIFactory ()
 
 getTemplateFactory ()
 
 getResourceRegistry ()
 
 getLanguage ()
 
 getJavaScriptBinding ()
 
 getRefinery ()
 
 getImagePathResolver ()
 
 getDataFactory ()
 
 getDefaultRenderer (JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
 
 getDecoratedRenderer (Renderer $default)
 
 normalizeHTML (string $html)
 
 assertHTMLEquals (string $expected_html_as_string, string $html_as_string)
 

Additional Inherited Members

- Protected Member Functions inherited from ILIAS_UI_TestBase
 brutallyTrimHTML (string $html)
 A more radical version of normalizeHTML. More...
 
 brutallyTrimSignals (string $html)
 A naive replacement of all il_signal-ids with dots to ease comparisons of rendered output. More...
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 31 of file PlayerVideoTest.php.

Member Function Documentation

◆ getFactory()

PlayerVideoTest::getFactory ( )

Definition at line 53 of file PlayerVideoTest.php.

53 : C\Player\Factory
54 {
55 return new I\Component\Player\Factory();
56 }

Referenced by test_get_title_get_poster(), test_get_title_get_source(), test_get_title_get_subtitle_file(), test_implements_factory_interface(), test_render_video(), test_render_with_poster(), and test_render_with_subtitles().

+ Here is the caller graph for this function:

◆ getUIFactory()

PlayerVideoTest::getUIFactory ( )

Reimplemented from ILIAS_UI_TestBase.

Definition at line 33 of file PlayerVideoTest.php.

34 {
35 $field_factory = $this->createMock(FieldFactory::class);
36 return new class ($field_factory) extends NoUIFactory {
37 protected FieldFactory $factory;
38 public function __construct(FieldFactory $factory)
39 {
40 $this->factory = $factory;
41 }
42 public function modal(): C\Modal\Factory
43 {
44 return new I\Component\Modal\Factory(new I\Component\SignalGenerator(), $this->factory);
45 }
46 public function button(): C\Button\Factory
47 {
48 return new I\Component\Button\Factory();
49 }
50 };
51 }
$factory
Definition: metadata.php:75
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Bulky.php:21
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
modal()
This second example shows a scenario in which the Close Button is used in an overlay as indicated in ...
Definition: modal.php:12

References $factory, ILIAS\GlobalScreen\Provider\__construct(), and ILIAS\UI\examples\Button\Close\modal().

+ Here is the call graph for this function:

◆ test_get_title_get_poster()

PlayerVideoTest::test_get_title_get_poster ( )

Definition at line 76 of file PlayerVideoTest.php.

76 : void
77 {
78 $f = $this->getFactory();
79
80 $video = $f->video("/foo")->withPoster("bar.jpg");
81
82 $this->assertEquals("bar.jpg", $video->getPoster());
83 }

References Vendor\Package\$f, and getFactory().

+ Here is the call graph for this function:

◆ test_get_title_get_source()

PlayerVideoTest::test_get_title_get_source ( )

Definition at line 67 of file PlayerVideoTest.php.

67 : void
68 {
69 $f = $this->getFactory();
70
71 $video = $f->video("/foo");
72
73 $this->assertEquals("/foo", $video->getSource());
74 }

References Vendor\Package\$f, and getFactory().

+ Here is the call graph for this function:

◆ test_get_title_get_subtitle_file()

PlayerVideoTest::test_get_title_get_subtitle_file ( )

Definition at line 85 of file PlayerVideoTest.php.

85 : void
86 {
87 $f = $this->getFactory();
88
89 $video = $f->video("/foo")->withAdditionalSubtitleFile("en", "subtitles.vtt");
90
91 $this->assertEquals(["en" => "subtitles.vtt"], $video->getSubtitleFiles());
92 }

References Vendor\Package\$f, and getFactory().

+ Here is the call graph for this function:

◆ test_implements_factory_interface()

PlayerVideoTest::test_implements_factory_interface ( )

Definition at line 58 of file PlayerVideoTest.php.

58 : void
59 {
60 $f = $this->getFactory();
61
62 $video = $f->video("/foo");
63
64 $this->assertInstanceOf("ILIAS\\UI\\Component\\Player\\Video", $video);
65 }

References Vendor\Package\$f, and getFactory().

+ Here is the call graph for this function:

◆ test_render_video()

PlayerVideoTest::test_render_video ( )

Definition at line 94 of file PlayerVideoTest.php.

94 : void
95 {
96 $f = $this->getFactory();
97 $r = $this->getDefaultRenderer();
98
99 $video = $f->video("/foo");
100
101 $html = $r->render($video);
102 $expected = <<<EOT
103<div class="il-video-container">
104 <video class="il-video-player" id="id_1" src="/foo" style="max-width: 100%;" preload="metadata" >
105 </video>
106</div>
107EOT;
108 $this->assertHTMLEquals(
109 $this->brutallyTrimHTML($expected),
110 $this->brutallyTrimHTML($html)
111 );
112 }
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
Definition: Base.php:427
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:444
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:355

References Vendor\Package\$f, ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS_UI_TestBase\getDefaultRenderer(), and getFactory().

+ Here is the call graph for this function:

◆ test_render_with_poster()

PlayerVideoTest::test_render_with_poster ( )

Definition at line 114 of file PlayerVideoTest.php.

114 : void
115 {
116 $f = $this->getFactory();
117 $r = $this->getDefaultRenderer();
118
119 $video = $f->video("/foo")->withPoster("bar.jpg");
120
121 $html = $r->render($video);
122
123 $expected = <<<EOT
124<div class="il-video-container">
125 <video class="il-video-player" id="id_1" src="/foo" style="max-width: 100%;" preload="metadata" poster="bar.jpg">
126 </video>
127</div>
128EOT;
129 $this->assertHTMLEquals(
130 $this->brutallyTrimHTML($expected),
131 $this->brutallyTrimHTML($html)
132 );
133 }

References Vendor\Package\$f, ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS_UI_TestBase\getDefaultRenderer(), and getFactory().

+ Here is the call graph for this function:

◆ test_render_with_subtitles()

PlayerVideoTest::test_render_with_subtitles ( )

Definition at line 135 of file PlayerVideoTest.php.

135 : void
136 {
137 $f = $this->getFactory();
138 $r = $this->getDefaultRenderer();
139
140 $video = $f->video("/foo")->withAdditionalSubtitleFile("en", "subtitles.vtt");
141
142 $html = $r->render($video);
143 $expected = <<<EOT
144<div class="il-video-container">
145 <video class="il-video-player" id="id_1" src="/foo" style="max-width: 100%;" preload="metadata" >
146 <track kind="subtitles" src="subtitles.vtt" srclang="en" />
147 </video>
148</div>
149EOT;
150 $this->assertHTMLEquals(
151 $this->brutallyTrimHTML($expected),
152 $this->brutallyTrimHTML($html)
153 );
154 }

References Vendor\Package\$f, ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS_UI_TestBase\getDefaultRenderer(), and getFactory().

+ Here is the call graph for this function:

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