Code
<?php

use PHPUnit\Framework\TestCase;

class 
SplTest extends TestCase
{
    public function 
testSplError() : void
    
{
        
// the following mock creation triggers an error
    
        
$spl $this->getMockBuilder(SplFileInfo::CLASS)
            ->
disableOriginalConstructor()
            ->
getMock();
            
        
// this test doesn't work
        
$spl->expects($this->once())
            ->
method('getFileName')
            ->
will($this->returnValue('Foo.php'));
        
        
$this->assertEquals('Foo.php'$spl->getFileName());
    }
    
    public function 
testSplWorks() : void
    
{
        
// Constructor gets a parameter for this mock
        
$spl $this->getMockBuilder(SplFileInfo::CLASS)
            ->
setConstructorArgs([__DIR__])
            ->
getMock();
        
        
$spl->expects($this->once())
            ->
method('getFileName')
            ->
will($this->returnValue('Foo.php'));
        
        
$this->assertEquals('Foo.php'$spl->getFileName());
    }
}
Result
Time: 00:00.007, Memory: 18.00 MB

OK (2 tests, 0 assertions)
Used Versions
PHP 8.2, Laminas MVC 3.2, Symfony 5.2, Laravel 8.28, PHPUnit 9.5, Doctrine ORM 2.8