Skip to content

Commit

Permalink
build: enable symfony/runtime (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
priyadi committed Apr 24, 2024
1 parent 324f3f2 commit 84d74f7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
6 changes: 5 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"psalm/plugin-phpunit": "^0.18.4",
"symfony/framework-bundle": "^6.4 || ^7.0",
"symfony/http-kernel": "^6.4 || ^7.0",
"symfony/runtime": "^6.4 || ^7.0",
"symfony/uid": "^6.4 || ^7.0",
"symfony/var-dumper": "^6.4 || ^7.0",
"symfony/yaml": "^6.4 || ^7.0",
Expand All @@ -73,6 +74,9 @@
}
},
"config": {
"sort-packages": true
"sort-packages": true,
"allow-plugins": {
"symfony/runtime": true
}
}
}
9 changes: 6 additions & 3 deletions tests/Common/TestKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,12 @@ class TestKernel extends Kernel
/**
* @param array<string,mixed> $config
*/
public function __construct(private array $config = [])
{
parent::__construct('test', true);
public function __construct(
private array $config = [],
string $env = 'test',
bool $debug = true
) {
parent::__construct($env, $debug);
}

public function registerBundles(): iterable
Expand Down
13 changes: 9 additions & 4 deletions tests/console
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,13 @@ namespace Rekalogika\Mapper\Tests;
use Rekalogika\Mapper\Tests\Common\TestKernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;

require_once __DIR__ . '/../vendor/autoload.php';
require_once dirname(__DIR__).'/vendor/autoload_runtime.php';

$kernel = new TestKernel();
$application = new Application($kernel);
$application->run();
return function (array $context) {
$env = $context['APP_ENV'] ?? 'test';
assert(is_string($env));

$kernel = new TestKernel([], $env, (bool) $context['APP_DEBUG']);

return new Application($kernel);
};

0 comments on commit 84d74f7

Please sign in to comment.