Skip to content

Commit e3c17c8

Browse files
meyerbaptistedunglas
authored andcommitted
Add a filter for serialization attributes (#1123)
1 parent 183b0a5 commit e3c17c8

File tree

16 files changed

+2015
-5
lines changed

16 files changed

+2015
-5
lines changed

features/bootstrap/FeatureContext.php

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@
2121
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\DummyCar;
2222
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\DummyCarColor;
2323
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\DummyFriend;
24+
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\DummyGroup;
2425
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\DummyOffer;
2526
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\DummyProduct;
27+
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\DummyProperty;
2628
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\FileConfigDummy;
2729
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\Node;
2830
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\Question;
@@ -35,6 +37,7 @@
3537
use Behat\Behat\Context\SnippetAcceptingContext;
3638
use Behatch\HttpCall\Request;
3739
use Doctrine\Common\Persistence\ManagerRegistry;
40+
use Doctrine\Common\Persistence\ObjectManager;
3841
use Doctrine\ORM\Tools\SchemaTool;
3942

4043
/**
@@ -45,7 +48,7 @@ class FeatureContext implements Context, SnippetAcceptingContext
4548
private $doctrine;
4649

4750
/**
48-
* @var \Doctrine\Common\Persistence\ObjectManager
51+
* @var ObjectManager
4952
*/
5053
private $manager;
5154

@@ -127,6 +130,46 @@ public function thereIsDummyObjects($nb)
127130
$this->manager->flush();
128131
}
129132

133+
/**
134+
* @Given there is :nb dummy group objects
135+
*/
136+
public function thereIsDummyGroupObjects($nb)
137+
{
138+
for ($i = 1; $i <= $nb; ++$i) {
139+
$dummyGroup = new DummyGroup();
140+
141+
foreach (['foo', 'bar', 'baz', 'qux'] as $property) {
142+
$dummyGroup->$property = ucfirst($property).' #'.$i;
143+
}
144+
145+
$this->manager->persist($dummyGroup);
146+
}
147+
148+
$this->manager->flush();
149+
}
150+
151+
/**
152+
* @Given there is :nb dummy property objects
153+
*/
154+
public function thereIsDummyPropertyObjects($nb)
155+
{
156+
for ($i = 1; $i <= $nb; ++$i) {
157+
$dummyProperty = new DummyProperty();
158+
$dummyGroup = new DummyGroup();
159+
160+
foreach (['foo', 'bar', 'baz'] as $property) {
161+
$dummyProperty->$property = $dummyGroup->$property = ucfirst($property).' #'.$i;
162+
}
163+
164+
$dummyProperty->group = $dummyGroup;
165+
166+
$this->manager->persist($dummyGroup);
167+
$this->manager->persist($dummyProperty);
168+
}
169+
170+
$this->manager->flush();
171+
}
172+
130173
/**
131174
* @Given there is :nb dummy objects with relatedDummy
132175
*/

0 commit comments

Comments
 (0)