ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
JavaScriptBindableTest Class Reference
+ Inheritance diagram for JavaScriptBindableTest:
+ Collaboration diagram for JavaScriptBindableTest:

Public Member Functions

 setUp ()
 
 testWithOnLoadCode ()
 
 testWithOnLoadCodeFalseClosure1 ()
 
 testWithOnLoadCodeFalseClosure2 ()
 
 testWithAdditionalOnLoadCode ()
 
 testWithAdditionalOnLoadCodeNoPrevious ()
 

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 }

◆ testWithAdditionalOnLoadCode()

JavaScriptBindableTest::testWithAdditionalOnLoadCode ( )

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:

◆ testWithAdditionalOnLoadCodeNoPrevious()

JavaScriptBindableTest::testWithAdditionalOnLoadCodeNoPrevious ( )

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.

◆ testWithOnLoadCode()

JavaScriptBindableTest::testWithOnLoadCode ( )

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.

◆ testWithOnLoadCodeFalseClosure1()

JavaScriptBindableTest::testWithOnLoadCodeFalseClosure1 ( )

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 }

◆ testWithOnLoadCodeFalseClosure2()

JavaScriptBindableTest::testWithOnLoadCodeFalseClosure2 ( )

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: