Merge pull request #111 from creative-commoners/pulls/4/phpunit11

DEP Use PHPUnit 11
This commit is contained in:
Guy Sartorelli 2024-09-18 15:30:43 +12:00 committed by GitHub
commit 6c12c76e6c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 14 deletions

View File

@ -26,7 +26,7 @@
"guzzlehttp/guzzle": "^7" "guzzlehttp/guzzle": "^7"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^9.6", "phpunit/phpunit": "^11.3",
"squizlabs/php_codesniffer": "^3", "squizlabs/php_codesniffer": "^3",
"silverstripe/standards": "^1", "silverstripe/standards": "^1",
"phpstan/extension-installer": "^1.3" "phpstan/extension-installer": "^1.3"

View File

@ -35,7 +35,7 @@ class EnvironmentCheckerTest extends SapphireTest
$logger = $this->getMockBuilder(Logger::class) $logger = $this->getMockBuilder(Logger::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->setMethods(['log']) ->onlyMethods(['log'])
->getMock(); ->getMock();
$logger->expects($this->never())->method('log'); $logger->expects($this->never())->method('log');
@ -55,15 +55,17 @@ class EnvironmentCheckerTest extends SapphireTest
$logger = $this->getMockBuilder(Logger::class) $logger = $this->getMockBuilder(Logger::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->setMethods(['log']) ->onlyMethods(['log'])
->getMock(); ->getMock();
$logger->expects($this->once()) $matcher = $this->once();
$logger->expects($matcher)
->method('log') ->method('log')
->withConsecutive( ->willReturnCallback(function (mixed $level) use ($matcher) {
[$this->equalTo(LogLevel::WARNING)], match ($matcher->numberOfInvocations()) {
[$this->anything()] 1 => $this->assertSame(LogLevel::WARNING, $level),
); };
});
Injector::inst()->registerService($logger, LoggerInterface::class); Injector::inst()->registerService($logger, LoggerInterface::class);
@ -80,15 +82,17 @@ class EnvironmentCheckerTest extends SapphireTest
$logger = $this->getMockBuilder(Logger::class) $logger = $this->getMockBuilder(Logger::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->setMethods(['log']) ->onlyMethods(['log'])
->getMock(); ->getMock();
$logger->expects($this->once()) $matcher = $this->once();
$logger->expects($matcher)
->method('log') ->method('log')
->withConsecutive( ->willReturnCallback(function (mixed $level) use ($matcher) {
[$this->equalTo(LogLevel::ALERT), $this->anything()], match ($matcher->numberOfInvocations()) {
[$this->equalTo(LogLevel::WARNING), $this->anything()] 1 => $this->assertSame(LogLevel::ALERT, $level),
); };
});
Injector::inst()->registerService($logger, LoggerInterface::class); Injector::inst()->registerService($logger, LoggerInterface::class);