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"
},
"require-dev": {
"phpunit/phpunit": "^9.6",
"phpunit/phpunit": "^11.3",
"squizlabs/php_codesniffer": "^3",
"silverstripe/standards": "^1",
"phpstan/extension-installer": "^1.3"

View File

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