Drupal 8  8.0.2
UserSessionTest Class Reference
Inheritance diagram for UserSessionTest:

Public Member Functions

 providerTestHasPermission ()
 
 testHasPermission ($permission, array $sessions_with_access, array $sessions_without_access)
 
 testUserGetRoles ()
 
- Public Member Functions inherited from UnitTestCase
 randomMachineName ($length=8)
 
 getConfigFactoryStub (array $configs=array())
 
 getConfigStorageStub (array $configs)
 
 getStringTranslationStub ()
 

Protected Member Functions

 createUserSession (array $rids=array(), $authenticated=FALSE)
 
 setUp ()
 
- Protected Member Functions inherited from UnitTestCase
 setUp ()
 
 getRandomGenerator ()
 
 assertArrayEquals (array $expected, array $actual, $message=NULL)
 
 getBlockMockWithMachineName ($machine_name)
 
 getContainerWithCacheTagsInvalidator (CacheTagsInvalidatorInterface $cache_tags_validator)
 
 getClassResolverStub ()
 

Protected Attributes

 $users = array()
 
- Protected Attributes inherited from UnitTestCase
 $randomGenerator
 
 $root
 

Detailed Description

Session

Member Function Documentation

createUserSession ( array  $rids = array(),
  $authenticated = FALSE 
)
protected

Setups a user session for the test.

Parameters
array$ridsThe rids of the user.
bool$authenticatedTRUE if it is an authenticated user.
Returns
The created user session.

References RoleInterface\ANONYMOUS_ID, and RoleInterface\AUTHENTICATED_ID.

Referenced by UserSessionTest\setUp().

Here is the caller graph for this function:

providerTestHasPermission ( )

Provides test data for getHasPermission().

Returns
array
setUp ( )
protected

{}

References UserSessionTest\createUserSession(), and Drupal\setContainer().

Here is the call graph for this function:

testHasPermission (   $permission,
array  $sessions_with_access,
array  $sessions_without_access 
)

Tests the has permission method.

Parameters
string$permissionThe permission to check.
\Drupal\Core\Session\AccountInterface[]$sessions_with_access The users with access.
\Drupal\Core\Session\AccountInterface[]$sessions_without_access The users without access.

providerTestHasPermission

See Also
::hasPermission().
testUserGetRoles ( )

Tests the method getRoles exclude or include locked roles based in param.

::getRoles

Todo:
Move roles constants to a class/interface

References RoleInterface\AUTHENTICATED_ID.


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