ILIAS  release_8 Revision v8.25-1-g13de6a5eca6
JavaScriptBindableTest Class Reference
+ Inheritance diagram for JavaScriptBindableTest:
+ Collaboration diagram for JavaScriptBindableTest:

Public Member Functions

 setUp ()
 
 test_withOnLoadCode ()
 
 test_withOnLoadCode_false_closure_1 ()
 
 test_withOnLoadCode_false_closure_2 ()
 
 test_withAdditionalOnLoadCode ()
 
 test_withAdditionalOnLoadCode_no_previous ()
 

Protected Attributes

JSComponentMock $mock
 

Detailed Description

Member Function Documentation

◆ setUp()

JavaScriptBindableTest::setUp ( )

Definition at line 40 of file JavaScriptBindableTest.php.

40 : void
41 {
42 $this->mock = new JSComponentMock();
43 }

◆ test_withAdditionalOnLoadCode()

JavaScriptBindableTest::test_withAdditionalOnLoadCode ( )

Definition at line 78 of file JavaScriptBindableTest.php.

78 : void
79 {
80 $m = $this->mock
81 ->withOnLoadCode(function ($id) {
82 return "Its me, $id!";
83 })
84 ->withAdditionalOnLoadCode(function ($id) {
85 return "And again, me: $id.";
86 });
87
88 $binder = $m->getOnLoadCode();
89 $this->assertInstanceOf(Closure::class, $binder);
90 $this->assertEquals("Its me, Mario!\nAnd again, me: Mario.", $binder("Mario"));
91 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

References $id, and ILIAS\UI\Implementation\Component\withAdditionalOnLoadCode().

+ Here is the call graph for this function:

◆ test_withAdditionalOnLoadCode_no_previous()

JavaScriptBindableTest::test_withAdditionalOnLoadCode_no_previous ( )

Definition at line 93 of file JavaScriptBindableTest.php.

93 : void
94 {
95 $m = $this->mock
96 ->withAdditionalOnLoadCode(function ($id) {
97 return "And again, me: $id.";
98 });
99
100 $binder = $m->getOnLoadCode();
101 $this->assertInstanceOf(Closure::class, $binder);
102 $this->assertEquals("And again, me: Mario.", $binder("Mario"));
103 }

References $id.

◆ test_withOnLoadCode()

JavaScriptBindableTest::test_withOnLoadCode ( )

Definition at line 45 of file JavaScriptBindableTest.php.

45 : void
46 {
47 $m = $this->mock->withOnLoadCode(function ($id) {
48 return "Its me, $id!";
49 });
50
51 $binder = $m->getOnLoadCode();
52 $this->assertInstanceOf(Closure::class, $binder);
53 $this->assertEquals("Its me, Mario!", $binder("Mario"));
54 }

References $id.

◆ test_withOnLoadCode_false_closure_1()

JavaScriptBindableTest::test_withOnLoadCode_false_closure_1 ( )

Definition at line 56 of file JavaScriptBindableTest.php.

56 : void
57 {
58 try {
59 $this->mock->withOnLoadCode(function (): void {
60 });
61 $this->assertFalse("This should not happen...");
62 } catch (InvalidArgumentException $exception) {
63 $this->assertTrue(true);
64 }
65 }

◆ test_withOnLoadCode_false_closure_2()

JavaScriptBindableTest::test_withOnLoadCode_false_closure_2 ( )

Definition at line 67 of file JavaScriptBindableTest.php.

67 : void
68 {
69 try {
70 $this->mock->withOnLoadCode(function ($id, $some_arg): void {
71 });
72 $this->assertFalse("This should not happen...");
73 } catch (InvalidArgumentException $exception) {
74 $this->assertTrue(true);
75 }
76 }

References $id.

Field Documentation

◆ $mock

JSComponentMock JavaScriptBindableTest::$mock
protected

Definition at line 38 of file JavaScriptBindableTest.php.


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