From 6579da7666fc84fb0b857741af91558024de0ffa Mon Sep 17 00:00:00 2001 From: jiajia Date: Fri, 1 Mar 2024 11:00:06 +0100 Subject: [PATCH] try with closure --- .github/ci/files/public/index_test.php | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/.github/ci/files/public/index_test.php b/.github/ci/files/public/index_test.php index 6ecf0cd0..2d2c2324 100644 --- a/.github/ci/files/public/index_test.php +++ b/.github/ci/files/public/index_test.php @@ -20,22 +20,25 @@ define('PIMCORE_PROJECT_ROOT', __DIR__ . '/..'); define('APP_ENV', 'test'); -\Pimcore\Bootstrap::setProjectRoot(); -\Pimcore\Bootstrap::bootstrap(); +return function (array $context) { + \Pimcore\Bootstrap::setProjectRoot(); + \Pimcore\Bootstrap::bootstrap(); -$request = Request::createFromGlobals(); + $request = Request::createFromGlobals(); // set current request as property on tool as there's no // request stack available yet -Tool::setCurrentRequest($request); + Tool::setCurrentRequest($request); -/** @var \Pimcore\Kernel $kernel */ -$kernel = \Pimcore\Bootstrap::kernel(); + /** @var \Pimcore\Kernel $kernel */ + $kernel = \Pimcore\Bootstrap::kernel(); // reset current request - will be read from request stack from now on -Tool::setCurrentRequest(null); + Tool::setCurrentRequest(null); -$response = $kernel->handle($request); -$response->send(); + $response = $kernel->handle($request); + $response->send(); -$kernel->terminate($request, $response); + $kernel->terminate($request, $response); + return $kernel; +};