Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 23 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,16 @@ jobs:
matrix:
php-version: ['7.4', '8.1', '8.2', '8.3', '8.4']
sf-version: ['5.4', '6.4', '7.0', '7.1', '7.2', '7.3']
dependencies: ['locked']
exclude:
- php-version: '7.4'
sf-version: '6.4'
- php-version: '7.4'
sf-version: '7.0'
- php-version: '7.4'
sf-version: '7.1'
- php-version: '7.4'
sf-version: '7.2'
- php-version: '7.4'
sf-version: '7.3'
- php-version: '8.1'
Expand All @@ -47,6 +50,8 @@ jobs:
sf-version: '7.0'
- php-version: '8.1'
sf-version: '7.1'
- php-version: '8.1'
sf-version: '7.2'
- php-version: '8.1'
sf-version: '7.3'
- php-version: '8.2'
Expand All @@ -55,14 +60,23 @@ jobs:
sf-version: '5.4'
- php-version: '8.4'
sf-version: '5.4'
- php-version: '7.4'
sf-version: '7.2'
- php-version: '8.0'
sf-version: '7.2'
- php-version: '8.1'
sf-version: '7.2'
include:
- php-version: '7.4'
sf-version: '5.4'
dependencies: 'lowest'
- php-version: '7.4'
sf-version: '5.4'
dependencies: 'highest'
- php-version: '8.4'
sf-version: '7.3'
dependencies: 'lowest'
- php-version: '8.4'
sf-version: '7.3'
dependencies: 'highest'

name: integration-tests (PHP ${{ matrix.php-version }}) (Symfony ${{ matrix.sf-version }}.*)
name: integration-tests (PHP ${{ matrix.php-version }}) (Symfony ${{ matrix.sf-version }}.*)${{ matrix.dependencies != 'locked' && format(' ({0})', matrix.dependencies) || '' }}
steps:
- name: Checkout code
uses: actions/checkout@v5
Expand All @@ -85,15 +99,17 @@ jobs:
env:
SYMFONY_REQUIRE: ${{ matrix.sf-version }}.*
with:
dependency-versions: 'highest'
composer-options: --no-interaction --no-progress --prefer-dist --dev
dependency-versions: "${{ matrix.dependencies }}"

- name: Run test suite
working-directory: ${{ github.workspace }}
run: composer test:unit -- --coverage-clover coverage.xml

- name: Upload coverage file
uses: actions/upload-artifact@v4
with:
name: 'phpunit-${{ matrix.php-version }}-${{ matrix.sf-version }}-coverage'
name: "phpunit-${{ matrix.php-version }}-${{ matrix.sf-version }}-${{ matrix.dependencies }}-coverage"
path: 'coverage.xml'

code-style:
Expand Down
2 changes: 1 addition & 1 deletion .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
->setFinder($finder)
->setRules([
'@Symfony' => true,
'@PHP80Migration:risky' => true,
'@PHP8x0Migration:risky' => true,
'native_function_invocation' => ['include' => ['@compiler_optimized'], 'scope' => 'namespaced'],
'global_namespace_import' => [
'import_classes' => false,
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"require": {
"php": "^7.4|^8.0",
"ext-json": "*",
"doctrine/doctrine-bundle": "^2.10",
"doctrine/doctrine-bundle": "^2.10 || ^3.0",
"meilisearch/meilisearch-php": "^1.0.0",
"symfony/config": "^5.4 || ^6.0 || ^7.0",
"symfony/dependency-injection": "^5.4.17 || ^6.0 || ^7.0",
Expand Down
33 changes: 18 additions & 15 deletions tests/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
namespace Meilisearch\Bundle\Tests;

use Doctrine\Bundle\DoctrineBundle\ConnectionFactory;
use Doctrine\Bundle\DoctrineBundle\Dbal\BlacklistSchemaAssetFilter;
use Doctrine\Bundle\DoctrineBundle\DoctrineBundle;
use Doctrine\ORM\Configuration;
use Doctrine\ORM\Mapping\LegacyReflectionFields;
use Meilisearch\Bundle\MeilisearchBundle;
use Symfony\Bridge\Doctrine\ArgumentResolver\EntityValueResolver;
Expand All @@ -29,18 +29,30 @@ public function registerBundles(): iterable

protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void
{
$loader->load(__DIR__.'/config/framework.yaml');

$doctrineBundleV3 = !class_exists(BlacklistSchemaAssetFilter::class);

if (PHP_VERSION_ID >= 80000) {
if (class_exists(LegacyReflectionFields::class) && PHP_VERSION_ID >= 80400) {
$loader->load(__DIR__.'/config/config.yaml');
if ($doctrineBundleV3) {
$loader->load(__DIR__.'/config/doctrine.yaml');
} elseif (class_exists(LegacyReflectionFields::class) && PHP_VERSION_ID >= 80400) {
$loader->load(__DIR__.'/config/doctrine_v2.yaml');
} else {
$loader->load(__DIR__.'/config/config_old_proxy.yaml');
$loader->load(__DIR__.'/config/doctrine_old_proxy.yaml');
}
} else {
$loader->load(__DIR__.'/config/config_php7.yaml');
$container->prependExtensionConfig('framework', [
'annotations' => true,
'serializer' => ['enable_annotations' => true],
'router' => ['utf8' => true],
]);

$loader->load(__DIR__.'/config/doctrine_php7.yaml');
}
$loader->load(__DIR__.'/config/meilisearch.yaml');

if (\defined(ConnectionFactory::class.'::DEFAULT_SCHEME_MAP')) {
if (\defined(ConnectionFactory::class.'::DEFAULT_SCHEME_MAP') && !$doctrineBundleV3) {
$container->prependExtensionConfig('doctrine', [
'orm' => [
'report_fields_where_declared' => true,
Expand All @@ -49,15 +61,6 @@ protected function configureContainer(ContainerBuilder $container, LoaderInterfa
]);
}

// @phpstan-ignore-next-line
if (method_exists(Configuration::class, 'setLazyGhostObjectEnabled') && Kernel::VERSION_ID >= 60100) {
$container->prependExtensionConfig('doctrine', [
'orm' => [
'enable_lazy_ghost_objects' => true,
],
]);
}

if (class_exists(EntityValueResolver::class)) {
$container->prependExtensionConfig('doctrine', [
'orm' => [
Expand Down
1 change: 1 addition & 0 deletions tests/baseline-ignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
%Calling Doctrine\\ORM\\Configuration::getAutoGenerateProxyClasses is deprecated and will not be possible in Doctrine ORM 4.0%
%Calling Doctrine\\ORM\\Configuration::setProxyNamespace is deprecated and will not be possible in Doctrine ORM 4.0%
%Since doctrine/doctrine-bundle 2.16: Not setting "doctrine.orm.enable_native_lazy_objects" to true is deprecated%
%The "report_fields_where_declared" configuration option is deprecated and will be removed in DoctrineBundle 3.0.%
19 changes: 19 additions & 0 deletions tests/config/doctrine.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
doctrine:
dbal:
default_connection: default
connections:
default:
driver: pdo_sqlite
path: '%kernel.cache_dir%/test.sqlite'
types:
dummy_object_id: Meilisearch\Bundle\Tests\Dbal\Type\DummyObjectIdType
orm:
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
auto_mapping: true
mappings:
App:
is_bundle: false
type: attribute
dir: '%kernel.project_dir%/tests/Entity'
prefix: 'Meilisearch\Bundle\Tests\Entity'
alias: App
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
framework:
test: true
secret: 67d829bf61dc5f87a73fd814e2c9f629
http_method_override: false

doctrine:
dbal:
default_connection: default
Expand All @@ -14,7 +9,6 @@ doctrine:
dummy_object_id: Meilisearch\Bundle\Tests\Dbal\Type\DummyObjectIdType
orm:
auto_generate_proxy_classes: true
report_fields_where_declared: true
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
auto_mapping: true
mappings:
Expand Down
10 changes: 0 additions & 10 deletions tests/config/config_php7.yaml → tests/config/doctrine_php7.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
framework:
test: true
secret: 67d829bf61dc5f87a73fd814e2c9f629
http_method_override: false
annotations: true
serializer:
enable_annotations: true
router:
utf8: true

doctrine:
dbal:
default_connection: default
Expand Down
6 changes: 0 additions & 6 deletions tests/config/config.yaml → tests/config/doctrine_v2.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
framework:
test: true
secret: 67d829bf61dc5f87a73fd814e2c9f629
http_method_override: false

doctrine:
dbal:
default_connection: default
Expand All @@ -15,7 +10,6 @@ doctrine:
orm:
enable_native_lazy_objects: true
auto_generate_proxy_classes: false
report_fields_where_declared: true
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
auto_mapping: true
mappings:
Expand Down
4 changes: 4 additions & 0 deletions tests/config/framework.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
framework:
test: true
secret: 67d829bf61dc5f87a73fd814e2c9f629
http_method_override: false
Loading