Download the PHP package phrity/net-mock without Composer
On this page you can find all versions of the php package phrity/net-mock. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download phrity/net-mock
More information about phrity/net-mock
Files in phrity/net-mock
Package net-mock
Short Description Mock layer for phrity/net-stream
License MIT
Homepage https://phrity.sirn.se/
Informations about the package net-mock
Introduction
Writing tests that use streams is problematic. This library provides a mocking layer for phrity/net-stream, allowing developers to verify and mock stream interactions.
Installation
Install with Composer;
Usage
The classes in this library are fully compatible with those of the net-stream library. By default, calling the mock classes will propagate into the real implementation classes.
Log interactions
By adding a PSR-3 compatible logger, all calls will be logged. The library includes a simple EchoLogger, but any compatible logger is usable.
Mock interactions
By registring a callback handler, all calls will pass through the callback instead.
Expect stack in PhpUnit tests
All methods have correspondent expectations that can be used in PhpUnit tests. Classes are imported as Traits, and methods are named by keyword + class name + method name.
To assert input
To overwrite return
Versions
Version | PHP | |
---|---|---|
2.3 |
^8.1 |
phrity/net-stream v2.3 |
2.2 |
^8.1 |
phrity/net-stream v2.2 |
2.1 |
^8.0 |
phrity/net-stream v2.1 |
2.0 |
^8.0 |
phrity/net-stream v2.0 |
1.3 |
^7.4\|^8.0 |
phrity/net-stream v1.3 |
1.2 |
^7.4\|^8.0 |
phrity/net-stream v1.2 |
1.1 |
^7.4\|^8.0 |
phrity/net-stream v1.1 |
1.0 |
^7.4\|^8.0 |
phrity/net-stream v1.0 |
All versions of net-mock with dependencies
phrity/net-stream Version ~2.3.0
phrity/net-uri Version ^2.0
psr/log Version ^1.1 | ^2.0 | ^3.0