\Horde_Test_Setup

A test helper for generating complex test setups.

Copyright 2011-2017 Horde LLC (http://www.horde.org/)

See the enclosed file LICENSE for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.

Summary

Methods
Properties
Constants
__construct()
setup()
add()
makeGlobal()
getError()
getInjector()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
$_injector
$_error
$_params
N/A

Properties

$_injector

$_injector : \Horde_Injector

The Horde_Injector instance which serves as our service container.

Type

\Horde_Injector

$_error

$_error : string

In case the setup turns out to be unfullfillable this should contain an appropriate message indicating the problem.

Type

string

$_params

$_params : string

Global parameters that apply to several factories.

Type

string

Methods

__construct()

__construct() 

Constructor.

setup()

setup(array  $params) : NULL

Add a new set of elements to the service container.

Parameters

array $params

All parameters necessary for creating the services. The keys of the array elements define the name that will be used for registering the test service with the injector. The element values are a configuration array with the following elements:

'factory' - (string) Name of the factory. Can be a full class name or an
            abbreviated name that will get prepended with
            'Horde_Test_Factory_'
'method' - (string) Method name that will be invoked on the above factory
           to generate the test service.
'params' - (array) Any parameters the factory method might require for
           generating the test service. See the various factories/methods
           for details.

Returns

NULL

add()

add(  $interface, string  $factory, string  $method, array  $params) : NULL

Add a new element to the service container.

Parameters

$interface
string $factory

The (abbreviated) name of the factory.

string $method

The factory method that will generate the service.

array $params

All parameters necessary for creating the service.

Returns

NULL

makeGlobal()

makeGlobal(array  $elements) : NULL

Export elements from the injector into global scope.

Parameters

array $elements

The elements to export.

Returns

NULL

getError()

getError() : string

Return any potential setup error.

Returns

string —

The error.

getInjector()

getInjector() : \Horde_Injector

Return the service container.

Returns

\Horde_Injector —

The injector.