Handling fluid interfaces with a Mockery mock objects

Code
<?php

use Symfony\Component\Finder\Finder;
use 
PHPUnit\Framework\TestCase;

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

class 
FluidTest extends 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: 330 ms, Memory: 12.00MB

OK (1 test, 0 assertions)
Used Versions
PHP 7.2, Zend 3.0, Symfony 4.0, Laravel 5.6, PHPUnit 6.5, Doctrine 2.8