/** * @covers FOF30\Platform\Joomla\Platform::authorise * * @dataProvider FOF30\Tests\Platform\PlatformJoomlaProvider::getTestAuthorise * */ public function testAuthorise($appType, $auths, $assetName, $action, $expected, $message) { $this->forceApplicationTypeAndResetPlatformCliAdminCache($appType); $fakeUser = new UserForAdminAuth(); $fakeUser->allowedAuths = $auths; MockSession::$user = $fakeUser; $actual = $this->platform->authorise($action, $assetName); $this->assertEquals($expected, $actual, $message); }
/** * Gets a mock session object. * * @param array $options An array of key-value options for the JSession mock. * getId : the value to be returned by the mock getId method * get.user.id : the value to assign to the user object id returned by get('user') * get.user.name : the value to assign to the user object name returned by get('user') * get.user.username : the value to assign to the user object username returned by get('user') * * @return \JSession */ public function getMockSession($options = array()) { // Attempt to load the real class first. class_exists('JSession'); return MockSession::create($this, $options); }