diff --git a/CHANGELOG.md b/CHANGELOG.md index f10c971..33e17b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## v0.13.0 ### Changes: - Deprecated `Neusta\Pimcore\TestingFramework\Kernel\TestKernel` in favor of `Neusta\Pimcore\TestingFramework\TestKernel` +- Deprecated `Neusta\Pimcore\TestingFramework\Pimcore\BootstrapPimcore` in favor of `Neusta\Pimcore\TestingFramework\BootstrapPimcore` ## v0.12.4 ### Bugfixes: diff --git a/README.md b/README.md index d58161f..99c35be 100644 --- a/README.md +++ b/README.md @@ -23,14 +23,14 @@ Just call `BootstrapPimcore::bootstrap()` in your `tests/bootstrap.php` as seen include dirname(__DIR__).'/vendor/autoload.php'; -Neusta\Pimcore\TestingFramework\Pimcore\BootstrapPimcore::bootstrap(); +\Neusta\Pimcore\TestingFramework\BootstrapPimcore::bootstrap(); ``` You can also pass any environment variable via named arguments to this method: ```php # tests/bootstrap.php -Neusta\Pimcore\TestingFramework\Pimcore\BootstrapPimcore::bootstrap( +\Neusta\Pimcore\TestingFramework\BootstrapPimcore::bootstrap( APP_ENV: 'custom', SOMETHING: 'else', ); @@ -52,7 +52,7 @@ For a basic setup, you can use the `TestKernel` directly: # tests/bootstrap.php 'test', + ]; + + public static function bootstrap(string ...$envVars): void + { + foreach ($envVars + self::DEFAULT_ENV_VARS as $name => $value) { + self::setEnv($name, $value); + } + + Bootstrap::setProjectRoot(); + Bootstrap::bootstrap(); + AdminMode::disable(); + } + + public static function setEnv(string $name, string $value): void + { + putenv("{$name}=" . $_ENV[$name] = $_SERVER[$name] = $value); + } +} diff --git a/src/Pimcore/BootstrapPimcore.php b/src/Pimcore/BootstrapPimcore.php index 5699435..6e06fd0 100644 --- a/src/Pimcore/BootstrapPimcore.php +++ b/src/Pimcore/BootstrapPimcore.php @@ -1,30 +1,32 @@ 'test', - ]; +class_alias(RootBootstrapPimcore::class, BootstrapPimcore::class); - public static function bootstrap(string ...$envVars): void +if (false) { + /** + * @deprecated since 0.13, use Neusta\Pimcore\TestingFramework\BootstrapPimcore instead + */ + final class BootstrapPimcore { - foreach ($envVars + self::DEFAULT_ENV_VARS as $name => $value) { - self::setEnv($name, $value); + public static function bootstrap(string ...$envVars): void + { } - Bootstrap::setProjectRoot(); - Bootstrap::bootstrap(); - AdminMode::disable(); - } - - public static function setEnv(string $name, string $value): void - { - putenv("{$name}=" . $_ENV[$name] = $_SERVER[$name] = $value); + public static function setEnv(string $name, string $value): void + { + } } } diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 72cebf5..0afdca9 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -2,7 +2,7 @@ declare(strict_types=1); -use Neusta\Pimcore\TestingFramework\Pimcore\BootstrapPimcore; +use Neusta\Pimcore\TestingFramework\BootstrapPimcore; use Neusta\Pimcore\TestingFramework\TestKernel; include dirname(__DIR__) . '/vendor/autoload.php';