PHP Class TinyAuth\Test\Auth\TinyAuthorizeTest

Inheritance: extends Cake\TestSuite\TestCase
Mostra file Open project: dereuromark/cakephp-tinyauth

Public Properties

Property Type Description
$collection Cake\Controller\ComponentRegistry
$fixtures array
$request Cake\Http\ServerRequest | Cake\Network\Request

Public Methods

Method Description
setUp ( ) : void
testAdminMethodsAllowed ( ) : void Test with enabled configuration settings - access to all actions that are prefixed using the same role configuration setting.
testAvailableRoles ( ) : void Tests fetching available Roles from Configure and database
testAvailableRolesEmptyTableException ( ) : void Tests exception thrown when the roles database table exists but contains no roles/records.
testAvailableRolesMissingTableException ( ) : void Tests exception thrown when no roles are in Configure AND the roles database table does not exist.
testBasicUserMethodAllowed ( ) : void
testBasicUserMethodAllowedMultiRole ( ) : void Tests multi-role authorization.
testBasicUserMethodAllowedWildcard ( ) : void Tests access to a controller that uses the * wildcard for both the action and the allowed groups (* = *).
testBasicUserMethodAllowedWildcardSpecificGroup ( ) : void Tests access to a controller that uses the * wildcard for the action but combines it with a specific group (here: * = moderators).
testBasicUserMethodAllowedWithLongActionNames ( ) : void
testBasicUserMethodAllowedWithLongActionNamesUnderscored ( ) : void
testBasicUserMethodDisallowed ( ) : void
testBasicUserMethodInexistentRole ( ) : void
testCaseSensitivity ( ) : void Tests using incorrect casing, enforces strict acl.ini definitions.
testConstructor ( ) : void Test applying config in the constructor
testConstructorWithoutValidCache ( ) : void Tests exception thrown when Cache is unavailable.
testGetAcl ( ) : void
testIdColumnPivotTable ( ) : void Tests idColumn
testIniConstruct ( ) : void Tests constructing an ACL ini section key using CakeRequest parameters
testIniDeconstruct ( ) : void Tests deconstructing an ACL ini section key
testIniParsing ( ) : void Tests acl.ini parsing method.
testIniParsingMissingFileException ( ) : void Tests exception thrown when no acl.ini exists.
testSuperAdmin ( ) : void Tests super admin
testSuperAdminRole ( ) : void Tests superAdmin role, allowed to all actions
testUserMethodsAllowed ( ) : void Tests with configuration setting 'allowUser' set to true, giving user access to all controller/actions except when prefixed with /admin
testUserRoles ( ) : void Tests fetching user roles
testUserRolesCustomPivotTable ( ) : void Tests fetching user roles
testUserRolesMissingRoleColumn ( ) : void Tests single-role exception thrown when the roleColumn field is missing from the user table.
testUserRolesUserWithoutPivotRoles ( ) : void Tests multi-role when user has no roles in the pivot table.

Method Details

setUp() public method

public setUp ( ) : void
return void

testAdminMethodsAllowed() public method

TODO: also allow mapping of "prefix" => "role" for more flexibility
public testAdminMethodsAllowed ( ) : void
return void

testAvailableRoles() public method

Tests fetching available Roles from Configure and database
public testAvailableRoles ( ) : void
return void

testAvailableRolesEmptyTableException() public method

Tests exception thrown when the roles database table exists but contains no roles/records.

testAvailableRolesMissingTableException() public method

Tests exception thrown when no roles are in Configure AND the roles database table does not exist.

testBasicUserMethodAllowed() public method

public testBasicUserMethodAllowed ( ) : void
return void

testBasicUserMethodAllowedMultiRole() public method

Tests multi-role authorization.

testBasicUserMethodAllowedWildcard() public method

Note: users without a valid/defined role will not be granted access.

testBasicUserMethodAllowedWildcardSpecificGroup() public method

Tests access to a controller that uses the * wildcard for the action but combines it with a specific group (here: * = moderators).

testBasicUserMethodAllowedWithLongActionNames() public method

testBasicUserMethodAllowedWithLongActionNamesUnderscored() public method

testBasicUserMethodDisallowed() public method

testBasicUserMethodInexistentRole() public method

testCaseSensitivity() public method

Tests using incorrect casing, enforces strict acl.ini definitions.
public testCaseSensitivity ( ) : void
return void

testConstructor() public method

Test applying config in the constructor
public testConstructor ( ) : void
return void

testConstructorWithoutValidCache() public method

Tests exception thrown when Cache is unavailable.

testGetAcl() public method

public testGetAcl ( ) : void
return void

testIdColumnPivotTable() public method

Tests idColumn
public testIdColumnPivotTable ( ) : void
return void

testIniConstruct() public method

Tests constructing an ACL ini section key using CakeRequest parameters
public testIniConstruct ( ) : void
return void

testIniDeconstruct() public method

Tests deconstructing an ACL ini section key
public testIniDeconstruct ( ) : void
return void

testIniParsing() public method

Tests acl.ini parsing method.
public testIniParsing ( ) : void
return void

testIniParsingMissingFileException() public method

Tests exception thrown when no acl.ini exists.

testSuperAdmin() public method

Tests super admin
public testSuperAdmin ( ) : void
return void

testSuperAdminRole() public method

Tests superAdmin role, allowed to all actions
public testSuperAdminRole ( ) : void
return void

testUserMethodsAllowed() public method

Tests with configuration setting 'allowUser' set to true, giving user access to all controller/actions except when prefixed with /admin
public testUserMethodsAllowed ( ) : void
return void

testUserRoles() public method

Tests fetching user roles
public testUserRoles ( ) : void
return void

testUserRolesCustomPivotTable() public method

Tests fetching user roles

testUserRolesMissingRoleColumn() public method

Tests single-role exception thrown when the roleColumn field is missing from the user table.

testUserRolesUserWithoutPivotRoles() public method

Tests multi-role when user has no roles in the pivot table.

Property Details

$collection public_oe property

public ComponentRegistry,Cake\Controller $collection
return Cake\Controller\ComponentRegistry

$fixtures public_oe property

public array $fixtures
return array

$request public_oe property

public ServerRequest,Cake\Http|Request,Cake\Network $request
return Cake\Http\ServerRequest | Cake\Network\Request