Go\Instrument\EnumeratorTest::testExclude PHP Method

testExclude() public method

Test wildcard path matching for Enumerator.
public testExclude ( array $expectedPaths, array $includePaths, array $excludePaths )
$expectedPaths array
$includePaths array
$excludePaths array
    public function testExclude($expectedPaths, $includePaths, $excludePaths)
    {
        $testPaths = [];
        /** @var Enumerator $mock */
        $mock = $this->getMockBuilder(Enumerator::class)->setConstructorArgs(['vfs://base', $includePaths, $excludePaths])->setMethods(['getFileFullPath'])->getMock();
        // Mock getFileRealPath method to provide a pathname
        // VFS does not support getRealPath()
        $mock->expects($this->any())->method('getFileFullPath')->will($this->returnCallback(function (\SplFileInfo $file) {
            return $file->getPathname();
        }));
        $iterator = $mock->enumerate();
        foreach ($iterator as $file) {
            $testPaths[] = $file->getPath();
        }
        sort($testPaths);
        sort($expectedPaths);
        $this->assertEquals($expectedPaths, $testPaths);
    }