DDC-3065 - splitting tests and checking multiple values support
This commit is contained in:
parent
f54d6157f4
commit
eb6498544f
@ -934,18 +934,44 @@ class EntityRepositoryTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
|||||||
*/
|
*/
|
||||||
public function testFindByNullValueInInCondition()
|
public function testFindByNullValueInInCondition()
|
||||||
{
|
{
|
||||||
$user = new CmsUser();
|
$user1 = new CmsUser();
|
||||||
|
$user2 = new CmsUser();
|
||||||
|
|
||||||
$user->username = 'ocramius';
|
$user1->username = 'ocramius';
|
||||||
$user->name = 'Marco';
|
$user1->name = 'Marco';
|
||||||
|
$user2->status = null;
|
||||||
|
$user2->username = 'deeky666';
|
||||||
|
$user2->name = 'Steve';
|
||||||
|
$user2->status = 'dbal maintainer';
|
||||||
|
|
||||||
$this->_em->persist($user);
|
$this->_em->persist($user1);
|
||||||
|
$this->_em->persist($user2);
|
||||||
$this->_em->flush();
|
$this->_em->flush();
|
||||||
|
|
||||||
$users = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsUser')->findBy(array('status' => array(null)));
|
$users = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsUser')->findBy(array('status' => array(null)));
|
||||||
|
|
||||||
$this->assertCount(1, $users);
|
$this->assertCount(1, $users);
|
||||||
$this->assertSame($user, reset($users));
|
$this->assertSame($user1, reset($users));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @group DDC-3056
|
||||||
|
*/
|
||||||
|
public function testFindByNullValueInMultipleInCriteriaValues()
|
||||||
|
{
|
||||||
|
$user1 = new CmsUser();
|
||||||
|
$user2 = new CmsUser();
|
||||||
|
|
||||||
|
$user1->username = 'ocramius';
|
||||||
|
$user1->name = 'Marco';
|
||||||
|
$user2->status = null;
|
||||||
|
$user2->username = 'deeky666';
|
||||||
|
$user2->name = 'Steve';
|
||||||
|
$user2->status = 'dbal maintainer';
|
||||||
|
|
||||||
|
$this->_em->persist($user1);
|
||||||
|
$this->_em->persist($user2);
|
||||||
|
$this->_em->flush();
|
||||||
|
|
||||||
$users = $this
|
$users = $this
|
||||||
->_em
|
->_em
|
||||||
@ -953,7 +979,38 @@ class EntityRepositoryTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
|||||||
->findBy(array('status' => array('foo', null)));
|
->findBy(array('status' => array('foo', null)));
|
||||||
|
|
||||||
$this->assertCount(1, $users);
|
$this->assertCount(1, $users);
|
||||||
$this->assertSame($user, reset($users));
|
$this->assertSame($user1, reset($users));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @group DDC-3056
|
||||||
|
*/
|
||||||
|
public function testFindMultipleByNullValueInMultipleInCriteriaValues()
|
||||||
|
{
|
||||||
|
$user1 = new CmsUser();
|
||||||
|
$user2 = new CmsUser();
|
||||||
|
|
||||||
|
$user1->username = 'ocramius';
|
||||||
|
$user1->name = 'Marco';
|
||||||
|
$user2->status = null;
|
||||||
|
$user2->username = 'deeky666';
|
||||||
|
$user2->name = 'Steve';
|
||||||
|
$user2->status = 'dbal maintainer';
|
||||||
|
|
||||||
|
$this->_em->persist($user1);
|
||||||
|
$this->_em->persist($user2);
|
||||||
|
$this->_em->flush();
|
||||||
|
|
||||||
|
$users = $this
|
||||||
|
->_em
|
||||||
|
->getRepository('Doctrine\Tests\Models\CMS\CmsUser')
|
||||||
|
->findBy(array('status' => array('dbal maintainer', null)));
|
||||||
|
|
||||||
|
$this->assertCount(2, $users);
|
||||||
|
|
||||||
|
foreach ($users as $user) {
|
||||||
|
$this->assertTrue(in_array($user, array($user1, $user2)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user