Download the PHP package mezon/infrastructure-layer without Composer
On this page you can find all versions of the php package mezon/infrastructure-layer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mezon/infrastructure-layer
More information about mezon/infrastructure-layer
Files in mezon/infrastructure-layer
Package infrastructure-layer
Short Description Infrastructure layer
License MIT
Homepage https://github.com/alexdodonov/mezon-infrastructure-layer
Informations about the package infrastructure-layer
Infrastructure Layer
Intro
This class provides abstractions from basic infrastructure things wich can make you unit-testing harder. For example:
- console output
- file system operations
- GD library
- HTTP headers
- redirections
- sessions
- system methods
Basic concepts
Each abstraction can be setup to use either native function calls (such as file_get_contents) or mockups.
Mockuped calls can be used in your unit-tests. And native calls will be executed in production.
Let's see some real code examples:
In both calls Mezon\Fs\Layer::directoryExists
no real call of method file_exists
was performed.
No let's see what abstractions we have
Console layer
Class Mezon\Console\Layer
provides abstractions for working winth console
File system layer
This package also have abstractions for file systems routine:
In-memory file system
Almost all methods from \Mezon\Fs\Layer
in mock mode use \Mezon\Fs\InMemory
.
GD mocks
We also have mocks for some GD functions. Basically for those ones wich work with file system.
HTTP headers mocks
You can work with headers. Two methods for these purposes are provided:
Redirection mocks
You can mock redirects:
Session mocks
You can also mock session methods:
System methods mocks
You can also mock some system methods calls. Like die
for example: