Documentation

Setup
in package

A test helper for generating complex test setups.

Copyright 2011-2021 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.

Tags
category

Horde

author

Gunnar Wrobel wrobel@pardus.de

license

http://www.horde.org/licenses/lgpl21 LGPL

link
http://www.horde.org/components/Horde_Test

Table of Contents

$error  : string
In case the setup turns out to be unfullfillable this should contain an appropriate message indicating the problem.
$injector  : Injector
The Injector instance which serves as our service container.
$params  : string
Global parameters that apply to several factories.
__construct()  : mixed
Constructor.
add()  : void
Add a new element to the service container.
getError()  : string
Return any potential setup error.
getInjector()  : Injector
Return the service container.
makeGlobal()  : void
Export elements from the injector into global scope.
setup()  : void
Add a new set of elements to the service container.

Properties

$error

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

private string $error

$injector

The Injector instance which serves as our service container.

private Injector $injector

$params

Global parameters that apply to several factories.

private string $params = []

Methods

__construct()

Constructor.

public __construct() : mixed
Return values
mixed

add()

Add a new element to the service container.

public add(string $interface, string $factory, string $method, array<string|int, mixed> $params) : void
Parameters
$interface : string
$factory : string

The (abbreviated) name of the factory.

$method : string

The factory method that will generate the service.

$params : array<string|int, mixed>

All parameters necessary for creating the service.

Tags
oaram

string $interface The interface name to register the service with.

Return values
void

getError()

Return any potential setup error.

public getError() : string
Return values
string

The error.

getInjector()

Return the service container.

public getInjector() : Injector
Return values
Injector

The injector.

makeGlobal()

Export elements from the injector into global scope.

public makeGlobal(array<string|int, mixed> $elements) : void
Parameters
$elements : array<string|int, mixed>

The elements to export.

Return values
void

setup()

Add a new set of elements to the service container.

public setup(array<string|int, mixed> $params) : void
Parameters
$params : array<string|int, mixed>

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.
Return values
void

Search results