Skip to content

This library extends PHPUnit with asserting from Monolog logging entries.

License

Notifications You must be signed in to change notification settings

phoenixrvd/phpunit-assert-log-entry

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHPUnit assert log entry

Minimum PHP Version Latest Stable Version composer.lock License

Build Status Code Climate StyleCI Test Coverage Latest Unstable Version

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.