Detailed Description
TestUtil provides helper methods for testing wCMF functionality.
Definition at line 26 of file TestUtil.php.
Static Public Member Functions | |
static | initFramework ($configPath) |
static | createDatabase () |
static | startServer ($documentRoot, $router='') |
static | simulateRequest ($request) |
static | startSession ($user, $password) |
static | endSession () |
static | setConfigValue ($key, $value, $section) |
static | callProtectedMethod ($instance, $methodName, $args=null) |
static | getSizeof ($var) |
static | enableProfiler ($type) |
static | printProfile ($type) |
static | isWindows () |
Member Function Documentation
|
static |
Set up the wcmf framework.
The method makes the following assumptions about file locations:
- main configuration in $configPath.'config.ini'
- optional additional configuration in $configPath.'test.ini'
- logging configuration in $configPath.'log.ini'
- Parameters
-
$configPath The path to the configuration directory
Definition at line 36 of file TestUtil.php.
|
static |
Create the test database, if sqlite is configured.
- Returns
- Associative array with connection parameters and key 'connection'
Definition at line 63 of file TestUtil.php.
|
static |
Start the built-in webserver.
- Parameters
-
$documentRoot Document root directory $router Router script filename (optional)
Definition at line 88 of file TestUtil.php.
|
static |
Process a request as if it was sent to main.php.
- Parameters
-
$request The Request instance
- Returns
- The Response instance (result of the last ActionMapper::processAction() call)
Definition at line 134 of file TestUtil.php.
|
static |
Start a session.
This is usefull for simulateRequest calls
- Parameters
-
$user The name of the user $password The password of the user
- Returns
- The session id. Use this as data['sid'] parameter for subsequent simulateRequest calls
Definition at line 153 of file TestUtil.php.
|
static |
End a session.
Definition at line 170 of file TestUtil.php.
|
static |
Set a configuration value.
- See also
- Configuration::setValue()
Definition at line 180 of file TestUtil.php.
|
static |
Call a protected/private method of an instance (PHP >= 5.3.2)
- Parameters
-
$instance The instance $methodName The method name $args An array of method arguments
Definition at line 191 of file TestUtil.php.
|
static |
Definition at line 205 of file TestUtil.php.
|
static |
Enable the Zend_Db_Profiler for a given entity type.
- Parameters
-
$type The entity type
Definition at line 215 of file TestUtil.php.
|
static |
Print the profile of the operations on a given entity type.
The profiler must have been enabled first
- Parameters
-
$type The entity type
Definition at line 227 of file TestUtil.php.
|
static |
Definition at line 254 of file TestUtil.php.