Skip to content

Commit 197e4b5

Browse files
committed
FIX Symfony kernel tests
The kernel.secret parameter is not defined anymore. The tests use a testing container to avoid deprecation notices. PHP and Symfony versions now contain up to PHP 8.0 and Symfony 5.3
1 parent a1a6ea9 commit 197e4b5

3 files changed

Lines changed: 14 additions & 4 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
runs-on: ubuntu-latest
88
strategy:
99
matrix:
10-
php: ['7.3', '7.4']
10+
php: ['7.3', '7.4', '8.0']
1111

1212
steps:
1313
# Setup

.github/workflows/installation.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@ jobs:
77
runs-on: ubuntu-latest
88
strategy:
99
matrix:
10-
php: ['7.2', '7.3', '7.4']
11-
symfony: ['4.4', '5.0', '5.1']
10+
php: ['7.2', '7.3', '7.4', '8.0']
11+
symfony: ['4.4', '5.0', '5.1', '5.2', '5.3']
12+
exclude:
13+
- php: '8.0'
14+
symfony: '5.0'
1215

1316
steps:
1417
# Setup

tests/DependencyInjection/Compiler/ConvertersPassTest.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use League\CommonMark\Extension\InlinesOnly\InlinesOnlyExtension;
1111
use PHPUnit\Framework\TestCase;
1212
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
13+
use Symfony\Bundle\TwigBundle\DependencyInjection\TwigExtension;
1314
use Symfony\Bundle\TwigBundle\TwigBundle;
1415
use Symfony\Component\Config\Loader\LoaderInterface;
1516
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -89,7 +90,7 @@ public function testTwigExtensionRegistration()
8990
]
9091
]);
9192
$kernel->boot();
92-
$container = $kernel->getContainer();
93+
$container = $kernel->getContainer()->get('test.service_container');
9394

9495
/** @var Environment $twig */
9596
$twig = $container->get('twig');
@@ -163,6 +164,12 @@ public function registerContainerConfiguration(LoaderInterface $loader)
163164
{
164165
$loader->load(function (ContainerBuilder $container) {
165166
$container->loadFromExtension('aymdev_commonmark', $this->aymdevCommonmarkConfig);
167+
168+
// Parameter is undefined but required
169+
$container->setParameter('kernel.secret', '$ecret');
170+
171+
// Makes the test.service_container service available
172+
$container->prependExtensionConfig('framework', ['test' => true]);
166173
});
167174
}
168175

0 commit comments

Comments
 (0)