Skip to content

Conversation

@craue
Copy link
Contributor

@craue craue commented Dec 9, 2020

Q A
Branch? 5.2
Bug fix? yes
New feature? no
Deprecations? no
Tickets Fix #39400
License MIT

@carsonbot carsonbot added this to the 5.2 milestone Dec 9, 2020
@carsonbot carsonbot changed the title no-op RegisterUidTypePass if DBAL types aren't loaded [DoctrineBridge] no-op RegisterUidTypePass if DBAL types aren't loaded Dec 9, 2020
@derrabus
Copy link
Member

derrabus commented Dec 9, 2020

Can we add a test for this please?

@craue
Copy link
Contributor Author

craue commented Dec 9, 2020

@derrabus, how?

@jderusse
Copy link
Member

jderusse commented Dec 9, 2020

@derrabus, how?

<?php

namespace Symfony\Bridge\Doctrine\Tests\DependencyInjection\CompilerPass;

use PHPUnit\Framework\TestCase;
use Symfony\Bridge\Doctrine\DependencyInjection\CompilerPass\RegisterUidTypePass;
use Symfony\Bridge\Doctrine\Types\UlidType;
use Symfony\Bridge\Doctrine\Types\UuidType;
use Symfony\Component\DependencyInjection\ContainerBuilder;

class RegisterUidTypePassTest extends TestCase
{
    public function testRegistered()
    {
        $container = new ContainerBuilder();
        $container->setParameter('doctrine.dbal.connection_factory.types', ['foo' => 'bar']);
        (new RegisterUidTypePass())->process($container);

        $expected = [
            'foo' => 'bar',
            'uuid' => ['class' => UuidType::class],
            'ulid' => ['class' => UlidType::class],
        ];
        $this->assertSame($expected, $container->getParameter('doctrine.dbal.connection_factory.types'));
    }

    public function testRegisteredDontFail()
    {
        $container = new ContainerBuilder();
        (new RegisterUidTypePass())->process($container);

        $this->expectNotToPerformAssertions();
    }
}

@craue
Copy link
Contributor Author

craue commented Dec 9, 2020

@jderusse, I see, thanks. Do you want to add it directly?

@jderusse
Copy link
Member

jderusse commented Dec 9, 2020

@jderusse, I see, thanks. Do you want to add it directly?

Yes please, add this class in you PR. This should cover the Pass

@craue
Copy link
Contributor Author

craue commented Dec 9, 2020

@jderusse, what I wanted to know is either if you want to add this commit on your own or if you want me to add it. 😏 I just did now.

Copy link
Member

@derrabus derrabus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great test, @craue! 😉

@derrabus
Copy link
Member

derrabus commented Dec 9, 2020

Thank you @craue.

@derrabus derrabus merged commit 9052b2b into symfony:5.2 Dec 9, 2020
@fabpot fabpot mentioned this pull request Dec 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants