Class ilObjChatroomAccessTest.
More...
◆ setUp()
ilObjChatroomAccessTest::setUp |
( |
| ) |
|
|
protected |
Definition at line 15 of file class.ilObjChatroomAccessTest.php.
References defined.
17 if(
defined(
'ILIAS_PHPUNIT_CONTEXT'))
19 include_once(
"./Services/PHPUnit/classes/class.ilUnitUtil.php");
20 ilUnitUtil::performInitialisation();
24 chdir(dirname(__FILE__));
28 require_once
'./Services/Administration/classes/class.ilSetting.php';
29 require_once
'./Modules/Chatroom/classes/class.ilObjChatroomAccess.php';
Access class for chatroom objects.
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
◆ test_checkAccessReturnFalse()
ilObjChatroomAccessTest::test_checkAccessReturnFalse |
( |
| ) |
|
Definition at line 87 of file class.ilObjChatroomAccessTest.php.
References $GLOBALS, and array.
91 $GLOBALS[
'ilUser'] = $this->getMockBuilder(
'ilUser')->disableOriginalConstructor()->setMethods(
94 $GLOBALS[
'ilUser']->expects($this->once())->method(
'getId')->will($this->returnValue($userId));
96 $GLOBALS[
'ilDB'] = $this->getMockBuilder(
'ilDBMySQL')->disableOriginalConstructor()->setMethods(
97 array(
'quote',
'query',
'fetchAssoc')
99 $GLOBALS[
'ilDB']->expects($this->any())->method(
'quote');
100 $GLOBALS[
'ilDB']->expects($this->any())->method(
'query');
101 $GLOBALS[
'ilDB']->expects($this->at(0))->method(
'fetchAssoc')->will(
102 $this->returnValue(
array(
'keyword' =>
'chat_enabled',
'value' =>
false))
105 $GLOBALS[
'rbacsystem'] = $this->getMockBuilder(
'ilRbacSystem')->disableOriginalConstructor()->setMethods(
106 array(
'checkAccessOfUser')
108 $GLOBALS[
'rbacsystem']->expects($this->once())->method(
'checkAccessOfUser')->with(
109 $this->equalTo($userId),
110 $this->equalTo(
'write'),
111 $this->equalTo($refId)
112 )->will($this->returnValue(
false));
114 $this->assertFalse($this->access->_checkAccess(
'unused',
'unused', $refId,
'unused'));
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
Create styles array
The data for the language used.
◆ test_checkAccessReturnTrueWithRbacAccess()
ilObjChatroomAccessTest::test_checkAccessReturnTrueWithRbacAccess |
( |
| ) |
|
Definition at line 117 of file class.ilObjChatroomAccessTest.php.
References $GLOBALS, and array.
121 $GLOBALS[
'ilUser'] = $this->getMockBuilder(
'ilUser')->disableOriginalConstructor()->setMethods(
124 $GLOBALS[
'ilUser']->expects($this->once())->method(
'getId')->will($this->returnValue($userId));
126 $GLOBALS[
'ilDB'] = $this->getMockBuilder(
'ilDBMySQL')->disableOriginalConstructor()->setMethods(
127 array(
'quote',
'query',
'fetchAssoc')
129 $GLOBALS[
'ilDB']->expects($this->any())->method(
'quote');
130 $GLOBALS[
'ilDB']->expects($this->any())->method(
'query');
131 $GLOBALS[
'ilDB']->expects($this->any())->method(
'fetchAssoc')->will(
132 $this->returnValue(
array(
'keyword' =>
'chat_enabled',
'value' =>
false))
135 $GLOBALS[
'rbacsystem'] = $this->getMockBuilder(
'ilRbacSystem')->disableOriginalConstructor()->setMethods(
136 array(
'checkAccessOfUser')
138 $GLOBALS[
'rbacsystem']->expects($this->once())->method(
'checkAccessOfUser')->with(
139 $this->equalTo($userId),
140 $this->equalTo(
'write'),
141 $this->equalTo($refId)
142 )->will($this->returnValue(
true));
144 $this->assertTrue($this->access->_checkAccess(
'unused',
'unused', $refId,
'unused'));
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
Create styles array
The data for the language used.
◆ test_checkGotoIssueWithTargetNotAString()
ilObjChatroomAccessTest::test_checkGotoIssueWithTargetNotAString |
( |
| ) |
|
Definition at line 81 of file class.ilObjChatroomAccessTest.php.
References array.
83 $this->assertFalse($this->access->_checkGoto(
array(
'chtr',
'5')));
84 $this->assertFalse($this->access->_checkGoto(5));
Create styles array
The data for the language used.
◆ test_checkGotoReturnFalse()
ilObjChatroomAccessTest::test_checkGotoReturnFalse |
( |
| ) |
|
Definition at line 51 of file class.ilObjChatroomAccessTest.php.
References $GLOBALS, and array.
53 $GLOBALS[
'rbacsystem'] = $this->getMockBuilder(
'ilRbacSystem')->disableOriginalConstructor()->setMethods(
56 $GLOBALS[
'rbacsystem']->expects($this->any())->method(
'checkAccess')->with(
57 $this->equalTo(
'read'),
59 )->will($this->returnValue(
false));
61 $this->assertFalse($this->access->_checkGoto(
''));
62 $this->assertFalse($this->access->_checkGoto(
'chtr'));
63 $this->assertFalse($this->access->_checkGoto(
'chtr_'));
64 $this->assertFalse($this->access->_checkGoto(
'chtr_'));
65 $this->assertFalse($this->access->_checkGoto(
'chtr_test'));
66 $this->assertFalse($this->access->_checkGoto(
'chtr_1'));
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
Create styles array
The data for the language used.
◆ test_checkGotoReturnTrue()
ilObjChatroomAccessTest::test_checkGotoReturnTrue |
( |
| ) |
|
Definition at line 69 of file class.ilObjChatroomAccessTest.php.
References $GLOBALS, and array.
71 $GLOBALS[
'rbacsystem'] = $this->getMockBuilder(
'ilRbacSystem')->disableOriginalConstructor()->setMethods(
74 $GLOBALS[
'rbacsystem']->expects($this->once())->method(
'checkAccess')->with(
75 $this->equalTo(
'read'),
77 )->will($this->returnValue(
true));
78 $this->assertTrue($this->access->_checkGoto(
'chtr_5'));
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
Create styles array
The data for the language used.
◆ test_getCommands()
ilObjChatroomAccessTest::test_getCommands |
( |
| ) |
|
Definition at line 38 of file class.ilObjChatroomAccessTest.php.
References array.
41 array(
"permission" =>
"read",
"cmd" =>
"view",
"lang_var" =>
"enter",
"default" =>
true),
42 array(
"permission" =>
"write",
"cmd" =>
"settings-general",
"lang_var" =>
"settings"),
45 $commands = $this->access->_getCommands();
47 $this->assertInternalType(
"array", $commands);
48 $this->assertEquals($expected, $commands);
Create styles array
The data for the language used.
◆ testInstanceOf()
ilObjChatroomAccessTest::testInstanceOf |
( |
| ) |
|
◆ $access
ilObjChatroomAccessTest::$access |
|
protected |
The documentation for this class was generated from the following file: