21
21
use ApiPlatform \Core \Tests \Fixtures \TestBundle \Entity \DummyCar ;
22
22
use ApiPlatform \Core \Tests \Fixtures \TestBundle \Entity \DummyCarColor ;
23
23
use ApiPlatform \Core \Tests \Fixtures \TestBundle \Entity \DummyFriend ;
24
+ use ApiPlatform \Core \Tests \Fixtures \TestBundle \Entity \DummyGroup ;
24
25
use ApiPlatform \Core \Tests \Fixtures \TestBundle \Entity \DummyOffer ;
25
26
use ApiPlatform \Core \Tests \Fixtures \TestBundle \Entity \DummyProduct ;
27
+ use ApiPlatform \Core \Tests \Fixtures \TestBundle \Entity \DummyProperty ;
26
28
use ApiPlatform \Core \Tests \Fixtures \TestBundle \Entity \FileConfigDummy ;
27
29
use ApiPlatform \Core \Tests \Fixtures \TestBundle \Entity \Node ;
28
30
use ApiPlatform \Core \Tests \Fixtures \TestBundle \Entity \Question ;
35
37
use Behat \Behat \Context \SnippetAcceptingContext ;
36
38
use Behatch \HttpCall \Request ;
37
39
use Doctrine \Common \Persistence \ManagerRegistry ;
40
+ use Doctrine \Common \Persistence \ObjectManager ;
38
41
use Doctrine \ORM \Tools \SchemaTool ;
39
42
40
43
/**
@@ -45,7 +48,7 @@ class FeatureContext implements Context, SnippetAcceptingContext
45
48
private $ doctrine ;
46
49
47
50
/**
48
- * @var \Doctrine\Common\Persistence\ ObjectManager
51
+ * @var ObjectManager
49
52
*/
50
53
private $ manager ;
51
54
@@ -127,6 +130,46 @@ public function thereIsDummyObjects($nb)
127
130
$ this ->manager ->flush ();
128
131
}
129
132
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
+
130
173
/**
131
174
* @Given there is :nb dummy objects with relatedDummy
132
175
*/
0 commit comments