Skip to content

Commit

Permalink
Merge branch '1.6' into 1.x
Browse files Browse the repository at this point in the history
  • Loading branch information
Corepex committed Mar 12, 2024
2 parents 7f8ce45 + 9fa553f commit 0f949cf
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 40 deletions.
37 changes: 19 additions & 18 deletions .github/ci/files/bin/console
Original file line number Diff line number Diff line change
Expand Up @@ -13,34 +13,35 @@
* @license http://www.pimcore.org/license GPLv3 and PEL
*/

use Symfony\Component\Console\Input\InputInterface;

ob_get_clean();

if (file_exists($a = getcwd() . '/vendor/autoload.php')) {
if (file_exists($a = getcwd() . '/vendor/autoload_runtime.php')) {
include $a;
} elseif (file_exists($a = __DIR__ . '/../../../../vendor/autoload.php')) {
} elseif (file_exists($a = __DIR__ . '/../../../../vendor/autoload_runtime.php')) {
include $a;
} elseif (file_exists($a = __DIR__ . '/../vendor/autoload.php')) {
} elseif (file_exists($a = __DIR__ . '/../vendor/autoload_runtime.php')) {
include $a;
} else {
fwrite(STDERR, 'Cannot locate autoloader; please run "composer install"' . PHP_EOL);
exit(1);
}

\Pimcore\Bootstrap::setProjectRoot();

define('PIMCORE_CONSOLE', true);
return function (InputInterface $input) {
define('PIMCORE_CONSOLE', true);

if (null !== $env = $input->getParameterOption(['--env', '-e'], null, true)) {
putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env);
}

$input = new \Symfony\Component\Console\Input\ArgvInput();
if (null !== $env = $input->getParameterOption(['--env', '-e'], null, true)) {
putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env);
}

if ($input->hasParameterOption('--no-debug', true)) {
putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0');
}
if ($input->hasParameterOption('--no-debug', true)) {
putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0');
}

/** @var \Pimcore\Kernel $kernel */
$kernel = \Pimcore\Bootstrap::startupCli();
$application = new \Pimcore\Console\Application($kernel);
$application->run();
/** @var \Pimcore\Kernel $kernel */
$kernel = \Pimcore\Bootstrap::startupCli();
$application = new \Pimcore\Console\Application($kernel);
$application->run();
return $application;
};
29 changes: 15 additions & 14 deletions .github/ci/files/public/index_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,28 @@
use Pimcore\Tool;
use Symfony\Component\HttpFoundation\Request;

include __DIR__ . "/../vendor/autoload.php";
include __DIR__ . "/../vendor/autoload_runtime.php";

define('PIMCORE_PROJECT_ROOT', __DIR__ . '/..');
define('APP_ENV', 'test');
return function (array $context) {
define('PIMCORE_PROJECT_ROOT', __DIR__ . '/..');
define('APP_ENV', 'test');

\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();
\Pimcore\Bootstrap::bootstrap();
/** @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;
};
6 changes: 5 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
"preferred-install": {
"pimcore/pimcore": "source",
"*": "dist"
},
"allow-plugins": {
"symfony/runtime": true
}
},
"prefer-stable": true,
Expand All @@ -26,7 +29,8 @@
"codeception/phpunit-wrapper": "^9",
"codeception/module-asserts": "^2",
"codeception/module-symfony": "^1.6.0 || ^3.1.0",
"symfony/dotenv": "^6.2 || ^5.4.21"
"symfony/dotenv": "^6.2 || ^5.4.21",
"symfony/runtime": "^6.4 || ^5.4"
},
"suggest": {
"pimcore/admin-ui-classic-bundle": "Required for Pimcore 11"
Expand Down
2 changes: 1 addition & 1 deletion tests/Service/OutputCacheServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,12 @@ public function testIgnoreCacheWhenRequestParameterIsPassed()
$response = new JsonResponse(['data' => 123]);
$this->sut->method('loadFromCache')->willReturn($response);
$this->request->query->set('pimcore_nocache', 'true');
\Pimcore::inDebugMode(true);

// Act
$cacheItem = $this->sut->load($this->request);

// Assert
$this->assertTrue(\Pimcore::inDebugMode());
$this->assertEquals(null, $cacheItem);
}
}
17 changes: 11 additions & 6 deletions tests/_bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,27 @@

use Pimcore\Tests\Support\Util\Autoloader;

define('PIMCORE_TEST', true);

if (file_exists(__DIR__ . '/../vendor/autoload.php')) {
include __DIR__ . '/../vendor/autoload.php';
if (file_exists(__DIR__ . '/../vendor/autoload_runtime.php')) {
include __DIR__ . '/../vendor/autoload_runtime.php';
$pimcoreTestDir = __DIR__ . '/../vendor/pimcore/pimcore/tests';
} elseif (file_exists(__DIR__ . '/../../../../vendor/autoload.php')) {
include __DIR__ . '/../../../../vendor/autoload.php';
} elseif (file_exists(__DIR__ . '/../../../../vendor/autoload_runtime.php')) {
include __DIR__ . '/../../../../vendor/autoload_runtime.php';
$pimcoreTestDir = __DIR__ . '/../../../../vendor/pimcore/pimcore/tests';
} elseif (getenv('PIMCORE_PROJECT_ROOT') != '' && file_exists(getenv('PIMCORE_PROJECT_ROOT') . '/vendor/autoload.php')) {
include getenv('PIMCORE_PROJECT_ROOT') . '/vendor/autoload.php';
} elseif (getenv('PIMCORE_PROJECT_ROOT') != '' && file_exists(getenv('PIMCORE_PROJECT_ROOT') . '/vendor/autoload_runtime.php')) {
include getenv('PIMCORE_PROJECT_ROOT') . '/vendor/autoload_runtime.php';
$pimcoreTestDir = getenv('PIMCORE_PROJECT_ROOT') . '/vendor/pimcore/pimcore/tests';
} elseif (getenv('PIMCORE_PROJECT_ROOT') != '') {
throw new \Exception('Invalid Pimcore project root "' . getenv('PIMCORE_PROJECT_ROOT') . '"');
} else {
throw new \Exception('Unknown configuration! Pimcore project root not found, please set env variable PIMCORE_PROJECT_ROOT.');
}

$_SERVER['APP_ENV'] = 'test';
$_SERVER['APP_DEBUG'] = true;


$pimcoreTestsSupportDir = $pimcoreTestDir . '/Support';

//Pimcore 10 BC layer
Expand Down

0 comments on commit 0f949cf

Please sign in to comment.