ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilObjChatroomAdminAccessTest Class Reference

Class ilObjChatroomAdminAccessTest. More...

+ Inheritance diagram for ilObjChatroomAdminAccessTest:
+ Collaboration diagram for ilObjChatroomAdminAccessTest:

Public Member Functions

 testInstanceOf ()
 
 test_getCommands ()
 
 test_checkGotoReturnFalse ()
 
 test_checkGotoReturnTrue ()
 
 test_checkGotoIssueWithTargetNotAString ()
 

Protected Member Functions

 setUp ()
 

Protected Attributes

 $adminAccess
 
 $ilAccessMock
 

Detailed Description

Member Function Documentation

◆ setUp()

ilObjChatroomAdminAccessTest::setUp ( )
protected

Definition at line 20 of file class.ilObjChatroomAdminAccessTest.php.

References $ilAccessMock.

21  {
22  if (defined('ILIAS_PHPUNIT_CONTEXT')) {
23  include_once("./Services/PHPUnit/classes/class.ilUnitUtil.php");
24  ilUnitUtil::performInitialisation();
25  } else {
26  chdir(dirname(__FILE__));
27  chdir('../../../');
28  }
29 
30  require_once './Services/AccessControl/classes/class.ilAccessHandler.php';
31  $this->ilAccessMock = $this->createMock('ilAccessHandler');
32  global $ilAccess;
33  $ilAccess = $this->ilAccessMock;
34 
35  require_once './Modules/Chatroom/classes/class.ilObjChatroomAdminAccess.php';
36  $this->adminAccess = new ilObjChatroomAdminAccess();
37  }
Class ilObjChatroomAdminAccess Access class for chatroom objects.

◆ test_checkGotoIssueWithTargetNotAString()

ilObjChatroomAdminAccessTest::test_checkGotoIssueWithTargetNotAString ( )

Definition at line 76 of file class.ilObjChatroomAdminAccessTest.php.

77  {
78  $this->assertFalse($this->adminAccess->_checkGoto(array('chtr', '5')));
79  $this->assertFalse($this->adminAccess->_checkGoto(5));
80  }

◆ test_checkGotoReturnFalse()

ilObjChatroomAdminAccessTest::test_checkGotoReturnFalse ( )

Definition at line 58 of file class.ilObjChatroomAdminAccessTest.php.

59  {
60  $this->ilAccessMock->expects($this->any())->method('checkAccess')->with($this->equalTo('visible'), $this->equalTo(''), $this->equalTo('1'))->will($this->returnValue(false));
61 
62  $this->assertFalse($this->adminAccess->_checkGoto(''));
63  $this->assertFalse($this->adminAccess->_checkGoto('chtr'));
64  $this->assertFalse($this->adminAccess->_checkGoto('chtr_'));
65  $this->assertFalse($this->adminAccess->_checkGoto('chtr_'));
66  $this->assertFalse($this->adminAccess->_checkGoto('chtr_test'));
67  $this->assertFalse($this->adminAccess->_checkGoto('chtr_1'));
68  }

◆ test_checkGotoReturnTrue()

ilObjChatroomAdminAccessTest::test_checkGotoReturnTrue ( )

Definition at line 70 of file class.ilObjChatroomAdminAccessTest.php.

References Sabre\Event\once().

71  {
72  $this->ilAccessMock->expects($this->once())->method('checkAccess')->with($this->equalTo('visible'), $this->equalTo(''), $this->equalTo('5'))->will($this->returnValue(true));
73  $this->assertTrue($this->adminAccess->_checkGoto('chtr_5'));
74  }
once($eventName, callable $callBack, $priority=100)
Subscribe to an event exactly once.
+ Here is the call graph for this function:

◆ test_getCommands()

ilObjChatroomAdminAccessTest::test_getCommands ( )

Definition at line 44 of file class.ilObjChatroomAdminAccessTest.php.

45  {
46  $expected = array(
47  array("permission" => "read", "cmd" => "view", "lang_var" => "enter", "default" => true),
48  array("permission" => "write", "cmd" => "edit", "lang_var" => "edit"),
49  array("permission" => "write", "cmd" => "versions", "lang_var" => "versions"),
50  );
51 
52  $commands = $this->adminAccess->_getCommands();
53 
54  $this->assertInternalType("array", $commands);
55  $this->assertEquals($expected, $commands);
56  }

◆ testInstanceOf()

ilObjChatroomAdminAccessTest::testInstanceOf ( )

Definition at line 39 of file class.ilObjChatroomAdminAccessTest.php.

40  {
41  $this->assertInstanceOf('ilObjectAccess', $this->adminAccess);
42  }

Field Documentation

◆ $adminAccess

ilObjChatroomAdminAccessTest::$adminAccess
protected

Definition at line 13 of file class.ilObjChatroomAdminAccessTest.php.

◆ $ilAccessMock

ilObjChatroomAdminAccessTest::$ilAccessMock
protected

Definition at line 18 of file class.ilObjChatroomAdminAccessTest.php.

Referenced by setUp().


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