Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Commit

Permalink
Fix test for SF5.3 and 5.4 (#346)
Browse files Browse the repository at this point in the history
* fix ci
  • Loading branch information
gilles-g authored Aug 20, 2021
1 parent 5ba5755 commit e8a6bea
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@ env:
jobs:
build:
runs-on: ${{ matrix.os }}
name: PHP v${{ matrix.php }} with Mongo v${{ matrix.mongodb }}
name: PHP v${{ matrix.php }}, Symfony v${{ matrix.symfony }} with Mongo v${{ matrix.mongodb }}
strategy:
matrix:
include:
- { os: ubuntu-latest, php: 7.3, mongodb: 3.6, symfony: "4.4.*"}
- { os: ubuntu-latest, php: 7.3, mongodb: 3.6, symfony: "5.1.*"}
- { os: ubuntu-latest, php: 7.4, mongodb: 3.6, symfony: "5.2.*"}
- { os: ubuntu-latest, php: 8.0, mongodb: 3.6, symfony: "5.x-dev"}
- { os: ubuntu-latest, php: 7.4, mongodb: 3.6, symfony: "5.3.*"}
- { os: ubuntu-latest, php: 8.0, mongodb: 3.6, symfony: "5.4.*@dev"}
services:
mongo:
image: mongo:${{ matrix.mongodb }}
Expand All @@ -43,6 +44,9 @@ jobs:
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Install Symfony ${{ matrix.symfony }}
run: composer require symfony/symfony:${{ matrix.symfony }} --no-update
- name: "Require symfony/messenger"
run: "composer require --dev symfony/doctrine-messenger --no-update"
if: "${{ startsWith(matrix.symfony, '5.3') || startsWith(matrix.symfony, '5.4') }}"
- name: Cache Composer dependencies
uses: actions/cache@v2
with:
Expand Down
23 changes: 9 additions & 14 deletions Tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@

use Doctrine\Bundle\DoctrineBundle\DependencyInjection\DoctrineExtension;
use Doctrine\Bundle\DoctrineBundle\DoctrineBundle;
use Doctrine\Bundle\MongoDBBundle\DependencyInjection\DoctrineMongoDBExtension;
use Doctrine\Bundle\MongoDBBundle\DoctrineMongoDBBundle;
use Doctrine\Common\Annotations\AnnotationReader;
use Doctrine\Common\Cache\ArrayCache;
use Doctrine\Common\Cache\Psr6\DoctrineProvider;
use Doctrine\ODM\MongoDB\Configuration;
use Doctrine\ODM\MongoDB\DocumentManager;
use Doctrine\ODM\MongoDB\Mapping\Driver\AnnotationDriver;
Expand All @@ -18,7 +16,7 @@
use Lexik\Bundle\FormFilterBundle\LexikFormFilterBundle;
use Symfony\Bundle\FrameworkBundle\DependencyInjection\FrameworkExtension;
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\Cache\Adapter\ArrayAdapter;
use Symfony\Component\DependencyInjection\Compiler\ResolveChildDefinitionsPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
Expand Down Expand Up @@ -64,13 +62,10 @@ public function getFormFactory()
*/
public function getSqliteEntityManager()
{
$cache = new \Doctrine\Common\Cache\ArrayCache();
$arrayAdapter = new ArrayAdapter();
$cache = DoctrineProvider::wrap(new ArrayAdapter());

if (class_exists('Doctrine\Common\Annotations\DocParser')) {
$reader = new AnnotationReader(new \Doctrine\Common\Annotations\DocParser());
} else {
$reader = new AnnotationReader($cache);
}
$reader = new AnnotationReader(new \Doctrine\Common\Annotations\DocParser());

$mappingDriver = new \Doctrine\ORM\Mapping\Driver\AnnotationDriver($reader, array(
__DIR__.'/Fixtures/Entity',
Expand All @@ -79,7 +74,7 @@ public function getSqliteEntityManager()
$config = \Doctrine\ORM\Tools\Setup::createAnnotationMetadataConfiguration(array());

$config->setMetadataDriverImpl($mappingDriver);
$config->setMetadataCacheImpl($cache);
$config->setMetadataCache($arrayAdapter);
$config->setQueryCacheImpl($cache);
$config->setProxyDir(sys_get_temp_dir());
$config->setProxyNamespace('Proxy');
Expand All @@ -99,10 +94,10 @@ public function getSqliteEntityManager()

public function getMongodbDocumentManager(): DocumentManager
{
$cache = new ArrayCache();
$arrayAdapter = new ArrayAdapter();

$config = new Configuration();
$config->setMetadataCacheImpl($cache);
$config->setMetadataCache($arrayAdapter);
$config->setMetadataDriverImpl(new AnnotationDriver(new AnnotationReader(), [__DIR__.'/Fixtures/Document/']));

$config->setAutoGenerateProxyClasses(Configuration::AUTOGENERATE_FILE_NOT_EXISTS);
Expand Down Expand Up @@ -138,7 +133,7 @@ private static function createContainerBuilder(array $configs = [])
'kernel.bundles' => [
'FrameworkBundle' => FrameworkBundle::class,
'DoctrineBundle' => DoctrineBundle::class,
'LexikJWTAuthenticationBundle' => LexikFormFilterBundle::class
'LexikFormFilterBundle' => LexikFormFilterBundle::class
],
'kernel.bundles_metadata' => [],
'kernel.cache_dir' => __DIR__,
Expand Down

0 comments on commit e8a6bea

Please sign in to comment.