Skip to content

Fix test and deprecation #278

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 8, 2023
Merged
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
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
4 changes: 3 additions & 1 deletion tests/Integration/DependencyInjectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

declare(strict_types=1);

namespace Meilisearch\Bundle\Tests\Integration;

use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionTestCase;
use Meilisearch\Bundle\DependencyInjection\MeilisearchExtension;
use Meilisearch\Bundle\MeilisearchBundle;

class MeilisearchExtensionTest extends AbstractExtensionTestCase
class DependencyInjectionTest extends AbstractExtensionTestCase
{
protected function getContainerExtensions(): array
{
Expand Down
32 changes: 18 additions & 14 deletions tests/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,27 @@

namespace Meilisearch\Bundle\Tests;

use Doctrine\Bundle\DoctrineBundle\ConnectionFactory;
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\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
protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void
{
if (PHP_VERSION_ID >= 80000) {
$loader->load(__DIR__.'/config/config.yaml');
Expand All @@ -37,5 +33,13 @@ public function registerContainerConfiguration(LoaderInterface $loader): void
}
$loader->load(__DIR__.'/../config/services.xml');
$loader->load(__DIR__.'/config/meilisearch.yaml');

if (defined(ConnectionFactory::class.'::DEFAULT_SCHEME_MAP')) {
$container->prependExtensionConfig('doctrine', [
'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
2 changes: 2 additions & 0 deletions tests/config/config_php7.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ framework:
annotations: true
serializer:
enable_annotations: true
router:
utf8: true

doctrine:
dbal:
Expand Down