gl-website-deployer/vendor/doctrine/rst-parser/tests/GlobSearcherTest.php

58 lines
1.2 KiB
PHP
Raw Normal View History

2024-11-19 08:02:04 +01:00
<?php
declare(strict_types=1);
namespace Doctrine\Tests\RST;
use Doctrine\RST\Environment;
use Doctrine\RST\Toc\GlobSearcher;
use PHPUnit\Framework\TestCase;
use function sort;
class GlobSearcherTest extends TestCase
{
/** @var GlobSearcher */
private $globSearcher;
public function testGlobSearch(): void
{
$dir = __DIR__ . '/BuilderToctree/input';
$environment = $this->createMock(Environment::class);
$environment->expects(self::once())
->method('absoluteRelativePath')
->with('')
->willReturn($dir);
$environment->expects(self::once())
->method('getDirName')
->willReturn('subdir');
$files = $this->globSearcher->globSearch($environment, '*');
self::assertCount(7, $files);
$expected = [
'/orphaned/file',
'/index',
'/subdir/toctree',
'/wildcards/bugfix1',
'/wildcards/feature1',
'/wildcards/feature2',
'/wildcards/index',
];
sort($expected);
sort($files);
self::assertSame($expected, $files);
}
protected function setUp(): void
{
$this->globSearcher = new GlobSearcher();
}
}