PHP Class Phergie_Plugin_TestCase, phergie

Author: Phergie Development Team ([email protected])
Inheritance: extends PHPUnit_Framework_TestCase
Afficher le fichier Open project: phergie/phergie Class Usage Examples

Protected Properties

Свойство Type Description
$plugin Phergie_Plugin_Abstract Plugin instance being tested
$pluginClass string Full name of the plugin class being tested, may be explicitly specified in subclasses but is otherwise automatically derived from the test case class name

Méthodes publiques

Méthode Description
assertRemovesPlugin ( string | Phergie_Plugin_Abstract | array $plugin ) : void Modifies the plugin handler to include an expectation of a plugin being removed. Note that this must be called BEFORE executing the plugin code that may remove that plugin.
assertRequiresPlugin ( string | array $name ) : void Modifies the plugin handler to include an expectation of a plugin being retrieved, indicating a dependency. Note that this must be called BEFORE executing the plugin code that may load that plugin dependency, which is usually located in onLoad().
getMockDatabase ( string $path ) : PDO Creates an in-memory copy of a specified SQLite database file and returns a connection to it.
removePlugin ( string | Phergie_Plugin_Abstract $plugin ) : void Records an actual plugin removal.
requirePlugin ( string $name ) : Phergie_Plugin_Abstract Records an actual plugin requirement.
setUp ( ) : void Initializes instance properties.
tearDown ( ) : void Destroys all initialized instance properties.

Méthodes protégées

Méthode Description
assertDoesNotEmitEvent ( string $type, array $args = [] ) : void Modifies the event handler to include an expectation of an event NOT being added by the plugin being tested. Note that this must be called BEFORE executing plugin code that may initiate the event.
assertEmitsEvent ( string $type, array $args = [] ) : void Modifies the event handler to include an expectation of an event being added by the plugin being tested. Note that this must be called BEFORE executing the plugin code intended to initiate the event.
getPluginsPath ( string $subpath = null ) : string Returns the absolute path to the Phergie/Plugin directory. Useful in conjunction with getMockDatabase().

Method Details

assertDoesNotEmitEvent() protected méthode

Modifies the event handler to include an expectation of an event NOT being added by the plugin being tested. Note that this must be called BEFORE executing plugin code that may initiate the event.
protected assertDoesNotEmitEvent ( string $type, array $args = [] ) : void
$type string Event type
$args array Optional enumerated array of event arguments
Résultat void

assertEmitsEvent() protected méthode

Modifies the event handler to include an expectation of an event being added by the plugin being tested. Note that this must be called BEFORE executing the plugin code intended to initiate the event.
protected assertEmitsEvent ( string $type, array $args = [] ) : void
$type string Event type
$args array Optional enumerated array of event arguments
Résultat void

assertRemovesPlugin() public méthode

Modifies the plugin handler to include an expectation of a plugin being removed. Note that this must be called BEFORE executing the plugin code that may remove that plugin.
public assertRemovesPlugin ( string | Phergie_Plugin_Abstract | array $plugin ) : void
$plugin string | Phergie_Plugin_Abstract | array Short name of the plugin or the plugin instance to be removed or an array of multiple instances of either
Résultat void

assertRequiresPlugin() public méthode

Modifies the plugin handler to include an expectation of a plugin being retrieved, indicating a dependency. Note that this must be called BEFORE executing the plugin code that may load that plugin dependency, which is usually located in onLoad().
public assertRequiresPlugin ( string | array $name ) : void
$name string | array Short name of the plugin required as a dependency or an array containing multiple instances thereof
Résultat void

getMockDatabase() public méthode

Creates an in-memory copy of a specified SQLite database file and returns a connection to it.
public getMockDatabase ( string $path ) : PDO
$path string Path to the SQLite file to copy
Résultat PDO Connection to the database copy

getPluginsPath() protected méthode

Returns the absolute path to the Phergie/Plugin directory. Useful in conjunction with getMockDatabase().
protected getPluginsPath ( string $subpath = null ) : string
$subpath string Optional path to append to the directory path
Résultat string Directory path

removePlugin() public méthode

Records an actual plugin removal.
public removePlugin ( string | Phergie_Plugin_Abstract $plugin ) : void
$plugin string | Phergie_Plugin_Abstract Short name of the plugin or the plugin instance to be removed
Résultat void

requirePlugin() public méthode

Records an actual plugin requirement.
public requirePlugin ( string $name ) : Phergie_Plugin_Abstract
$name string Short name of the plugin required as a dependency
Résultat Phergie_Plugin_Abstract Mock instance of the specified plugin

setUp() public méthode

Initializes instance properties.
public setUp ( ) : void
Résultat void

tearDown() public méthode

Destroys all initialized instance properties.
public tearDown ( ) : void
Résultat void

Property Details

$plugin protected_oe property

Plugin instance being tested
protected Phergie_Plugin_Abstract $plugin
Résultat Phergie_Plugin_Abstract

$pluginClass protected_oe property

Full name of the plugin class being tested, may be explicitly specified in subclasses but is otherwise automatically derived from the test case class name
protected string $pluginClass
Résultat string