mirror of
https://github.com/silverstripe/silverstripe-environmentcheck
synced 2024-10-22 17:05:40 +02:00
Merge pull request #111 from creative-commoners/pulls/4/phpunit11
DEP Use PHPUnit 11
This commit is contained in:
commit
6c12c76e6c
@ -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"
|
||||||
|
@ -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);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user