improve test readability
This commit is contained in:
parent
ae785757a1
commit
0feaf92348
@ -384,17 +384,17 @@ class ManyToManyBasicAssociationTest extends \Doctrine\Tests\OrmFunctionalTestCa
|
|||||||
{
|
{
|
||||||
$user = $this->addCmsUserGblancoWithGroups(1);
|
$user = $this->addCmsUserGblancoWithGroups(1);
|
||||||
|
|
||||||
$group = new CmsGroup;
|
$group1 = new CmsGroup;
|
||||||
$group->name = 'C';
|
$group2 = new CmsGroup;
|
||||||
$user->addGroup($group);
|
$group3 = new CmsGroup;
|
||||||
|
|
||||||
$group = new CmsGroup;
|
$group1->name = 'C';
|
||||||
$group->name = 'A';
|
$group2->name = 'A';
|
||||||
$user->addGroup($group);
|
$group3->name = 'B';
|
||||||
|
|
||||||
$group = new CmsGroup;
|
$user->addGroup($group1);
|
||||||
$group->name = 'B';
|
$user->addGroup($group2);
|
||||||
$user->addGroup($group);
|
$user->addGroup($group3);
|
||||||
|
|
||||||
$this->_em->persist($user);
|
$this->_em->persist($user);
|
||||||
$this->_em->flush();
|
$this->_em->flush();
|
||||||
@ -405,14 +405,17 @@ class ManyToManyBasicAssociationTest extends \Doctrine\Tests\OrmFunctionalTestCa
|
|||||||
|
|
||||||
$criteria = Criteria::create()
|
$criteria = Criteria::create()
|
||||||
->orderBy(['name' => Criteria::ASC]);
|
->orderBy(['name' => Criteria::ASC]);
|
||||||
$groups = $user->getGroups()->matching($criteria);
|
|
||||||
|
|
||||||
$existingOrder = [];
|
$this->assertEquals(
|
||||||
foreach ($groups as $group) {
|
['A', 'B', 'C', 'Developers_0'],
|
||||||
$existingOrder[] = $group->getName();
|
$user
|
||||||
}
|
->getGroups()
|
||||||
|
->matching($criteria)
|
||||||
$this->assertEquals(['A', 'B', 'C', 'Developers_0'], $existingOrder);
|
->map(function (CmsGroup $group) {
|
||||||
|
return $group->getName();
|
||||||
|
})
|
||||||
|
->toArray()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testMatchingWithLimit()
|
public function testMatchingWithLimit()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user