Integrationtests in PHPUnit with mock proxies

Code
<?php

use Symfony\Component\Yaml\Parser;
use 
PHPUnit\Framework\TestCase;

class 
MockProxyTest extends TestCase
{
    public function 
testParseStr() : void
    
{
        
$str 'root: ' PHP_EOL .
            
'  key1: value1' PHP_EOL .
            
'  key2: value2';
        
        
$parser $this->getMockBuilder(Parser::CLASS)
            ->
enableProxyingToOriginalMethods()
            ->
getMock();
        
$parser->expects($this->once())
            ->
method('parse');
        
        
$val = (new Foo($parser))->parseStr($str);
        
        
$this->assertEquals('value1'$val['root']['key1']);
        
$this->assertEquals('value2'$val['root']['key2']);
    }
}

class 
Foo
{
    private 
$parser;
    
    public function 
__construct(Parser $parser)
    {
        
$this->parser $parser;
    }
    
    public function 
parseStr($str)
    {
        return 
$this->parser->parse($str);
    }
}
Result
Time: 00:00.008, Memory: 18.00 MB

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