Handling fluid interfaces with a Mockery mock objects

Code
<?php

use Symfony\Component\Finder\Finder;

/**
 * The class to test
 */
class Foo
{
    public function 
configureFinder(Finder $finder)
    {
        return 
$finder->files()
            ->
useBestAdapter()
            ->
sortByName();
    }
}

class 
FluidTest extends PHPUnit_Framework_TestCase
{
    public function 
testConfigureFinder()
    {
        
// mock of Finder and its fluid method usage
        
$finder Mockery::mock(Finder::CLASS);
        
$finder->shouldReceive('files->useBestAdapter->sortByName')
            ->
andReturn($finder);
        
        
$foo = new Foo();
        
$actual $foo->configureFinder($finder);
        
        
// do your assertions for your test
        
$this->assertInstanceOf(Finder::CLASS, $actual);
    }
    
    protected function 
tearDown()
    {
        
Mockery::close();
    }
}
Result
Time: 203 ms, Memory: 2.00MB

OK (1 test, 0 assertions)
Used Versions
PHP 7.1, Zend 3.0, Symfony 3.2, Laravel 5.2, PHPUnit 5.6, Doctrine 2.6