Bristol SU Support Package
Public Member Functions | Private Member Functions | Private Attributes | List of all members
BristolSU\Support\Testing\LogicTester\LogicTesterResult Class Reference

Public Member Functions

 pass ($userModel=null, $groupModel=null, $roleModel=null)
 
 fail ($userModel=null, $groupModel=null, $roleModel=null)
 
 shouldBeCalled ($userModel=null, $groupModel=null, $roleModel=null)
 
 otherwise (bool $value=true)
 
 alwaysPass ()
 
 alwaysFail ()
 
 evaluate ($userModel=null, $groupModel=null, $roleModel=null)
 
 __destruct ()
 

Private Member Functions

 parseArguments ($userModel=null, $groupModel=null, $roleModel=null)
 

Private Attributes

 $passes = []
 
 $fails = []
 
 $required = []
 
 $overrideResult
 
 $default = false
 

Detailed Description

Handles collecting and evaluating collections of user, group or role models

Definition at line 13 of file LogicTesterResult.php.

Constructor & Destructor Documentation

◆ __destruct()

BristolSU\Support\Testing\LogicTester\LogicTesterResult::__destruct ( )

Test the required assertions have all been called

Definition at line 165 of file LogicTesterResult.php.

Member Function Documentation

◆ alwaysFail()

BristolSU\Support\Testing\LogicTester\LogicTesterResult::alwaysFail ( )

Should the result of the evaluation always be false?

Definition at line 129 of file LogicTesterResult.php.

◆ alwaysPass()

BristolSU\Support\Testing\LogicTester\LogicTesterResult::alwaysPass ( )

Should the result of the evaluation always be true?

Definition at line 121 of file LogicTesterResult.php.

◆ evaluate()

BristolSU\Support\Testing\LogicTester\LogicTesterResult::evaluate (   $userModel = null,
  $groupModel = null,
  $roleModel = null 
)

Evaluate a user/group/role combination

Parameters
User | null$userModelUser model
Group | null$groupModelGroup model
Role | null$roleModelRole model
Returns
bool

Definition at line 142 of file LogicTesterResult.php.

References BristolSU\Support\Testing\LogicTester\LogicTesterResult\$default, BristolSU\Support\Testing\LogicTester\LogicTesterResult\$overrideResult, and BristolSU\Support\Testing\LogicTester\LogicTesterResult\parseArguments().

◆ fail()

BristolSU\Support\Testing\LogicTester\LogicTesterResult::fail (   $userModel = null,
  $groupModel = null,
  $roleModel = null 
)

The given combination of user, group and role should return false when tested

Parameters
User | null$userModelUser model
Group | null$groupModelGroup model
Role | null$roleModelRole model
Returns
$this

Definition at line 86 of file LogicTesterResult.php.

References BristolSU\Support\Testing\LogicTester\LogicTesterResult\parseArguments().

◆ otherwise()

BristolSU\Support\Testing\LogicTester\LogicTesterResult::otherwise ( bool  $value = true)

Set the default value if a user/group/role are given that haven't been previously registered

Parameters
bool$valueDefault value to return
Returns
LogicTesterResult

Definition at line 112 of file LogicTesterResult.php.

◆ parseArguments()

BristolSU\Support\Testing\LogicTester\LogicTesterResult::parseArguments (   $userModel = null,
  $groupModel = null,
  $roleModel = null 
)
private

Return an array of the user id, group id and role id.

Parameters
User | null$userModelUser model
Group | null$groupModelGroup model
Role | null$roleModelRole model
Returns
array

Definition at line 73 of file LogicTesterResult.php.

Referenced by BristolSU\Support\Testing\LogicTester\LogicTesterResult\evaluate(), BristolSU\Support\Testing\LogicTester\LogicTesterResult\fail(), BristolSU\Support\Testing\LogicTester\LogicTesterResult\pass(), and BristolSU\Support\Testing\LogicTester\LogicTesterResult\shouldBeCalled().

◆ pass()

BristolSU\Support\Testing\LogicTester\LogicTesterResult::pass (   $userModel = null,
  $groupModel = null,
  $roleModel = null 
)

The given combination of user, group and role should return true when tested

Parameters
User | null$userModelUser model
Group | null$groupModelGroup model
Role | null$roleModelRole model
Returns
$this

Definition at line 59 of file LogicTesterResult.php.

References BristolSU\Support\Testing\LogicTester\LogicTesterResult\parseArguments().

◆ shouldBeCalled()

BristolSU\Support\Testing\LogicTester\LogicTesterResult::shouldBeCalled (   $userModel = null,
  $groupModel = null,
  $roleModel = null 
)

The given combination must be called for the assertion to pass

Parameters
User | null$userModelUser model
Group | null$groupModelGroup model
Role | null$roleModelRole model
Returns
$this

Definition at line 100 of file LogicTesterResult.php.

References BristolSU\Support\Testing\LogicTester\LogicTesterResult\parseArguments().

Member Data Documentation

◆ $default

BristolSU\Support\Testing\LogicTester\LogicTesterResult::$default = false
private

◆ $fails

BristolSU\Support\Testing\LogicTester\LogicTesterResult::$fails = []
private

Definition at line 28 of file LogicTesterResult.php.

◆ $overrideResult

BristolSU\Support\Testing\LogicTester\LogicTesterResult::$overrideResult
private

◆ $passes

BristolSU\Support\Testing\LogicTester\LogicTesterResult::$passes = []
private

Definition at line 21 of file LogicTesterResult.php.

◆ $required

BristolSU\Support\Testing\LogicTester\LogicTesterResult::$required = []
private

Definition at line 35 of file LogicTesterResult.php.


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