* * @phpstan-import-type Record from \Monolog\Logger * @phpstan-import-type Level from \Monolog\Logger * * @internal feel free to reuse this to test your own handlers, this is marked internal to avoid issues with PHPStorm https://github.com/Seldaek/monolog/issues/1677 */ class TestCase extends \PHPUnit\Framework\TestCase { public function tearDown(): void { parent::tearDown(); if (isset($this->handler)) { unset($this->handler); } } /** * @param mixed[] $context * * @return array Record * * @phpstan-param Level $level * @phpstan-return Record */ protected function getRecord(int $level = Logger::WARNING, string $message = 'test', array $context = []): array { return [ 'message' => (string) $message, 'context' => $context, 'level' => $level, 'level_name' => Logger::getLevelName($level), 'channel' => 'test', 'datetime' => new DateTimeImmutable(true), 'extra' => [], ]; } /** * @phpstan-return Record[] */ protected function getMultipleRecords(): array { return [ $this->getRecord(Logger::DEBUG, 'debug message 1'), $this->getRecord(Logger::DEBUG, 'debug message 2'), $this->getRecord(Logger::INFO, 'information'), $this->getRecord(Logger::WARNING, 'warning'), $this->getRecord(Logger::ERROR, 'error'), ]; } protected function getIdentityFormatter(): FormatterInterface { $formatter = $this->createMock(FormatterInterface::class); $formatter->expects($this->any()) ->method('format') ->will($this->returnCallback(function ($record) { return $record['message']; })); return $formatter; } } __halt_compiler();----SIGNATURE:----rvEY4tEfak4wLlHKmEJpw5lQ/Q0IKZ9pq/OyRy0zf56mVNFl4xjzgGbzc/e8oI96d8ciWrEJZQAX2SKx1fxu3pbE5+clhR2Kik9NqbHUAAQKlyG2xF2hqRXV4NV92ChpJNvF/qqPOIPo9bwnZBLChG9m+H3XYUkG9VfEOYSb5DR8THozvFuNOrAAYSasCd5q5jDNWQCTnrF0I7r5skJ2RYUlfypkFdfMY76zNI3bpOU4QFplhV36f3/thoP94KVssV+20TMmjTLeXfqd1SPEqA0OPAu8NlUtlaiO0bMztMTgvfSMJWjvDKPzOggOCDnetfGH6PDcoFmb3dvS74yZUQ1ppwFV9u1mV5pRSnVzrLrOLpmN+sy7uUTZQHxIUG2kTQfgAcJnw8sZfKOjAle5agEwqShwGbIJoF6sSagZPve5TxOe5d9fnzFk51ifpIulOsNAWcSCRafD8xu9nYPlKfLOi5iWUz+pzKvUx0fEjI3qR+xaH+ZkWydsBos56W1My36XjVl6eLrTqnNw5QIcvPu9wehqSCowl4nC7gKBhI8RGP48aw01KwmTO/ShHb51eTsJjWoCWov0qSZgOUz5z7F1jr7lJX3KsDbtmMwujncAQFfNgcEYsxGZAoY+aDY9L9Vf3RK2TFkUaCo3cXfYXW0D5Xedg8xTMi/CaAWp+0Y=----ATTACHMENT:----MzYwNDYwNjIxNTA2MDM2MiA5NTE1OTEyMjc0ODY4NDAxIDMyNTIwMTU5MzA5NzY3Mjc=