Skip to content

Commit

Permalink
Fix test and deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
norkunas committed Aug 4, 2023
1 parent fe315e7 commit 863fa3f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 18 deletions.
8 changes: 4 additions & 4 deletions tests/Integration/AggregatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Meilisearch\Bundle\Tests\Integration;

use Doctrine\Persistence\Proxy;
use Meilisearch\Bundle\Exception\EntityNotFoundInObjectID;
use Meilisearch\Bundle\Exception\InvalidEntityForAggregator;
use Meilisearch\Bundle\Tests\BaseKernelTestCase;
Expand Down Expand Up @@ -35,11 +36,10 @@ public function testConstructor(): void
public function testAggregatorProxyClass(): void
{
$this->createPost();
$this->entityManager->clear();

$postMetadata = $this->entityManager->getClassMetadata(Post::class);
$this->entityManager->getProxyFactory()->generateProxyClasses([$postMetadata]);

$proxy = $this->entityManager->getProxyFactory()->getProxy($postMetadata->getName(), ['id' => 1]);
$proxy = $this->entityManager->getReference(Post::class, 1);
$this->assertInstanceOf(Proxy::class, $proxy);
$contentAggregator = new ContentAggregator($proxy, ['objectId']);

/** @var Serializer $serializer */
Expand Down
34 changes: 20 additions & 14 deletions tests/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,29 @@

namespace Meilisearch\Bundle\Tests;

use Composer\InstalledVersions;
use Composer\Semver\VersionParser;
use Doctrine\Bundle\DoctrineBundle\DoctrineBundle;
use Meilisearch\Bundle\MeilisearchBundle;
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\HttpKernel\Bundle\BundleInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symfony\Component\HttpKernel\Kernel as HttpKernel;

/**
* Class Kernel.
*/
class Kernel extends HttpKernel
{
/**
* @return array<int, BundleInterface>
*/
public function registerBundles(): array
use MicroKernelTrait;

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

public function registerContainerConfiguration(LoaderInterface $loader): void
private function configureContainer(ContainerConfigurator $container, LoaderInterface $loader, ContainerBuilder $builder): void

Check failure on line 29 in tests/Kernel.php

View workflow job for this annotation

GitHub Actions / Code style

Method Meilisearch\Bundle\Tests\Kernel::configureContainer() is unused.
{
if (PHP_VERSION_ID >= 80000) {
$loader->load(__DIR__.'/config/config.yaml');
Expand All @@ -37,5 +35,13 @@ public function registerContainerConfiguration(LoaderInterface $loader): void
}
$loader->load(__DIR__.'/../config/services.xml');
$loader->load(__DIR__.'/config/meilisearch.yaml');

if (InstalledVersions::satisfies(new VersionParser(), 'doctrine/doctrine-bundle', '^2.10')) {

Check failure on line 39 in tests/Kernel.php

View workflow job for this annotation

GitHub Actions / Code style

Instantiated class Composer\Semver\VersionParser not found.
$container->prependExtensionConfig('doctrine', [

Check failure on line 40 in tests/Kernel.php

View workflow job for this annotation

GitHub Actions / Code style

Call to an undefined method Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator::prependExtensionConfig().
'orm' => [
'report_fields_where_declared' => true,
],
]);
}
}
}
1 change: 1 addition & 0 deletions tests/config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ doctrine:
orm:
auto_generate_proxy_classes: true
validate_xml_mapping: true
report_fields_where_declared: true
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
auto_mapping: true
mappings:
Expand Down

0 comments on commit 863fa3f

Please sign in to comment.