PHP code example of phoenixrvd / phpunit-assert-log-entry
1. Go to this page and download the library: Download phoenixrvd/phpunit-assert-log-entry library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
phoenixrvd / phpunit-assert-log-entry example snippets
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');
}
}