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

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

References $ilAccessMock, and defined.

◆ test_checkGotoIssueWithTargetNotAString()

ilObjChatroomAdminAccessTest::test_checkGotoIssueWithTargetNotAString ( )

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

80 {
81 $this->assertFalse($this->adminAccess->_checkGoto(array('chtr', '5')));
82 $this->assertFalse($this->adminAccess->_checkGoto(5));
83 }

◆ test_checkGotoReturnFalse()

ilObjChatroomAdminAccessTest::test_checkGotoReturnFalse ( )

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

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

◆ test_checkGotoReturnTrue()

ilObjChatroomAdminAccessTest::test_checkGotoReturnTrue ( )

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

74 {
75 $this->ilAccessMock->expects($this->once())->method('checkAccess')->with($this->equalTo('visible'), $this->equalTo(''), $this->equalTo('5'))->will($this->returnValue(true));
76 $this->assertTrue($this->adminAccess->_checkGoto('chtr_5'));
77 }

◆ test_getCommands()

ilObjChatroomAdminAccessTest::test_getCommands ( )

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

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

◆ testInstanceOf()

ilObjChatroomAdminAccessTest::testInstanceOf ( )

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

43 {
44 $this->assertInstanceOf('ilObjectAccess', $this->adminAccess);
45 }

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: