Download the PHP package eloquent/peridot-phony without Composer
On this page you can find all versions of the php package eloquent/peridot-phony. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package peridot-phony
No longer maintained
This package is no longer maintained. See [this statement] for more info.
[this statement]: https://gist.github.com/ezzatron/713a548735febe3d76f8ca831bc895c0# Phony for PHPUnit
Phony for Peridot
Installation
composer require --dev eloquent/phony-peridot
See also
- Read the documentation.
- Read the Peridot documentation.
- Visit the main Phony repository.
What is Phony for Peridot?
Phony for Peridot is a plugin for the Peridot testing framework that provides auto-wired test dependencies via the Phony mocking framework.
In other words, if a Peridot test (or suite) requires a mock object, it can be defined to have a parameter with an appropriate type declaration, and it will automatically receive a mock of that type as an argument when run.
Stubs for callable
types, and "empty" values for other type declarations are
also supported.
Plugin installation
The plugin must be installed in the Peridot configuration file:
Dependency injection
Once the plugin is installed, any tests or suites that are defined with parameters will be supplied with matching arguments when run:
Injected mock objects
Phony for Peridot supports automatic injection of mock objects. Because
Phony doesn't alter the interface of mocked objects, it is necessary to use
on()
to retrieve the mock handle in order to perform stubbing and
verification:
Injected stubs
Phony for Peridot supports automatic injection of stubs for parameters with
a callable
type declaration:
Supported types
The following table lists the supported type declarations, and the value supplied for each:
Parameter type | Supplied value |
---|---|
(none) | null |
bool |
false |
int |
0 |
float |
.0 |
string |
'' |
array |
[] |
stdClass |
(object) [] |
callable |
stub() |
Closure |
function () {} |
Generator |
(function () {return; yield;})() |
When using a type declaration that is not listed above, the supplied value will be a mock of the specified type.
By necessity, the supplied value will not be wrapped in a mock handle. In
order to obtain a handle, simply use on()
:
License
For the full copyright and license information, please view the LICENSE file.