Skip to content

Commit

Permalink
add support for Symfony 6.x (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
JanTvrdik authored Jun 14, 2022
1 parent fd82847 commit 70ea169
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 5 deletions.
9 changes: 5 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@
"nette/tester": "~1.7 | ~2.0",
"nette/utils": "~2.3",
"nextras/dbal": "~1.0 | ~2.0 | ~3.0 | ~4.0 | ~5.0@dev",
"symfony/config": "~2.6 | ~3.0 | ~4.0",
"symfony/console": "~2.6 | ~3.0 | ~4.0",
"symfony/dependency-injection": "~2.6 | ~3.0 | ~4.0",
"symfony/http-kernel": "~2.6 | ~3.0 | ~4.0",
"symfony/config": "~2.6 | ~3.0 | ~4.0 | ~5.0 | ~6.0",
"symfony/console": "~2.6 | ~3.0 | ~4.0 | ~5.0 | ~6.0",
"symfony/dependency-injection": "~2.6 | ~3.0 | ~4.0 | ~5.0 | ~6.0",
"symfony/framework-bundle": "~2.6 | ~3.0 | ~4.0 | ~5.0 | ~6.0",
"symfony/http-kernel": "~2.6 | ~3.0 | ~4.0 | ~5.0 | ~6.0",
"tracy/tracy": "^2.2",
"ext-openssl": "*"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ class SymfonyBundleTest extends TestCase
$dbalOptions = $driversConfig[$options['driver']];

$doctrineDriver = $options['driver'] === 'mysql' ? 'pdo_mysql' : 'pdo_pgsql';
$this->symfonyKernel = new TestSymfonyKernel(__DIR__ . '/SymfonyBundleTest.yaml', [
$className = PHP_VERSION_ID >= 70100 ? 'NextrasTests\Migrations\TestSymfonyKernel6' : 'NextrasTests\Migrations\TestSymfonyKernel';
$this->symfonyKernel = new $className(__DIR__ . '/SymfonyBundleTest.yaml', [
'doctrine_dbal_driver' => $doctrineDriver,
'doctrine_dbal_host' => $dbalOptions['host'],
'doctrine_dbal_database' => $dbalOptions['database'],
Expand Down
63 changes: 63 additions & 0 deletions tests/inc/TestSymfonyKernel6.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?php

namespace NextrasTests\Migrations;

use Doctrine\Bundle\DoctrineBundle\DoctrineBundle;
use Nextras\Migrations\Bridges\SymfonyBundle\NextrasMigrationsBundle;
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\DependencyInjection\Config\ContainerParametersResource;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Kernel;


class TestSymfonyKernel6 extends Kernel
{
/** @var string */
private $configPath;

/** @var array */
private $parameters;


/**
* @param string $configPath
* @param array $parameters
*/
public function __construct($configPath, array $parameters)
{
parent::__construct('dev', TRUE);

$this->configPath = $configPath;
$this->parameters = $parameters;
}


public function getRootDir()
{
return TEMP_DIR . '/symfony-bundle';
}


public function registerBundles(): iterable
{
return [
new FrameworkBundle(),
new DoctrineBundle(),
new NextrasMigrationsBundle(),
];
}


public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load(function (ContainerBuilder $container) {
$container->addResource(new ContainerParametersResource($this->parameters));
foreach ($this->parameters as $key => $value) {
$container->setParameter($key, $value);
}
});

$loader->load($this->configPath);
}
}
15 changes: 15 additions & 0 deletions tests/matrix/symfony-bundle/symfony-6.0-php-8.0.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash
PHP_VERSION_MIN="80000"
PHP_VERSION_MAX="80199"
COMPOSER_REQUIRE="$COMPOSER_REQUIRE doctrine/dbal:~3.0"
COMPOSER_REQUIRE="$COMPOSER_REQUIRE doctrine/orm:~2.11"
COMPOSER_REQUIRE="$COMPOSER_REQUIRE doctrine/doctrine-bundle:~2.6"
COMPOSER_REQUIRE="$COMPOSER_REQUIRE symfony/config:~6.0"
COMPOSER_REQUIRE="$COMPOSER_REQUIRE symfony/console:~6.0"
COMPOSER_REQUIRE="$COMPOSER_REQUIRE symfony/dependency-injection:~6.0"
COMPOSER_REQUIRE="$COMPOSER_REQUIRE symfony/doctrine-bridge:~6.0"
COMPOSER_REQUIRE="$COMPOSER_REQUIRE symfony/framework-bundle:~6.0"
COMPOSER_REQUIRE="$COMPOSER_REQUIRE symfony/http-kernel:~6.0"
COMPOSER_REQUIRE="$COMPOSER_REQUIRE symfony/yaml:~6.0"
COMPOSER_REQUIRE="$COMPOSER_REQUIRE nette/tester:~2.3"
DBAL='doctrine'

0 comments on commit 70ea169

Please sign in to comment.