|
| 1 | +<?php declare(strict_types=1); |
| 2 | +/* |
| 3 | + * This file is part of PHPUnit. |
| 4 | + * |
| 5 | + * (c) Sebastian Bergmann <[email protected]> |
| 6 | + * |
| 7 | + * For the full copyright and license information, please view the LICENSE |
| 8 | + * file that was distributed with this source code. |
| 9 | + */ |
| 10 | +namespace PHPUnit\TextUI\Configuration; |
| 11 | + |
| 12 | +use const DIRECTORY_SEPARATOR; |
| 13 | +use function ltrim; |
| 14 | +use function realpath; |
| 15 | +use function str_replace; |
| 16 | +use PHPUnit\Framework\TestCase; |
| 17 | + |
| 18 | +abstract class AbstractSouceFilterTestCase extends TestCase |
| 19 | +{ |
| 20 | + protected static function createSource( |
| 21 | + ?FilterDirectoryCollection $includeDirectories = null, |
| 22 | + ?FilterDirectoryCollection $excludeDirectories = null, |
| 23 | + ?FileCollection $includeFiles = null, |
| 24 | + ?FileCollection $excludeFiles = null, |
| 25 | + ): Source { |
| 26 | + return new Source( |
| 27 | + null, |
| 28 | + false, |
| 29 | + $includeDirectories ?? FilterDirectoryCollection::fromArray([]), |
| 30 | + $includeFiles ?? FileCollection::fromArray([]), |
| 31 | + $excludeDirectories ?? FilterDirectoryCollection::fromArray([]), |
| 32 | + $excludeFiles ?? FileCollection::fromArray([]), |
| 33 | + false, |
| 34 | + false, |
| 35 | + false, |
| 36 | + false, |
| 37 | + false, |
| 38 | + false, |
| 39 | + false, |
| 40 | + false, |
| 41 | + false, |
| 42 | + [ |
| 43 | + 'functions' => [], |
| 44 | + 'methods' => [], |
| 45 | + ], |
| 46 | + false, |
| 47 | + false, |
| 48 | + false, |
| 49 | + ); |
| 50 | + } |
| 51 | + |
| 52 | + protected static function fixturePath(?string $subPath = null): string |
| 53 | + { |
| 54 | + $path = realpath(__DIR__ . '/../..') . '/_files/source-filter'; |
| 55 | + |
| 56 | + if ($subPath !== null) { |
| 57 | + $path = $path . '/' . ltrim($subPath, '/'); |
| 58 | + } |
| 59 | + |
| 60 | + return str_replace('/', DIRECTORY_SEPARATOR, $path); |
| 61 | + } |
| 62 | +} |
0 commit comments