CrossCuttingLoader

Implements \CrossCuttingLoaderInterface

Class CrossCuttingLoader

CrossCuttingLoader enables loading of mockable objects for cross cutting concerns, that were not injected to the current object.

Important: RegisteredObjectsOnly flag must be enabled for unit testing.

category

System

package

Loaders

subpackage

CrossCuttingLoader

Methods

clearRegister

clearRegister() : void

In strict mode ($strictModeEnabled=true) this method accepts classes with implemented CrossCuttingObjectInterface only. Otherwise it throws an InvalidArgumentException.

getObject(string $p_classname) : object
Throws
\InvalidArgumentException

Arguments

$p_classname

string

Response

object

In strict mode ($strictModeEnabled=true) this method accepts classes with implemented CrossCuttingObjectInterface only. Otherwise it throws an InvalidArgumentException.

registerObject(string $p_classname, object $object) 
Throws
\InvalidArgumentException

Arguments

$p_classname

string

$object

object

RegisteredObjectsOnly Flag Setter

setRegisteredObjectsOnly(boolean $bool_status) 

If RegisteredObjectsOnly is enabled, the loader returns only objects, that were registered by the registerObject method before. RegisteredObjectsOnly should be enabled in all unit tests.

Arguments

$bool_status

boolean

RegisteredObjectsOnly Flag Getter

useRegisteredObjectsOnly() : boolean

Response

boolean

Properties