<?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() : void
{
// 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() : void
{
Mockery::close();
}
}