for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace EcodevTests\Felix\Log\Writer;
use Ecodev\Felix\Log\EventCompleter;
use Ecodev\Felix\Log\Writer\Db;
use Ecodev\Felix\Repository\LogRepository;
use PHPUnit\Framework\TestCase;
class DbTest extends TestCase
{
public function testWriteCompletedEventInDb(): void
$event = ['message' => 'original'];
$completedEvent = ['message' => 'completed'];
$logRepository = self::createMock(LogRepository::class);
PHPUnit\Framework\TestCase::createMock()
If this is a false-positive, you can also ignore this issue in your code via the ignore-call annotation
ignore-call
/** @scrutinizer ignore-call */
$logRepository->expects(self::once())
->method('log')
->with($completedEvent);
$eventCompleter = self::createMock(EventCompleter::class);
$eventCompleter->expects(self::once())
->method('process')
->with($event)
->willReturn($completedEvent);
$writer = new Db($logRepository, $eventCompleter);
$writer->write($event);
}