phoenixrvd / phpunit-assert-log-entry
PHPUnit assertions for Monolog-TestHandler
1.0.2
2017-09-11 07:48 UTC
Requires
- monolog/monolog: ^1.23
- phpunit/phpunit: ~5.6||^6.3
Requires (Dev)
- codeclimate/php-test-reporter: dev-master
This package is auto-updated.
Last update: 2025-03-12 07:18:55 UTC
README
This library extends PHPUnit with asserting from Monolog logging entries.
Installation
Install the latest version with
composer require phoenixrvd/phpunit-assert-log-entry
Example
<?php use PHPUnit\Framework\TestCase; class LogAssertionsTest extends TestCase { use \PhoenixRVD\PHPUnitLogAssertions\LogAssertions; public function testFoo(){ // Get a Monolog instance $logger = new \Monolog\Logger(__CLASS__); // Register a logger in test case handler self::attachLogger($logger); $logger->debug('foo'); self::assertLogHasDebugRecords(); self::assertLogHasDebug('foo'); } }
Testing
composer phpunit_log_assertions:test
Copyright and license
Code released under the MIT License.