for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Doctrine\Tests\ORM\Functional\Ticket;
use Doctrine\Tests\OrmFunctionalTestCase;
final class GH7286Test extends OrmFunctionalTestCase
{
/**
* {@inheritDoc}
*/
protected function setUp()
parent::setUp();
$this->setUpEntitySchema(
[
GH7286Entity::class,
]
);
}
public function testLockModeIsRespected()
$entityA = new GH7286Entity('foo', 1);
$entityB = new GH7286Entity('foo', 2);
$entityC = new GH7286Entity('bar', 3);
$this->_em->persist($entityA);
$this->_em->persist($entityB);
$this->_em->persist($entityC);
$this->_em->flush();
$this->_em->clear();
$query = $this->_em->createQuery(
'SELECT CONCAT(e.type, MIN(e.version)) pair'
. ' FROM ' . GH7286Entity::class . ' e'
. ' GROUP BY e.type ORDER BY e.type'
self::assertSame(
['pair' => 'bar3'],
['pair' => 'foo1'],
],
$query->getArrayResult()
* @Entity
class GH7286Entity
* @Id
* @Column(type="integer")
* @GeneratedValue
* @var int
public $id;
* @Column
* @var string
public $type;
public $version;
public function __construct(string $type, int $version)
$this->type = $type;
$this->version = $version;