PHP Class lithium\console\command\Test

See also: lithium\test
Inheritance: extends lithium\console\Command
Datei anzeigen Open project: unionofrad/lithium Class Usage Examples

Public Properties

Property Type Description
$filters For example: sh lithium test lithium/tests/cases/core/ObjectTest.php --filters=Coverage lithium test lithium/tests/cases/core/ObjectTest.php --filters=Coverage,Profiler
$format Format to use for rendering results. Any other format than txt will cause the command to enter quiet mode, surpressing headers and any other decoration.
$plain boolean Good for command calls embedded into other scripts.
$verbose boolean Enable verbose output especially for the txt format.

Protected Properties

Property Type Description
$_handlers array An array of closures, mapped by type, which are set up to handle different test output formats.

Public Methods

Method Description
run ( string $path = null ) : integer | boolean Runs tests given a path to a directory or file containing tests. The path to the test(s) may be absolute or relative to the current working directory.

Protected Methods

Method Description
_init ( ) : void Initializes the output handlers.
_library ( string $path ) : string Finds a library for given path.
_path ( string $path ) : string Validates and gets a fully-namespaced class path from an absolute or relative physical path to a directory or file. The final class path may be partial in that in doesn't contain the class name.

Method Details

_init() protected method

Initializes the output handlers.
See also: lithium\console\command\Test::$_handlers
protected _init ( ) : void
return void

_library() protected method

Finds a library for given path.
protected _library ( string $path ) : string
$path string Normalized (to slashes) absolute or relative path.
return string the name of the library

_path() protected method

This method can be thought of the reverse of Libraries::path(). lithium/tests/cases/core/ObjectTest.php -> lithium\tests\cases\core\ObjectTest lithium/tests/cases/core -> lithium\tests\cases\core lithium/core/Object.php -> lithium\core\Object lithium/core/ -> lithium\core lithium/core -> lithium\core
See also: lithium\core\Libraries::path()
protected _path ( string $path ) : string
$path string The directory of or file path to one or more classes.
return string Returns a fully-namespaced class path, or `false`, if an error occurs.

run() public method

sh li3 test lithium/tests/cases/core/ObjectTest.php li3 test lithium/tests/cases/core If you are in the working directory of an application or plugin and wish to run all tests, simply execute the following: sh li3 test tests/cases If you are in the working directory of an application and wish to run a plugin, execute one of the following: sh li3 test libraries//tests/cases li3 test /tests/cases This will run /tests/cases//Test.php: sh li3 test //.php
public run ( string $path = null ) : integer | boolean
$path string Absolute or relative path to tests or a file which corresponding test should be run.
return integer | boolean Will (indirectly) exit with status `1` if one or more tests failed otherwise with `0`.

Property Details

$_handlers protected_oe property

An array of closures, mapped by type, which are set up to handle different test output formats.
protected array $_handlers
return array

$filters public_oe property

For example: sh lithium test lithium/tests/cases/core/ObjectTest.php --filters=Coverage lithium test lithium/tests/cases/core/ObjectTest.php --filters=Coverage,Profiler
public $filters

$format public_oe property

Format to use for rendering results. Any other format than txt will cause the command to enter quiet mode, surpressing headers and any other decoration.
public $format

$plain public_oe property

Good for command calls embedded into other scripts.
public bool $plain
return boolean

$verbose public_oe property

Enable verbose output especially for the txt format.
public bool $verbose
return boolean