Skip to content

Commit

Permalink
Add failing test for doctrine#6699
Browse files Browse the repository at this point in the history
  • Loading branch information
Majkl578 authored and lcobucci committed Nov 24, 2017
1 parent b47a39b commit 4bbb106
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions tests/Doctrine/Tests/ORM/Functional/Ticket/GH6699Test.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php

namespace Doctrine\Tests\ORM\Functional\Ticket;

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

/**
* @group 6699
*/
final class GH6699Test extends OrmFunctionalTestCase
{
protected function setUp() : void
{
$this->useModelSet('cms');

parent::setUp();
}

public function testMixedParametersWithZeroNumber() : void
{
$query = $this->_em->createQueryBuilder()
->select('u')
->from(CmsUser::class, 'u')
->andWhere('u.username = :username')
->andWhere('u.id = ?0')
->getQuery();

$query->setParameter('username', 'bar');
$query->setParameter(0, 0);

$query->execute();

self::assertCount(2, $query->getParameters());
self::assertSame(0, $query->getParameter(0)->getValue());
self::assertSame('bar', $query->getParameter('username')->getValue());
}

public function testMixedParametersWithZeroNumberOnQueryBuilder() : void
{
$query = $this->_em->createQueryBuilder()
->select('u')
->from(CmsUser::class, 'u')
->andWhere('u.username = :username')
->andWhere('u.id = ?0')
->setParameter('username', 'bar')
->setParameter(0, 0)
->getQuery();

$query->execute();

self::assertCount(2, $query->getParameters());
self::assertSame(0, $query->getParameter(0)->getValue());
self::assertSame('bar', $query->getParameter('username')->getValue());
}
}

0 comments on commit 4bbb106

Please sign in to comment.