PHP Класс Phergie_Plugin_TestCase, phergie

Автор: Phergie Development Team ([email protected])
Наследование: extends PHPUnit_Framework_TestCase
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$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

Открытые методы

Метод Описание
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.

Защищенные методы

Метод Описание
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().

Описание методов

assertDoesNotEmitEvent() защищенный Метод

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
Результат void

assertEmitsEvent() защищенный Метод

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
Результат void

assertRemovesPlugin() публичный Метод

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
Результат void

assertRequiresPlugin() публичный Метод

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
Результат void

getMockDatabase() публичный Метод

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
Результат PDO Connection to the database copy

getPluginsPath() защищенный Метод

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
Результат string Directory path

removePlugin() публичный Метод

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
Результат void

requirePlugin() публичный Метод

Records an actual plugin requirement.
public requirePlugin ( string $name ) : Phergie_Plugin_Abstract
$name string Short name of the plugin required as a dependency
Результат Phergie_Plugin_Abstract Mock instance of the specified plugin

setUp() публичный Метод

Initializes instance properties.
public setUp ( ) : void
Результат void

tearDown() публичный Метод

Destroys all initialized instance properties.
public tearDown ( ) : void
Результат void

Описание свойств

$plugin защищенное свойство

Plugin instance being tested
protected Phergie_Plugin_Abstract $plugin
Результат Phergie_Plugin_Abstract

$pluginClass защищенное свойство

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
Результат string