raigu/psr3-log-spy

This package is not installable via Composer 1.x, please make sure you upgrade to Composer 2+. Read more about our Composer 1.x deprecation policy.

Spy of PSR-3 LoggerInterface for testing

v0.1.1 2021-08-29 17:33 UTC

This package is auto-updated.

Last update: 2021-10-29 17:48:07 UTC


README

Latest Stable Version Fallows SemVer build codecov License: MIT

psr3-log-spy

An implementation of PSR-3 LoggerInterface for spying on a subject under test (SUT) to verify that the SUT is using the given logger.

Compatibility

  • PHP 7.4, ^8.0
  • psr/log ^1.1||2.0.0

Changes

./CHANGELOG.md

Install

$ composer require --dev raigu/psr3-log-spy

Usage

$spy = new \Raigu\TestDouble\Psr3\LoggerSpy();

$sut = new Foo($spy);
$sut->bar();

assert($spy->any());

Methods

Method Description
any at least one message was logged
anyEmergency at least one emergency message was logged
anyAlert at least one alert message was logged
anyCritical at least one critical message was logged
anyError at least one error message was logged
anyWarning at least one warning message was logged
anyNotice at least one notice message was logged
anyInfo at least one info message was logged
anyDebug at least on debug message was logged

Testing

$ composer test
$ composer specification 
$ composer coverage