Skip to content

Commit

Permalink
DEP Use PHPUnit 11
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Sep 10, 2024
1 parent 8546766 commit 5f81c40
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
30 changes: 17 additions & 13 deletions tests/EnvironmentCheckerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function testOnlyLogsWithErrors()

$logger = $this->getMockBuilder(Logger::class)
->disableOriginalConstructor()
->setMethods(['log'])
->onlyMethods(['log'])
->getMock();

$logger->expects($this->never())->method('log');
Expand All @@ -55,15 +55,17 @@ public function testLogsWithWarnings()

$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);

Expand All @@ -80,15 +82,17 @@ public function testLogsWithErrors()

$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);

Expand Down

0 comments on commit 5f81c40

Please sign in to comment.