ILIAS  release_8 Revision v8.24
PlayerAudioTest 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 PlayerAudioTest:
+ Collaboration diagram for PlayerAudioTest:

Public Member Functions

 getUIFactory ()
 
 getFactory ()
 
 test_implements_factory_interface ()
 
 test_get_title_get_source ()
 
 test_get_title_get_transcript ()
 
 test_render_audio ()
 
 test_render_with_transcript ()
 
- 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 PlayerAudioTest.php.

Member Function Documentation

◆ getFactory()

PlayerAudioTest::getFactory ( )

Definition at line 54 of file PlayerAudioTest.php.

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

Referenced by test_get_title_get_source(), test_get_title_get_transcript(), test_implements_factory_interface(), test_render_audio(), and test_render_with_transcript().

+ Here is the caller graph for this function:

◆ getUIFactory()

PlayerAudioTest::getUIFactory ( )

Reimplemented from ILIAS_UI_TestBase.

Definition at line 33 of file PlayerAudioTest.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
43 public function modal(): C\Modal\Factory
44 {
45 return new I\Component\Modal\Factory(new I\Component\SignalGenerator(), $this->factory);
46 }
47 public function button(): C\Button\Factory
48 {
49 return new I\Component\Button\Factory();
50 }
51 };
52 }
$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_source()

PlayerAudioTest::test_get_title_get_source ( )

Definition at line 68 of file PlayerAudioTest.php.

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

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

+ Here is the call graph for this function:

◆ test_get_title_get_transcript()

PlayerAudioTest::test_get_title_get_transcript ( )

Definition at line 77 of file PlayerAudioTest.php.

77 : void
78 {
79 $f = $this->getFactory();
80
81 $audio = $f->audio("/foo", "bar");
82
83 $this->assertEquals("bar", $audio->getTranscription());
84 }

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

+ Here is the call graph for this function:

◆ test_implements_factory_interface()

PlayerAudioTest::test_implements_factory_interface ( )

Definition at line 59 of file PlayerAudioTest.php.

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

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

+ Here is the call graph for this function:

◆ test_render_audio()

PlayerAudioTest::test_render_audio ( )

Definition at line 86 of file PlayerAudioTest.php.

86 : void
87 {
88 $f = $this->getFactory();
89 $r = $this->getDefaultRenderer();
90
91 $audio = $f->audio("/foo");
92
93 $html = $r->render($audio);
94
95 $expected = <<<EOT
96<div class="il-audio-container">
97 <audio class="il-audio-player" id="id_1" src="/foo" preload="metadata"></audio>
98</div>
99EOT;
100 $this->assertHTMLEquals(
101 $this->brutallyTrimHTML($expected),
102 $this->brutallyTrimHTML($html)
103 );
104 }
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_transcript()

PlayerAudioTest::test_render_with_transcript ( )

Definition at line 106 of file PlayerAudioTest.php.

106 : void
107 {
108 $f = $this->getFactory();
109 $r = $this->getDefaultRenderer();
110
111 $audio = $f->audio("/foo", "x*123");
112
113 $html = $r->render($audio);
114
115 $this->assertEquals(
116 true,
117 is_int(strpos($html, "ui_transcription</button>"))
118 );
119 $this->assertEquals(
120 true,
121 is_int(strpos($html, "il-modal-lightbox"))
122 );
123 $this->assertEquals(
124 true,
125 is_int(strpos($html, "x*123"))
126 );
127 }

References Vendor\Package\$f, 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: