ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
PlayerVideoTest Class Reference
+ Inheritance diagram for PlayerVideoTest:
+ Collaboration diagram for PlayerVideoTest:

Public Member Functions

 getUIFactory ()
 
 getFactory ()
 
 testImplementsFactoryInterface ()
 
 testGetTitleGetSource ()
 
 testGetTitleGetPoster ()
 
 testGetTitleGetSubtitleFile ()
 
 testRenderVideo ()
 
 testRenderWithPoster ()
 
 testRenderWithSubtitles ()
 
 testRenderYoutube ()
 
 testRenderVimeo ()
 

Detailed Description

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 60 of file PlayerVideoTest.php.

Referenced by testGetTitleGetPoster(), testGetTitleGetSource(), testGetTitleGetSubtitleFile(), testImplementsFactoryInterface(), testRenderVideo(), testRenderVimeo(), testRenderWithPoster(), testRenderWithSubtitles(), and testRenderYoutube().

60  : C\Player\Factory
61  {
62  return new I\Component\Player\Factory();
63  }
+ Here is the caller graph for this function:

◆ getUIFactory()

PlayerVideoTest::getUIFactory ( )

Definition at line 33 of file PlayerVideoTest.php.

References ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\button(), and ILIAS\Repository\modal().

33  : NoUIFactory
34  {
35  return new class (
36  $this->createMock(C\Modal\InterruptiveItem\Factory::class),
37  $this->createMock(FieldFactory::class),
38  ) extends NoUIFactory {
39  public function __construct(
40  protected C\Modal\InterruptiveItem\Factory $item_factory,
41  protected FieldFactory $field_factory,
42  ) {
43  }
44 
45  public function modal(): C\Modal\Factory
46  {
47  return new I\Component\Modal\Factory(
48  new I\Component\SignalGenerator(),
49  $this->item_factory,
50  $this->field_factory,
51  );
52  }
53  public function button(): C\Button\Factory
54  {
55  return new I\Component\Button\Factory();
56  }
57  };
58  }
button(string $caption, string $cmd)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
modal(string $title="", string $cancel_label="")
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

◆ testGetTitleGetPoster()

PlayerVideoTest::testGetTitleGetPoster ( )

Definition at line 83 of file PlayerVideoTest.php.

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

83  : void
84  {
85  $f = $this->getFactory();
86 
87  $video = $f->video("/foo")->withPoster("bar.jpg");
88 
89  $this->assertEquals("bar.jpg", $video->getPoster());
90  }
+ Here is the call graph for this function:

◆ testGetTitleGetSource()

PlayerVideoTest::testGetTitleGetSource ( )

Definition at line 74 of file PlayerVideoTest.php.

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

74  : void
75  {
76  $f = $this->getFactory();
77 
78  $video = $f->video("/foo");
79 
80  $this->assertEquals("/foo", $video->getSource());
81  }
+ Here is the call graph for this function:

◆ testGetTitleGetSubtitleFile()

PlayerVideoTest::testGetTitleGetSubtitleFile ( )

Definition at line 92 of file PlayerVideoTest.php.

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

92  : void
93  {
94  $f = $this->getFactory();
95 
96  $video = $f->video("/foo")->withAdditionalSubtitleFile("en", "subtitles.vtt");
97 
98  $this->assertEquals(["en" => "subtitles.vtt"], $video->getSubtitleFiles());
99  }
+ Here is the call graph for this function:

◆ testImplementsFactoryInterface()

PlayerVideoTest::testImplementsFactoryInterface ( )

Definition at line 65 of file PlayerVideoTest.php.

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

65  : void
66  {
67  $f = $this->getFactory();
68 
69  $video = $f->video("/foo");
70 
71  $this->assertInstanceOf("ILIAS\\UI\\Component\\Player\\Video", $video);
72  }
+ Here is the call graph for this function:

◆ testRenderVideo()

PlayerVideoTest::testRenderVideo ( )

Definition at line 101 of file PlayerVideoTest.php.

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

101  : void
102  {
103  $f = $this->getFactory();
104  $r = $this->getDefaultRenderer();
105 
106  $video = $f->video("/foo");
107 
108  $html = $r->render($video);
109  $expected = <<<EOT
110 <div class="il-video-container">
111  <video controls class="il-video-player" id="" src="/foo" preload="metadata" >
112  </video>
113 </div>
114 EOT;
115  $this->assertEquals(
116  $this->brutallyTrimHTML($expected),
117  $this->brutallyTrimHTML($html)
118  );
119  }
$r
+ Here is the call graph for this function:

◆ testRenderVimeo()

PlayerVideoTest::testRenderVimeo ( )

Definition at line 182 of file PlayerVideoTest.php.

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

182  : void
183  {
184  $f = $this->getFactory();
185  $r = $this->getDefaultRenderer();
186 
187  $video = $f->video("https://player.vimeo.com/video/669475821");
188 
189  $html = $r->render($video);
190 
191  $expected = <<<EOT
192 <div class="il-video-container">
193  <iframe id="" src="https://player.vimeo.com/video/669475821" allow="fullscreen; autoplay; picture-in-picture;" referrerpolicy="strict-origin-when-cross-origin"></iframe>
194 </div>
195 EOT;
196  $this->assertHTMLEquals(
197  $this->brutallyTrimHTML($expected),
198  $this->brutallyTrimHTML($html)
199  );
200  }
$r
+ Here is the call graph for this function:

◆ testRenderWithPoster()

PlayerVideoTest::testRenderWithPoster ( )

Definition at line 121 of file PlayerVideoTest.php.

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

121  : void
122  {
123  $f = $this->getFactory();
124  $r = $this->getDefaultRenderer();
125 
126  $video = $f->video("/foo")->withPoster("bar.jpg");
127 
128  $html = $r->render($video);
129  $expected = <<<EOT
130 <div class="il-video-container">
131  <video controls class="il-video-player" id="" src="/foo" preload="metadata" poster="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" style="background-image:url('bar.jpg')">
132  </video>
133 </div>
134 EOT;
135  $this->assertEquals(
136  $this->brutallyTrimHTML($expected),
137  $this->brutallyTrimHTML($html)
138  );
139  }
$r
+ Here is the call graph for this function:

◆ testRenderWithSubtitles()

PlayerVideoTest::testRenderWithSubtitles ( )

Definition at line 141 of file PlayerVideoTest.php.

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

141  : void
142  {
143  $f = $this->getFactory();
144  $r = $this->getDefaultRenderer();
145 
146  $video = $f->video("/foo")->withAdditionalSubtitleFile("en", "subtitles.vtt");
147 
148  $html = $r->render($video);
149  $expected = <<<EOT
150 <div class="il-video-container">
151  <video controls class="il-video-player" id="" src="/foo" preload="metadata" >
152  <track kind="subtitles" src="subtitles.vtt" srclang="en" />
153  </video>
154 </div>
155 EOT;
156  $this->assertEquals(
157  $this->brutallyTrimHTML($expected),
158  $this->brutallyTrimHTML($html)
159  );
160  }
$r
+ Here is the call graph for this function:

◆ testRenderYoutube()

PlayerVideoTest::testRenderYoutube ( )

Definition at line 162 of file PlayerVideoTest.php.

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

162  : void
163  {
164  $f = $this->getFactory();
165  $r = $this->getDefaultRenderer();
166 
167  $video = $f->video("https://www.youtube.com/embed/YSN2osYbshQ");
168 
169  $html = $r->render($video);
170 
171  $expected = <<<EOT
172 <div class="il-video-container">
173  <iframe id="" src="https://www.youtube.com/embed/YSN2osYbshQ" allow="fullscreen; autoplay; picture-in-picture;" referrerpolicy="strict-origin-when-cross-origin"></iframe>
174 </div>
175 EOT;
176  $this->assertHTMLEquals(
177  $this->brutallyTrimHTML($expected),
178  $this->brutallyTrimHTML($html)
179  );
180  }
$r
+ Here is the call graph for this function:

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