Skip to content

Commit 84d74f7

Browse files
authored
build: enable symfony/runtime (#48)
1 parent 324f3f2 commit 84d74f7

File tree

3 files changed

+20
-8
lines changed

3 files changed

+20
-8
lines changed

composer.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"psalm/plugin-phpunit": "^0.18.4",
5656
"symfony/framework-bundle": "^6.4 || ^7.0",
5757
"symfony/http-kernel": "^6.4 || ^7.0",
58+
"symfony/runtime": "^6.4 || ^7.0",
5859
"symfony/uid": "^6.4 || ^7.0",
5960
"symfony/var-dumper": "^6.4 || ^7.0",
6061
"symfony/yaml": "^6.4 || ^7.0",
@@ -73,6 +74,9 @@
7374
}
7475
},
7576
"config": {
76-
"sort-packages": true
77+
"sort-packages": true,
78+
"allow-plugins": {
79+
"symfony/runtime": true
80+
}
7781
}
7882
}

tests/Common/TestKernel.php

+6-3
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,12 @@ class TestKernel extends Kernel
3838
/**
3939
* @param array<string,mixed> $config
4040
*/
41-
public function __construct(private array $config = [])
42-
{
43-
parent::__construct('test', true);
41+
public function __construct(
42+
private array $config = [],
43+
string $env = 'test',
44+
bool $debug = true
45+
) {
46+
parent::__construct($env, $debug);
4447
}
4548

4649
public function registerBundles(): iterable

tests/console

+9-4
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,13 @@ namespace Rekalogika\Mapper\Tests;
1717
use Rekalogika\Mapper\Tests\Common\TestKernel;
1818
use Symfony\Bundle\FrameworkBundle\Console\Application;
1919

20-
require_once __DIR__ . '/../vendor/autoload.php';
20+
require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
2121

22-
$kernel = new TestKernel();
23-
$application = new Application($kernel);
24-
$application->run();
22+
return function (array $context) {
23+
$env = $context['APP_ENV'] ?? 'test';
24+
assert(is_string($env));
25+
26+
$kernel = new TestKernel([], $env, (bool) $context['APP_DEBUG']);
27+
28+
return new Application($kernel);
29+
};

0 commit comments

Comments
 (0)