ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 17 of file JavaScriptBindableTest.php.

18  {
19  $this->mock = new JSComponentMock();
20  }

◆ test_withAdditionalOnLoadCode()

JavaScriptBindableTest::test_withAdditionalOnLoadCode ( )

Definition at line 55 of file JavaScriptBindableTest.php.

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

56  {
57  $m = $this->mock
58  ->withOnLoadCode(function ($id) {
59  return "Its me, $id!";
60  })
61  ->withAdditionalOnLoadCode(function ($id) {
62  return "And again, me: $id.";
63  });
64 
65  $binder = $m->getOnLoadCode();
66  $this->assertInstanceOf(\Closure::class, $binder);
67  $this->assertEquals("Its me, Mario!\nAnd again, me: Mario.", $binder("Mario"));
68  }
if(!array_key_exists('StateId', $_REQUEST)) $id
+ Here is the call graph for this function:

◆ test_withAdditionalOnLoadCode_no_previous()

JavaScriptBindableTest::test_withAdditionalOnLoadCode_no_previous ( )

Definition at line 70 of file JavaScriptBindableTest.php.

References $id, and $m.

71  {
72  $m = $this->mock
73  ->withAdditionalOnLoadCode(function ($id) {
74  return "And again, me: $id.";
75  });
76 
77  $binder = $m->getOnLoadCode();
78  $this->assertInstanceOf(\Closure::class, $binder);
79  $this->assertEquals("And again, me: Mario.", $binder("Mario"));
80  }
if(!array_key_exists('StateId', $_REQUEST)) $id

◆ test_withOnLoadCode()

JavaScriptBindableTest::test_withOnLoadCode ( )

Definition at line 22 of file JavaScriptBindableTest.php.

References $id, and $m.

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

◆ test_withOnLoadCode_false_closure_1()

JavaScriptBindableTest::test_withOnLoadCode_false_closure_1 ( )

Definition at line 33 of file JavaScriptBindableTest.php.

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

◆ test_withOnLoadCode_false_closure_2()

JavaScriptBindableTest::test_withOnLoadCode_false_closure_2 ( )

Definition at line 44 of file JavaScriptBindableTest.php.

References $id.

45  {
46  try {
47  $this->mock->withOnLoadCode(function ($id, $some_arg) {
48  });
49  $this->assertFalse("This should not happen...");
50  } catch (\InvalidArgumentException $exception) {
51  $this->assertTrue(true);
52  }
53  }
if(!array_key_exists('StateId', $_REQUEST)) $id

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