File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 7
7
use Codeception \Stub ;
8
8
use Codeception \Stub \StubMarshaler ;
9
9
use PHPUnit \Framework \MockObject \MockObject ;
10
+ use PHPUnit \Framework \MockObject \NoMoreReturnValuesConfiguredException ;
10
11
use PHPUnit \Framework \TestCase ;
12
+ use PHPUnit \Runner \Version as PHPUnitVersion ;
11
13
12
14
final class StubTest extends TestCase
13
15
{
@@ -363,7 +365,14 @@ public function testConsecutive()
363
365
$ this ->assertEquals ('amy ' , $ dummy ->helloWorld ());
364
366
365
367
// 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
+ }
367
376
}
368
377
369
378
public function testStubPrivateProperties ()
You can’t perform that action at this time.
0 commit comments