PHP code example of dobrosite / phpunit-psr-logger

1. Go to this page and download the library: Download dobrosite/phpunit-psr-logger 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/ */

    

dobrosite / phpunit-psr-logger example snippets


use DobroSite\PHPUnit\PSR3\Symfony\TestLoggerForSymfony;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

final class SomeTest extends WebTestCase
{
    use TestLoggerForSymfony;

    public function testSomething(): void
    {
        $client = static::createClient();
        $crawler = $client->request('GET', '/api/foo');

        $this->assertResponseIsSuccessful();

        $this->getLogger()->getRecords()
            ->debug('Expected log message.')
            // …
            ->end;
    }
}