1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-21 04:11:47 +02:00

Upgrade to phpunit 10 (#1806)

Co-authored-by: Christopher Georg <christopher.georg@sr-travel.de>
This commit is contained in:
chris
2023-06-20 15:56:11 +02:00
committed by GitHub
parent 50409b8169
commit 8561130215
28 changed files with 106 additions and 85 deletions

View File

@@ -39,12 +39,18 @@ class SyslogUdpHandlerTest extends TestCase
->onlyMethods(['write'])
->setConstructorArgs(['lol'])
->getMock();
$socket->expects($this->atLeast(2))
$matcher = $this->atLeast(2);
$socket->expects($matcher)
->method('write')
->withConsecutive(
[$this->equalTo("lol"), $this->equalTo("<".(LOG_AUTHPRIV + LOG_WARNING).">1 $time $host php $pid - - ")],
[$this->equalTo("hej"), $this->equalTo("<".(LOG_AUTHPRIV + LOG_WARNING).">1 $time $host php $pid - - ")],
);
->willReturnCallback(function () use ($matcher, $time, $host, $pid) {
match ($matcher->numberOfInvocations()) {
1 => $this->equalTo("lol") && $this->equalTo("<".(LOG_AUTHPRIV + LOG_WARNING).">1 $time $host php $pid - - "),
2 => $this->equalTo("hej") && $this->equalTo("<".(LOG_AUTHPRIV + LOG_WARNING).">1 $time $host php $pid - - "),
default => $this->assertTrue(true)
};
});
$handler->setSocket($socket);
@@ -85,12 +91,18 @@ class SyslogUdpHandlerTest extends TestCase
->setConstructorArgs(['lol', 999])
->onlyMethods(['write'])
->getMock();
$socket->expects($this->atLeast(2))
$matcher = $this->atLeast(2);
$socket->expects($matcher)
->method('write')
->withConsecutive(
[$this->equalTo("lol"), $this->equalTo("<".(LOG_AUTHPRIV + LOG_WARNING).">$time $host php[$pid]: ")],
[$this->equalTo("hej"), $this->equalTo("<".(LOG_AUTHPRIV + LOG_WARNING).">$time $host php[$pid]: ")],
);
->willReturnCallback(function () use ($matcher, $time, $host, $pid) {
match ($matcher->numberOfInvocations()) {
1 => $this->equalTo("lol") && $this->equalTo("<".(LOG_AUTHPRIV + LOG_WARNING).">$time $host php[$pid]: "),
2 => $this->equalTo("hej") && $this->equalTo("<".(LOG_AUTHPRIV + LOG_WARNING).">$time $host php[$pid]: "),
default => $this->assertTrue(true)
};
});
$handler->setSocket($socket);