PHP Class Cascade\Tests\Config\Loader\ClassLoader\Resolver\ConstructorResolverTest

Author: Raphael Antonmattei ([email protected])
Inheritance: extends PHPUnit_Framework_TestCase
Datei anzeigen Open project: theorchard/monolog-cascade

Protected Properties

Property Type Description
$reflected ReflectionClass Reflection class for which you want to resolve extra options
$resolver Cascade\Config\Loader\ClassLoader\Resolver\ConstructorResolver Constructor Resolver

Public Methods

Method Description
invalidOptionsProvider ( ) : array Data provider for testResolveWithInvalidOptions
missingOptionsProvider ( ) : array Data provider for testResolveWithInvalidOptions.
optionsProvider ( ) : array Data provider for testResolve
setUp ( ) Set up function
tearDown ( ) Tear down function
testConstructor ( ) Test the resolver contructor
testHashToArgsArray ( ) Test the hashToArgsArray function
testInitConstructorArgs ( ) Test that constructor args were pulled properly
testResolve ( array $expectedResolvedOptions, array $options ) Test resolving with valid options
testResolveWithInvalidOptions ( array $invalidOptions ) Test resolving with invalid options. It should throw an exception.
testResolveWithMissingOptions ( array $incompleteOptions ) Test resolving with missing/incomplete options. It should throw an exception.

Protected Methods

Method Description
getConstructorArgs ( ) : ReflectionParameter[] Return the contructor args of the reflected class

Method Details

getConstructorArgs() protected method

Return the contructor args of the reflected class
protected getConstructorArgs ( ) : ReflectionParameter[]
return ReflectionParameter[] array of params

invalidOptionsProvider() public method

The order of the input options does not matter and is somewhat random. The resolution should reconcile those options and match them up with the contructor param position
public invalidOptionsProvider ( ) : array
return array of arrays with expected resolved values and options used as input

missingOptionsProvider() public method

The order of the input options does not matter and is somewhat random. The resolution should reconcile those options and match them up with the contructor param position
public missingOptionsProvider ( ) : array
return array of arrays with expected resolved values and options used as input

optionsProvider() public method

The order of the input options does not matter and is somewhat random. The resolution should reconcile those options and match them up with the contructor param position
public optionsProvider ( ) : array
return array of arrays with expected resolved values and options used as input

setUp() public method

Set up function
public setUp ( )

tearDown() public method

Tear down function
public tearDown ( )

testConstructor() public method

Test the resolver contructor
public testConstructor ( )

testHashToArgsArray() public method

Test the hashToArgsArray function
public testHashToArgsArray ( )

testInitConstructorArgs() public method

Note that we need to deuplicate the CamelCase conversion here for old fashioned classes

testResolve() public method

Test resolving with valid options
public testResolve ( array $expectedResolvedOptions, array $options )
$expectedResolvedOptions array Array of expected resolved options (i.e. parsed and validated)
$options array Array of raw options

testResolveWithInvalidOptions() public method

Test resolving with invalid options. It should throw an exception.
public testResolveWithInvalidOptions ( array $invalidOptions )
$invalidOptions array Array of invalid options

testResolveWithMissingOptions() public method

Test resolving with missing/incomplete options. It should throw an exception.
public testResolveWithMissingOptions ( array $incompleteOptions )
$incompleteOptions array Array of invalid options

Property Details

$reflected protected_oe property

Reflection class for which you want to resolve extra options
protected ReflectionClass $reflected
return ReflectionClass

$resolver protected_oe property

Constructor Resolver
protected ConstructorResolver,Cascade\Config\Loader\ClassLoader\Resolver $resolver
return Cascade\Config\Loader\ClassLoader\Resolver\ConstructorResolver