ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 ()
 

Detailed Description

Member Function Documentation

◆ setUp()

JavaScriptBindableTest::setUp ( )

Definition at line 15 of file JavaScriptBindableTest.php.

15  {
16  $this->mock = new JSComponentMock();
17  }

◆ test_withOnLoadCode()

JavaScriptBindableTest::test_withOnLoadCode ( )

Definition at line 19 of file JavaScriptBindableTest.php.

19  {
20  $m = $this->mock->withOnLoadCode(function($id) {
21  return "Its me, $id!";
22  });
23 
24  $binder = $m->getOnLoadCode();
25  $this->assertInstanceOf(\Closure::class, $binder);
26  $this->assertEquals("Its me, Mario!", $binder("Mario"));
27  }

◆ test_withOnLoadCode_false_closure_1()

JavaScriptBindableTest::test_withOnLoadCode_false_closure_1 ( )

Definition at line 29 of file JavaScriptBindableTest.php.

29  {
30  try {
31  $this->mock->withOnLoadCode(function() {});
32  $this->assertFalse("This should not happen...");
33  }
34  catch (\InvalidArgumentException $exception) {
35  $this->assertTrue(true);
36  }
37  }

◆ test_withOnLoadCode_false_closure_2()

JavaScriptBindableTest::test_withOnLoadCode_false_closure_2 ( )

Definition at line 39 of file JavaScriptBindableTest.php.

39  {
40  try {
41  $this->mock->withOnLoadCode(function($id, $some_arg) {});
42  $this->assertFalse("This should not happen...");
43  }
44  catch (\InvalidArgumentException $exception) {
45  $this->assertTrue(true);
46  }
47  }

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