Skip to content

Commit

Permalink
(Try to) add a reproducer for doctrine#10889
Browse files Browse the repository at this point in the history
  • Loading branch information
mpdude committed Aug 9, 2023
1 parent 597a63a commit c96ed52
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions tests/Doctrine/Tests/ORM/Functional/Ticket/GH10889Test.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

declare(strict_types=1);

namespace Doctrine\Tests\ORM\Functional\Ticket;

use Doctrine\Tests\Models\CMS\CmsAddress;
use Doctrine\Tests\Models\CMS\CmsUser;
use Doctrine\Tests\OrmFunctionalTestCase;

class GH10889Test extends OrmFunctionalTestCase
{
protected function setUp(): void
{
$this->useModelSet('cms');

parent::setUp();
}

public function testDuplicateDqlAliasinSelectClauseShouldNotFail(): void
{
$address = new CmsAddress();
$address->city = 'bonn';
$address->country = 'Germany';
$address->street = 'somestreet!';
$address->zip = 12345;

$user = new CmsUser();
$user->username = 'joedoe';
$user->name = 'joe';
$user->setAddress($address);

$this->_em->persist($address);
$this->_em->persist($user);
$this->_em->flush();

$qb = $this->_em->createQueryBuilder();
$query = $qb->select(['u', 'a'])
->from(CmsUser::class, 'u')
->join('u.address', 'a')
->addSelect('a')
->getQuery();

self::assertCount(1, $query->getResult());
}
}

0 comments on commit c96ed52

Please sign in to comment.