Integrationtests in PHPUnit with mock proxies

Code
<?php

use Symfony\Component\Yaml\Parser;

class 
MockProxyTest extends PHPUnit_Framework_TestCase
{
    public function 
testParseStr()
    {
        
$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: 150 ms, Memory: 2.00MB

OK (1 test, 0 assertions)