Skip to content

Commit 444bf10

Browse files
committed
Fix test for PHPUnit >= 10.5.30
1 parent be9ebd6 commit 444bf10

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

tests/StubTest.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
use Codeception\Stub;
88
use Codeception\Stub\StubMarshaler;
99
use PHPUnit\Framework\MockObject\MockObject;
10+
use PHPUnit\Framework\MockObject\NoMoreReturnValuesConfiguredException;
1011
use PHPUnit\Framework\TestCase;
12+
use PHPUnit\Runner\Version as PHPUnitVersion;
1113

1214
final class StubTest extends TestCase
1315
{
@@ -363,7 +365,14 @@ public function testConsecutive()
363365
$this->assertEquals('amy', $dummy->helloWorld());
364366

365367
// Expected null value when no more values
366-
$this->assertNull($dummy->helloWorld());
368+
// For PHP 10.5.30 or higher an exception is thrown
369+
// https://github.com/sebastianbergmann/phpunit/commit/490879817a1417fd5fa1149a47b6f2f1b70ada6a
370+
if (version_compare(PHPUnitVersion::series(), '10.5.30', '>=')) {
371+
$this->expectException(NoMoreReturnValuesConfiguredException::class);
372+
$dummy->helloWorld();
373+
} else {
374+
$this->assertNull($dummy->helloWorld());
375+
}
367376
}
368377

369378
public function testStubPrivateProperties()

0 commit comments

Comments
 (0)