public static function init(array $options = null) { if (self::$didInit) { return; } /** @noinspection PhpIncludeInspection */ require_once Utils::getPatchworkFilePath(); $_whitelist = is_array($options['include']) ? array_merge(self::$defaultWhitelist, $options['include']) : self::$defaultWhitelist; $_blacklist = is_array($options['exclude']) ? array_merge(self::$defaultBlacklist, $options['exclude']) : self::$defaultBlacklist; $rootDir = Utils::findParentContainingFrom('vendor', dirname(__FILE__)); $whitelist = Utils::filterPathListFrom($_whitelist, $rootDir); $blacklist = Utils::filterPathListFrom($_blacklist, $rootDir); $blacklist = array_diff($blacklist, $whitelist); array_map(function ($path) { State::$blacklist[] = $path; }, $blacklist); self::$didInit = true; }
/** * @test * it should return properly filtered paths arrays * @dataProvider pathArrays */ public function it_should_return_properly_filtered_paths_arrays($in, $out) { $this->assertEquals($out, Utils::filterPathListFrom($in, $this->rootDir)); }