From 72c49c6c6bce1f38a902bef3f24ff1e95d992f4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20Hochd=C3=B6rfer?= Date: Fri, 8 May 2020 20:31:35 +0200 Subject: [PATCH] Add autoloader for Magento\TestFramework classes Fixes #31 --- autoload.php | 3 ++ .../Autoload/TestFrameworkAutoloader.php | 45 +++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 src/bitExpert/PHPStan/Magento/Autoload/TestFrameworkAutoloader.php diff --git a/autoload.php b/autoload.php index 35d7d94..4fb7a57 100644 --- a/autoload.php +++ b/autoload.php @@ -13,6 +13,7 @@ use bitExpert\PHPStan\Magento\Autoload\FactoryAutoloader; use bitExpert\PHPStan\Magento\Autoload\MockAutoloader; use bitExpert\PHPStan\Magento\Autoload\ProxyAutoloader; +use bitExpert\PHPStan\Magento\Autoload\TestFrameworkAutoloader; use Nette\Neon\Neon; use PHPStan\Cache\Cache; @@ -52,10 +53,12 @@ $cache = new Cache(new FileCacheStorage($tmpDir . '/cache/PHPStan')); $mockAutoloader = new MockAutoloader(); + $testFrameworkAutoloader = new TestFrameworkAutoloader(); $factoryAutoloader = new FactoryAutoloader($cache); $proxyAutoloader = new ProxyAutoloader($cache); \spl_autoload_register([$mockAutoloader, 'autoload'], true, true); + \spl_autoload_register([$testFrameworkAutoloader, 'autoload'], true, false); \spl_autoload_register([$factoryAutoloader, 'autoload'], true, false); \spl_autoload_register([$proxyAutoloader, 'autoload'], true, false); })($GLOBALS['argv'] ?? []); diff --git a/src/bitExpert/PHPStan/Magento/Autoload/TestFrameworkAutoloader.php b/src/bitExpert/PHPStan/Magento/Autoload/TestFrameworkAutoloader.php new file mode 100644 index 0000000..e6a2d27 --- /dev/null +++ b/src/bitExpert/PHPStan/Magento/Autoload/TestFrameworkAutoloader.php @@ -0,0 +1,45 @@ +