mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-01 10:14:36 -04:00
Fixes for preloader - exclude testing frameworks
This commit is contained in:
parent
1b10525933
commit
f799208a5b
21
preload.php
21
preload.php
@ -12,6 +12,8 @@ class Preloader
|
|||||||
|
|
||||||
private array $fileMap;
|
private array $fileMap;
|
||||||
|
|
||||||
|
private array $exclude_paths;
|
||||||
|
|
||||||
public function __construct(string ...$paths)
|
public function __construct(string ...$paths)
|
||||||
{
|
{
|
||||||
$this->paths = $paths;
|
$this->paths = $paths;
|
||||||
@ -62,6 +64,10 @@ class Preloader
|
|||||||
// If the current path is a directory,
|
// If the current path is a directory,
|
||||||
// we'll load all files in it
|
// we'll load all files in it
|
||||||
if (is_dir($path)) {
|
if (is_dir($path)) {
|
||||||
|
if (in_array($path, $this->exclude_paths)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$this->loadDir($path);
|
$this->loadDir($path);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -105,7 +111,14 @@ class Preloader
|
|||||||
|
|
||||||
self::$count++;
|
self::$count++;
|
||||||
|
|
||||||
echo "[Preloader] Preloaded `{$class}`" . PHP_EOL;
|
// echo "[Preloader] Preloaded `{$class}`" . PHP_EOL;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function excludePaths(array $exclude_paths): Preloader
|
||||||
|
{
|
||||||
|
$this->exclude_paths = $exclude_paths;
|
||||||
|
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function shouldIgnore(?string $name): bool
|
private function shouldIgnore(?string $name): bool
|
||||||
@ -126,6 +139,12 @@ class Preloader
|
|||||||
|
|
||||||
(new Preloader())
|
(new Preloader())
|
||||||
->paths(__DIR__ . '/vendor/laravel')
|
->paths(__DIR__ . '/vendor/laravel')
|
||||||
|
->excludePaths([
|
||||||
|
__DIR__ . '/vendor/laravel/framework/src/Illuminate/Support/Testing',
|
||||||
|
__DIR__ . '/vendor/laravel/framework/src/Illuminate/Http/Testing',
|
||||||
|
__DIR__ . '/vendor/laravel/framework/src/Illuminate/Testing',
|
||||||
|
__DIR__ . '/vendor/laravel/framework/src/Illuminate/Foundation/Testing',
|
||||||
|
])
|
||||||
->ignore(
|
->ignore(
|
||||||
\Illuminate\Filesystem\Cache::class,
|
\Illuminate\Filesystem\Cache::class,
|
||||||
\Illuminate\Log\LogManager::class,
|
\Illuminate\Log\LogManager::class,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user