ILIAS  release_7 Revision v7.30-3-g800a261c036
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 ()
 

Detailed Description

Member Function Documentation

◆ setUp()

JavaScriptBindableTest::setUp ( )

Definition at line 19 of file JavaScriptBindableTest.php.

19 : void
20 {
21 $this->mock = new JSComponentMock();
22 }

◆ test_withAdditionalOnLoadCode()

JavaScriptBindableTest::test_withAdditionalOnLoadCode ( )

Definition at line 57 of file JavaScriptBindableTest.php.

58 {
59 $m = $this->mock
60 ->withOnLoadCode(function ($id) {
61 return "Its me, $id!";
62 })
63 ->withAdditionalOnLoadCode(function ($id) {
64 return "And again, me: $id.";
65 });
66
67 $binder = $m->getOnLoadCode();
68 $this->assertInstanceOf(\Closure::class, $binder);
69 $this->assertEquals("Its me, Mario!\nAnd again, me: Mario.", $binder("Mario"));
70 }

References 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 72 of file JavaScriptBindableTest.php.

73 {
74 $m = $this->mock
75 ->withAdditionalOnLoadCode(function ($id) {
76 return "And again, me: $id.";
77 });
78
79 $binder = $m->getOnLoadCode();
80 $this->assertInstanceOf(\Closure::class, $binder);
81 $this->assertEquals("And again, me: Mario.", $binder("Mario"));
82 }

◆ test_withOnLoadCode()

JavaScriptBindableTest::test_withOnLoadCode ( )

Definition at line 24 of file JavaScriptBindableTest.php.

25 {
26 $m = $this->mock->withOnLoadCode(function ($id) {
27 return "Its me, $id!";
28 });
29
30 $binder = $m->getOnLoadCode();
31 $this->assertInstanceOf(\Closure::class, $binder);
32 $this->assertEquals("Its me, Mario!", $binder("Mario"));
33 }

◆ test_withOnLoadCode_false_closure_1()

JavaScriptBindableTest::test_withOnLoadCode_false_closure_1 ( )

Definition at line 35 of file JavaScriptBindableTest.php.

36 {
37 try {
38 $this->mock->withOnLoadCode(function () {
39 });
40 $this->assertFalse("This should not happen...");
41 } catch (\InvalidArgumentException $exception) {
42 $this->assertTrue(true);
43 }
44 }

◆ test_withOnLoadCode_false_closure_2()

JavaScriptBindableTest::test_withOnLoadCode_false_closure_2 ( )

Definition at line 46 of file JavaScriptBindableTest.php.

47 {
48 try {
49 $this->mock->withOnLoadCode(function ($id, $some_arg) {
50 });
51 $this->assertFalse("This should not happen...");
52 } catch (\InvalidArgumentException $exception) {
53 $this->assertTrue(true);
54 }
55 }

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