1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace SimpleEntityGeneratorBundle\Tests\Lib; |
4
|
|
|
|
5
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
6
|
|
|
use SimpleEntityGeneratorBundle\Lib\Items\ClassConstructorManager; |
7
|
|
|
use SimpleEntityGeneratorBundle\Lib\Items\ClassManager; |
8
|
|
|
use SimpleEntityGeneratorBundle\Lib\Items\InitPropertyManager; |
9
|
|
|
use SimpleEntityGeneratorBundle\Lib\Renderer; |
10
|
|
|
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; |
11
|
|
|
use SimpleEntityGeneratorBundle\Lib\ClassConfig; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* Renderer Test |
15
|
|
|
* |
16
|
|
|
* @author Sławomir Kania <[email protected]> |
17
|
|
|
*/ |
18
|
|
|
class RendererTest extends KernelTestCase |
19
|
|
|
{ |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* @var string |
23
|
|
|
*/ |
24
|
|
|
protected $postClassWithUpdatedConstructor = <<<EOT |
25
|
|
|
<?php |
26
|
|
|
|
27
|
|
|
namespace AppBundle\Entity; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* |
31
|
|
|
* |
32
|
|
|
*/ |
33
|
|
|
class Post implements \AppBundle\Entity\PostInterface |
34
|
|
|
{ |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* Post content |
38
|
|
|
* |
39
|
|
|
* @\Symfony\Component\Validator\Constraints\NotBlank() |
40
|
|
|
* @\JMS\Serializer\Annotation\Type("string") |
41
|
|
|
* @\JMS\Serializer\Annotation\SerializedName("content") |
42
|
|
|
* @var string |
43
|
|
|
*/ |
44
|
|
|
private \$content; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* 'created_at' property |
48
|
|
|
* |
49
|
|
|
* |
50
|
|
|
* @\JMS\Serializer\Annotation\Type("DateTime") |
51
|
|
|
* @\JMS\Serializer\Annotation\SerializedName("created_at") |
52
|
|
|
* @var \DateTime |
53
|
|
|
*/ |
54
|
|
|
private \$createdAt; |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* 'updated_at' property |
58
|
|
|
* |
59
|
|
|
* |
60
|
|
|
* @\JMS\Serializer\Annotation\Type("DateTime") |
61
|
|
|
* @\JMS\Serializer\Annotation\SerializedName("updated_at") |
62
|
|
|
* @var \DateTime |
63
|
|
|
*/ |
64
|
|
|
private \$updatedAt; |
65
|
|
|
|
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* Constructor. |
69
|
|
|
*/ |
70
|
|
|
public function __construct() |
71
|
|
|
{ |
72
|
|
|
\$this->collection = new \Doctrine\Common\Collections\ArrayCollection(); |
73
|
|
|
\$this->collection2 = new \Doctrine\Common\Collections\ArrayCollection(); |
74
|
|
|
|
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* For property "content" |
80
|
|
|
* @param string \$content |
81
|
|
|
* @return \$this |
82
|
|
|
*/ |
83
|
|
|
public function setContent(\$content) |
84
|
|
|
{ |
85
|
|
|
\$this->content = \$content; |
86
|
|
|
return \$this; |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* For property "content" |
91
|
|
|
* @return string |
92
|
|
|
*/ |
93
|
|
|
public function getContent() |
94
|
|
|
{ |
95
|
|
|
return \$this->content; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* For property "createdAt" |
100
|
|
|
* @param \DateTime \$createdAt |
101
|
|
|
* @return \$this |
102
|
|
|
*/ |
103
|
|
|
public function setCreatedAt(\DateTime \$createdAt) |
104
|
|
|
{ |
105
|
|
|
\$this->createdAt = \$createdAt; |
106
|
|
|
return \$this; |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* For property "createdAt" |
111
|
|
|
* @return \DateTime |
112
|
|
|
*/ |
113
|
|
|
public function getCreatedAt() |
114
|
|
|
{ |
115
|
|
|
return \$this->createdAt; |
116
|
|
|
} |
117
|
|
|
|
118
|
|
|
/** |
119
|
|
|
* For property "updatedAt" |
120
|
|
|
* @param \DateTime \$updatedAt |
121
|
|
|
* @return \$this |
122
|
|
|
*/ |
123
|
|
|
public function setUpdatedAt(\DateTime \$updatedAt) |
124
|
|
|
{ |
125
|
|
|
\$this->updatedAt = \$updatedAt; |
126
|
|
|
return \$this; |
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
/** |
130
|
|
|
* For property "updatedAt" |
131
|
|
|
* @return \DateTime |
132
|
|
|
*/ |
133
|
|
|
public function getUpdatedAt() |
134
|
|
|
{ |
135
|
|
|
return \$this->updatedAt; |
136
|
|
|
} |
137
|
|
|
|
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
EOT; |
141
|
|
|
|
142
|
|
|
/** |
143
|
|
|
* @var string |
144
|
|
|
*/ |
145
|
|
|
protected $postClassWithNewPropertyExpected = <<<EOT |
146
|
|
|
<?php |
147
|
|
|
|
148
|
|
|
namespace AppBundle\Entity; |
149
|
|
|
|
150
|
|
|
/** |
151
|
|
|
* |
152
|
|
|
* |
153
|
|
|
*/ |
154
|
|
|
class Post implements \AppBundle\Entity\PostInterface |
155
|
|
|
{ |
156
|
|
|
|
157
|
|
|
/** |
158
|
|
|
* Post content |
159
|
|
|
* |
160
|
|
|
* @\Symfony\Component\Validator\Constraints\NotBlank() |
161
|
|
|
* @\JMS\Serializer\Annotation\Type("string") |
162
|
|
|
* @\JMS\Serializer\Annotation\SerializedName("content") |
163
|
|
|
* @var string |
164
|
|
|
*/ |
165
|
|
|
private \$content; |
166
|
|
|
|
167
|
|
|
/** |
168
|
|
|
* 'created_at' property |
169
|
|
|
* |
170
|
|
|
* |
171
|
|
|
* @\JMS\Serializer\Annotation\Type("DateTime") |
172
|
|
|
* @\JMS\Serializer\Annotation\SerializedName("created_at") |
173
|
|
|
* @var \DateTime |
174
|
|
|
*/ |
175
|
|
|
private \$createdAt; |
176
|
|
|
|
177
|
|
|
/** |
178
|
|
|
* 'updated_at' property |
179
|
|
|
* |
180
|
|
|
* |
181
|
|
|
* @\JMS\Serializer\Annotation\Type("DateTime") |
182
|
|
|
* @\JMS\Serializer\Annotation\SerializedName("updated_at") |
183
|
|
|
* @var \DateTime |
184
|
|
|
*/ |
185
|
|
|
private \$updatedAt; |
186
|
|
|
|
187
|
|
|
/** |
188
|
|
|
* is post active |
189
|
|
|
* |
190
|
|
|
* @\Symfony\Component\Validator\Constraints\IsTrue() |
191
|
|
|
* @\JMS\Serializer\Annotation\Type("boolean") |
192
|
|
|
* @\JMS\Serializer\Annotation\SerializedName("active") |
193
|
|
|
* @var boolean |
194
|
|
|
*/ |
195
|
|
|
private \$active; |
196
|
|
|
|
197
|
|
|
|
198
|
|
|
/** |
199
|
|
|
* Constructor. |
200
|
|
|
*/ |
201
|
|
|
public function __construct() |
202
|
|
|
{ |
203
|
|
|
|
204
|
|
|
} |
205
|
|
|
|
206
|
|
|
|
207
|
|
|
/** |
208
|
|
|
* For property "content" |
209
|
|
|
* @param string \$content |
210
|
|
|
* @return \$this |
211
|
|
|
*/ |
212
|
|
|
public function setContent(\$content) |
213
|
|
|
{ |
214
|
|
|
\$this->content = \$content; |
215
|
|
|
return \$this; |
216
|
|
|
} |
217
|
|
|
|
218
|
|
|
/** |
219
|
|
|
* For property "content" |
220
|
|
|
* @return string |
221
|
|
|
*/ |
222
|
|
|
public function getContent() |
223
|
|
|
{ |
224
|
|
|
return \$this->content; |
225
|
|
|
} |
226
|
|
|
|
227
|
|
|
/** |
228
|
|
|
* For property "createdAt" |
229
|
|
|
* @param \DateTime \$createdAt |
230
|
|
|
* @return \$this |
231
|
|
|
*/ |
232
|
|
|
public function setCreatedAt(\DateTime \$createdAt) |
233
|
|
|
{ |
234
|
|
|
\$this->createdAt = \$createdAt; |
235
|
|
|
return \$this; |
236
|
|
|
} |
237
|
|
|
|
238
|
|
|
/** |
239
|
|
|
* For property "createdAt" |
240
|
|
|
* @return \DateTime |
241
|
|
|
*/ |
242
|
|
|
public function getCreatedAt() |
243
|
|
|
{ |
244
|
|
|
return \$this->createdAt; |
245
|
|
|
} |
246
|
|
|
|
247
|
|
|
/** |
248
|
|
|
* For property "updatedAt" |
249
|
|
|
* @param \DateTime \$updatedAt |
250
|
|
|
* @return \$this |
251
|
|
|
*/ |
252
|
|
|
public function setUpdatedAt(\DateTime \$updatedAt) |
253
|
|
|
{ |
254
|
|
|
\$this->updatedAt = \$updatedAt; |
255
|
|
|
return \$this; |
256
|
|
|
} |
257
|
|
|
|
258
|
|
|
/** |
259
|
|
|
* For property "updatedAt" |
260
|
|
|
* @return \DateTime |
261
|
|
|
*/ |
262
|
|
|
public function getUpdatedAt() |
263
|
|
|
{ |
264
|
|
|
return \$this->updatedAt; |
265
|
|
|
} |
266
|
|
|
|
267
|
|
|
} |
268
|
|
|
|
269
|
|
|
EOT; |
270
|
|
|
|
271
|
|
|
/** |
272
|
|
|
* @var string |
273
|
|
|
*/ |
274
|
|
|
protected $postClassExpected = <<<EOT |
275
|
|
|
<?php |
276
|
|
|
|
277
|
|
|
namespace AppBundle\Entity; |
278
|
|
|
|
279
|
|
|
/** |
280
|
|
|
* |
281
|
|
|
* |
282
|
|
|
*/ |
283
|
|
|
class Post implements \AppBundle\Entity\PostInterface |
284
|
|
|
{ |
285
|
|
|
|
286
|
|
|
/** |
287
|
|
|
* Post content |
288
|
|
|
* |
289
|
|
|
* @\Symfony\Component\Validator\Constraints\NotBlank() |
290
|
|
|
* @\JMS\Serializer\Annotation\Type("string") |
291
|
|
|
* @\JMS\Serializer\Annotation\SerializedName("content") |
292
|
|
|
* @var string |
293
|
|
|
*/ |
294
|
|
|
private \$content; |
295
|
|
|
|
296
|
|
|
/** |
297
|
|
|
* 'created_at' property |
298
|
|
|
* |
299
|
|
|
* |
300
|
|
|
* @\JMS\Serializer\Annotation\Type("DateTime") |
301
|
|
|
* @\JMS\Serializer\Annotation\SerializedName("created_at") |
302
|
|
|
* @var \DateTime |
303
|
|
|
*/ |
304
|
|
|
private \$createdAt; |
305
|
|
|
|
306
|
|
|
/** |
307
|
|
|
* 'updated_at' property |
308
|
|
|
* |
309
|
|
|
* |
310
|
|
|
* @\JMS\Serializer\Annotation\Type("DateTime") |
311
|
|
|
* @\JMS\Serializer\Annotation\SerializedName("updated_at") |
312
|
|
|
* @var \DateTime |
313
|
|
|
*/ |
314
|
|
|
private \$updatedAt; |
315
|
|
|
|
316
|
|
|
|
317
|
|
|
/** |
318
|
|
|
* Constructor. |
319
|
|
|
*/ |
320
|
|
|
public function __construct() |
321
|
|
|
{ |
322
|
|
|
|
323
|
|
|
} |
324
|
|
|
|
325
|
|
|
|
326
|
|
|
/** |
327
|
|
|
* For property "content" |
328
|
|
|
* @param string \$content |
329
|
|
|
* @return \$this |
330
|
|
|
*/ |
331
|
|
|
public function setContent(\$content) |
332
|
|
|
{ |
333
|
|
|
\$this->content = \$content; |
334
|
|
|
return \$this; |
335
|
|
|
} |
336
|
|
|
|
337
|
|
|
/** |
338
|
|
|
* For property "content" |
339
|
|
|
* @return string |
340
|
|
|
*/ |
341
|
|
|
public function getContent() |
342
|
|
|
{ |
343
|
|
|
return \$this->content; |
344
|
|
|
} |
345
|
|
|
|
346
|
|
|
/** |
347
|
|
|
* For property "createdAt" |
348
|
|
|
* @param \DateTime \$createdAt |
349
|
|
|
* @return \$this |
350
|
|
|
*/ |
351
|
|
|
public function setCreatedAt(\DateTime \$createdAt) |
352
|
|
|
{ |
353
|
|
|
\$this->createdAt = \$createdAt; |
354
|
|
|
return \$this; |
355
|
|
|
} |
356
|
|
|
|
357
|
|
|
/** |
358
|
|
|
* For property "createdAt" |
359
|
|
|
* @return \DateTime |
360
|
|
|
*/ |
361
|
|
|
public function getCreatedAt() |
362
|
|
|
{ |
363
|
|
|
return \$this->createdAt; |
364
|
|
|
} |
365
|
|
|
|
366
|
|
|
/** |
367
|
|
|
* For property "updatedAt" |
368
|
|
|
* @param \DateTime \$updatedAt |
369
|
|
|
* @return \$this |
370
|
|
|
*/ |
371
|
|
|
public function setUpdatedAt(\DateTime \$updatedAt) |
372
|
|
|
{ |
373
|
|
|
\$this->updatedAt = \$updatedAt; |
374
|
|
|
return \$this; |
375
|
|
|
} |
376
|
|
|
|
377
|
|
|
/** |
378
|
|
|
* For property "updatedAt" |
379
|
|
|
* @return \DateTime |
380
|
|
|
*/ |
381
|
|
|
public function getUpdatedAt() |
382
|
|
|
{ |
383
|
|
|
return \$this->updatedAt; |
384
|
|
|
} |
385
|
|
|
|
386
|
|
|
} |
387
|
|
|
|
388
|
|
|
EOT; |
389
|
|
|
|
390
|
|
|
/** |
391
|
|
|
* @var string |
392
|
|
|
*/ |
393
|
|
|
protected $userClassExpected = <<<EOT |
394
|
|
|
<?php |
395
|
|
|
|
396
|
|
|
namespace AppBundle\Entity; |
397
|
|
|
|
398
|
|
|
/** |
399
|
|
|
* New User entity |
400
|
|
|
* lorem ipsum |
401
|
|
|
* second row |
402
|
|
|
* @\Doctrine\Common\Annotations\Entity() |
403
|
|
|
*/ |
404
|
|
|
class User extends \AppBundle\Entity\Base implements \Symfony\Component\Security\Core\User\UserInterface, \SimpleEntityGeneratorBundle\Tests\Lib\Dummies\CredentialsAwareInterface, \AppBundle\Entity\UserInterface |
405
|
|
|
{ |
406
|
|
|
|
407
|
|
|
/** |
408
|
|
|
* Username for login |
409
|
|
|
* |
410
|
|
|
* @\Symfony\Component\Validator\Constraints\NotBlank(message = "Login can not be empty") |
411
|
|
|
* @\Symfony\Component\Validator\Constraints\NotNull(message = "Login can not be null") |
412
|
|
|
* @\JMS\Serializer\Annotation\Type("string") |
413
|
|
|
* @\JMS\Serializer\Annotation\SerializedName("username") |
414
|
|
|
* @var string |
415
|
|
|
*/ |
416
|
|
|
private \$username; |
417
|
|
|
|
418
|
|
|
/** |
419
|
|
|
* User email |
420
|
|
|
* @\Doctrine\Common\Annotations\Column() |
421
|
|
|
* lorem ipsum |
422
|
|
|
* third row |
423
|
|
|
* @\Symfony\Component\Validator\Constraints\NotBlank() |
424
|
|
|
* @\Symfony\Component\Validator\Constraints\Email(message = "Invalid email") |
425
|
|
|
* @\JMS\Serializer\Annotation\Type("string") |
426
|
|
|
* @\JMS\Serializer\Annotation\SerializedName("email") |
427
|
|
|
* @var string |
428
|
|
|
*/ |
429
|
|
|
private \$email; |
430
|
|
|
|
431
|
|
|
/** |
432
|
|
|
* Wether user is active or not |
433
|
|
|
* |
434
|
|
|
* @\Symfony\Component\Validator\Constraints\IsTrue() |
435
|
|
|
* @\JMS\Serializer\Annotation\Type("boolean") |
436
|
|
|
* @\JMS\Serializer\Annotation\SerializedName("active") |
437
|
|
|
* @var boolean |
438
|
|
|
*/ |
439
|
|
|
private \$active; |
440
|
|
|
|
441
|
|
|
/** |
442
|
|
|
* User posts |
443
|
|
|
* |
444
|
|
|
* |
445
|
|
|
* @\JMS\Serializer\Annotation\Type("Doctrine\Common\Collections\ArrayCollection<AppBundle\Entity\Post>") |
446
|
|
|
* @\JMS\Serializer\Annotation\SerializedName("posts") |
447
|
|
|
* @var \Doctrine\Common\Collections\ArrayCollection |
448
|
|
|
*/ |
449
|
|
|
private \$posts; |
450
|
|
|
|
451
|
|
|
/** |
452
|
|
|
* 'created_at' property |
453
|
|
|
* |
454
|
|
|
* |
455
|
|
|
* @\JMS\Serializer\Annotation\Type("DateTime") |
456
|
|
|
* @\JMS\Serializer\Annotation\SerializedName("created_at") |
457
|
|
|
* @var \DateTime |
458
|
|
|
*/ |
459
|
|
|
private \$createdAt; |
460
|
|
|
|
461
|
|
|
/** |
462
|
|
|
* 'updated_at' property |
463
|
|
|
* |
464
|
|
|
* |
465
|
|
|
* @\JMS\Serializer\Annotation\Type("DateTime") |
466
|
|
|
* @\JMS\Serializer\Annotation\SerializedName("updated_at") |
467
|
|
|
* @var \DateTime |
468
|
|
|
*/ |
469
|
|
|
private \$updatedAt; |
470
|
|
|
|
471
|
|
|
/** |
472
|
|
|
* 'last_post' property |
473
|
|
|
* |
474
|
|
|
* |
475
|
|
|
* @\JMS\Serializer\Annotation\Type("AppBundle\Entity\Post") |
476
|
|
|
* @\JMS\Serializer\Annotation\SerializedName("lastPost") |
477
|
|
|
* @var \AppBundle\Entity\Post |
478
|
|
|
*/ |
479
|
|
|
private \$lastPost; |
480
|
|
|
|
481
|
|
|
/** |
482
|
|
|
* 'roles' property |
483
|
|
|
* |
484
|
|
|
* |
485
|
|
|
* @\JMS\Serializer\Annotation\Type("string") |
486
|
|
|
* @\JMS\Serializer\Annotation\SerializedName("roles") |
487
|
|
|
* @var string |
488
|
|
|
*/ |
489
|
|
|
private \$roles; |
490
|
|
|
|
491
|
|
|
|
492
|
|
|
/** |
493
|
|
|
* Constructor. |
494
|
|
|
*/ |
495
|
|
|
public function __construct() |
496
|
|
|
{ |
497
|
|
|
\$this->posts = new \Doctrine\Common\Collections\ArrayCollection(); |
498
|
|
|
} |
499
|
|
|
|
500
|
|
|
|
501
|
|
|
/** |
502
|
|
|
* For property "username" |
503
|
|
|
* @param string \$username |
504
|
|
|
* @return \$this |
505
|
|
|
*/ |
506
|
|
|
public function setUsername(\$username) |
507
|
|
|
{ |
508
|
|
|
\$this->username = \$username; |
509
|
|
|
return \$this; |
510
|
|
|
} |
511
|
|
|
|
512
|
|
|
/** |
513
|
|
|
* For property "username" |
514
|
|
|
* @return string |
515
|
|
|
*/ |
516
|
|
|
public function getUsername() |
517
|
|
|
{ |
518
|
|
|
return \$this->username; |
519
|
|
|
} |
520
|
|
|
|
521
|
|
|
/** |
522
|
|
|
* For property "email" |
523
|
|
|
* @param string \$email |
524
|
|
|
* @return \$this |
525
|
|
|
*/ |
526
|
|
|
public function setEmail(\$email) |
527
|
|
|
{ |
528
|
|
|
\$this->email = \$email; |
529
|
|
|
return \$this; |
530
|
|
|
} |
531
|
|
|
|
532
|
|
|
/** |
533
|
|
|
* For property "email" |
534
|
|
|
* @return string |
535
|
|
|
*/ |
536
|
|
|
public function getEmail() |
537
|
|
|
{ |
538
|
|
|
return \$this->email; |
539
|
|
|
} |
540
|
|
|
|
541
|
|
|
/** |
542
|
|
|
* For property "active" |
543
|
|
|
* @return boolean |
544
|
|
|
*/ |
545
|
|
|
public function isActive() |
546
|
|
|
{ |
547
|
|
|
return (bool) \$this->active; |
548
|
|
|
} |
549
|
|
|
|
550
|
|
|
/** |
551
|
|
|
* For property "active" |
552
|
|
|
* @param boolean \$active |
553
|
|
|
* @return \$this |
554
|
|
|
*/ |
555
|
|
|
public function setActive(\$active) |
556
|
|
|
{ |
557
|
|
|
\$this->active = \$active; |
558
|
|
|
return \$this; |
559
|
|
|
} |
560
|
|
|
|
561
|
|
|
/** |
562
|
|
|
* For property "active" |
563
|
|
|
* @return boolean |
564
|
|
|
*/ |
565
|
|
|
public function getActive() |
566
|
|
|
{ |
567
|
|
|
return \$this->active; |
568
|
|
|
} |
569
|
|
|
|
570
|
|
|
/** |
571
|
|
|
* For property "posts" |
572
|
|
|
* @param \Doctrine\Common\Collections\ArrayCollection \$posts |
573
|
|
|
* @return \$this |
574
|
|
|
*/ |
575
|
|
|
public function setPosts(\Doctrine\Common\Collections\ArrayCollection \$posts) |
576
|
|
|
{ |
577
|
|
|
\$this->posts = \$posts; |
578
|
|
|
return \$this; |
579
|
|
|
} |
580
|
|
|
|
581
|
|
|
/** |
582
|
|
|
* For property "posts" |
583
|
|
|
* @return \Doctrine\Common\Collections\ArrayCollection |
584
|
|
|
*/ |
585
|
|
|
public function getPosts() |
586
|
|
|
{ |
587
|
|
|
return \$this->posts; |
588
|
|
|
} |
589
|
|
|
|
590
|
|
|
/** |
591
|
|
|
* For property "createdAt" |
592
|
|
|
* @param \DateTime \$createdAt |
593
|
|
|
* @return \$this |
594
|
|
|
*/ |
595
|
|
|
public function setCreatedAt(\DateTime \$createdAt) |
596
|
|
|
{ |
597
|
|
|
\$this->createdAt = \$createdAt; |
598
|
|
|
return \$this; |
599
|
|
|
} |
600
|
|
|
|
601
|
|
|
/** |
602
|
|
|
* For property "createdAt" |
603
|
|
|
* @return \DateTime |
604
|
|
|
*/ |
605
|
|
|
public function getCreatedAt() |
606
|
|
|
{ |
607
|
|
|
return \$this->createdAt; |
608
|
|
|
} |
609
|
|
|
|
610
|
|
|
/** |
611
|
|
|
* For property "updatedAt" |
612
|
|
|
* @param \DateTime \$updatedAt |
613
|
|
|
* @return \$this |
614
|
|
|
*/ |
615
|
|
|
public function setUpdatedAt(\DateTime \$updatedAt) |
616
|
|
|
{ |
617
|
|
|
\$this->updatedAt = \$updatedAt; |
618
|
|
|
return \$this; |
619
|
|
|
} |
620
|
|
|
|
621
|
|
|
/** |
622
|
|
|
* For property "updatedAt" |
623
|
|
|
* @return \DateTime |
624
|
|
|
*/ |
625
|
|
|
public function getUpdatedAt() |
626
|
|
|
{ |
627
|
|
|
return \$this->updatedAt; |
628
|
|
|
} |
629
|
|
|
|
630
|
|
|
/** |
631
|
|
|
* For property "lastPost" |
632
|
|
|
* @param \AppBundle\Entity\Post \$lastPost |
633
|
|
|
* @return \$this |
634
|
|
|
*/ |
635
|
|
|
public function setLastPost(\AppBundle\Entity\Post \$lastPost = null) |
636
|
|
|
{ |
637
|
|
|
\$this->lastPost = \$lastPost; |
638
|
|
|
return \$this; |
639
|
|
|
} |
640
|
|
|
|
641
|
|
|
/** |
642
|
|
|
* For property "lastPost" |
643
|
|
|
* @return \AppBundle\Entity\Post |
644
|
|
|
*/ |
645
|
|
|
public function getLastPost() |
646
|
|
|
{ |
647
|
|
|
return \$this->lastPost; |
648
|
|
|
} |
649
|
|
|
|
650
|
|
|
/** |
651
|
|
|
* For property "roles" |
652
|
|
|
* @param string \$roles |
653
|
|
|
* @return \$this |
654
|
|
|
*/ |
655
|
|
|
public function setRoles(\$roles) |
656
|
|
|
{ |
657
|
|
|
\$this->roles = \$roles; |
658
|
|
|
return \$this; |
659
|
|
|
} |
660
|
|
|
|
661
|
|
|
/** |
662
|
|
|
* For property "roles" |
663
|
|
|
* @return string |
664
|
|
|
*/ |
665
|
|
|
public function getRoles() |
666
|
|
|
{ |
667
|
|
|
return \$this->roles; |
668
|
|
|
} |
669
|
|
|
|
670
|
|
|
/** |
671
|
|
|
* @inheritdoc |
672
|
|
|
*/ |
673
|
|
|
public function getPassword() |
674
|
|
|
{ |
675
|
|
|
// TODO: Implement getPassword() method. |
676
|
|
|
} |
677
|
|
|
|
678
|
|
|
/** |
679
|
|
|
* @inheritdoc |
680
|
|
|
*/ |
681
|
|
|
public function getSalt() |
682
|
|
|
{ |
683
|
|
|
// TODO: Implement getSalt() method. |
684
|
|
|
} |
685
|
|
|
|
686
|
|
|
/** |
687
|
|
|
* @inheritdoc |
688
|
|
|
*/ |
689
|
|
|
public function eraseCredentials() |
690
|
|
|
{ |
691
|
|
|
// TODO: Implement eraseCredentials() method. |
692
|
|
|
} |
693
|
|
|
|
694
|
|
|
/** |
695
|
|
|
* @inheritdoc |
696
|
|
|
*/ |
697
|
|
|
public function getCredentials() |
698
|
|
|
{ |
699
|
|
|
// TODO: Implement getCredentials() method. |
700
|
|
|
} |
701
|
|
|
|
702
|
|
|
} |
703
|
|
|
|
704
|
|
|
EOT; |
705
|
|
|
|
706
|
|
|
/** |
707
|
|
|
* @var string |
708
|
|
|
*/ |
709
|
|
|
protected $userInterfaceExpected = <<<EOT |
710
|
|
|
<?php |
711
|
|
|
|
712
|
|
|
namespace AppBundle\Entity; |
713
|
|
|
|
714
|
|
|
/** |
715
|
|
|
* Interface for entity : \AppBundle\Entity\User |
716
|
|
|
*/ |
717
|
|
|
interface UserInterface |
718
|
|
|
{ |
719
|
|
|
|
720
|
|
|
/** |
721
|
|
|
* For property "username" |
722
|
|
|
* @param string \$username |
723
|
|
|
* @return \$this |
724
|
|
|
*/ |
725
|
|
|
public function setUsername(\$username); |
726
|
|
|
|
727
|
|
|
/** |
728
|
|
|
* For property "username" |
729
|
|
|
* @return string |
730
|
|
|
*/ |
731
|
|
|
public function getUsername(); |
732
|
|
|
|
733
|
|
|
/** |
734
|
|
|
* For property "email" |
735
|
|
|
* @param string \$email |
736
|
|
|
* @return \$this |
737
|
|
|
*/ |
738
|
|
|
public function setEmail(\$email); |
739
|
|
|
|
740
|
|
|
/** |
741
|
|
|
* For property "email" |
742
|
|
|
* @return string |
743
|
|
|
*/ |
744
|
|
|
public function getEmail(); |
745
|
|
|
|
746
|
|
|
/** |
747
|
|
|
* For property "active" |
748
|
|
|
* @return boolean |
749
|
|
|
*/ |
750
|
|
|
public function isActive(); |
751
|
|
|
|
752
|
|
|
/** |
753
|
|
|
* For property "active" |
754
|
|
|
* @param boolean \$active |
755
|
|
|
* @return \$this |
756
|
|
|
*/ |
757
|
|
|
public function setActive(\$active); |
758
|
|
|
|
759
|
|
|
/** |
760
|
|
|
* For property "active" |
761
|
|
|
* @return boolean |
762
|
|
|
*/ |
763
|
|
|
public function getActive(); |
764
|
|
|
|
765
|
|
|
/** |
766
|
|
|
* For property "posts" |
767
|
|
|
* @param \Doctrine\Common\Collections\ArrayCollection \$posts |
768
|
|
|
* @return \$this |
769
|
|
|
*/ |
770
|
|
|
public function setPosts(\Doctrine\Common\Collections\ArrayCollection \$posts); |
771
|
|
|
|
772
|
|
|
/** |
773
|
|
|
* For property "posts" |
774
|
|
|
* @return \Doctrine\Common\Collections\ArrayCollection |
775
|
|
|
*/ |
776
|
|
|
public function getPosts(); |
777
|
|
|
|
778
|
|
|
/** |
779
|
|
|
* For property "createdAt" |
780
|
|
|
* @param \DateTime \$createdAt |
781
|
|
|
* @return \$this |
782
|
|
|
*/ |
783
|
|
|
public function setCreatedAt(\DateTime \$createdAt); |
784
|
|
|
|
785
|
|
|
/** |
786
|
|
|
* For property "createdAt" |
787
|
|
|
* @return \DateTime |
788
|
|
|
*/ |
789
|
|
|
public function getCreatedAt(); |
790
|
|
|
|
791
|
|
|
/** |
792
|
|
|
* For property "updatedAt" |
793
|
|
|
* @param \DateTime \$updatedAt |
794
|
|
|
* @return \$this |
795
|
|
|
*/ |
796
|
|
|
public function setUpdatedAt(\DateTime \$updatedAt); |
797
|
|
|
|
798
|
|
|
/** |
799
|
|
|
* For property "updatedAt" |
800
|
|
|
* @return \DateTime |
801
|
|
|
*/ |
802
|
|
|
public function getUpdatedAt(); |
803
|
|
|
|
804
|
|
|
/** |
805
|
|
|
* For property "lastPost" |
806
|
|
|
* @param \AppBundle\Entity\Post \$lastPost |
807
|
|
|
* @return \$this |
808
|
|
|
*/ |
809
|
|
|
public function setLastPost(\AppBundle\Entity\Post \$lastPost = null); |
810
|
|
|
|
811
|
|
|
/** |
812
|
|
|
* For property "lastPost" |
813
|
|
|
* @return \AppBundle\Entity\Post |
814
|
|
|
*/ |
815
|
|
|
public function getLastPost(); |
816
|
|
|
|
817
|
|
|
/** |
818
|
|
|
* For property "roles" |
819
|
|
|
* @param string \$roles |
820
|
|
|
* @return \$this |
821
|
|
|
*/ |
822
|
|
|
public function setRoles(\$roles); |
823
|
|
|
|
824
|
|
|
/** |
825
|
|
|
* For property "roles" |
826
|
|
|
* @return string |
827
|
|
|
*/ |
828
|
|
|
public function getRoles(); |
829
|
|
|
|
830
|
|
|
} |
831
|
|
|
|
832
|
|
|
EOT; |
833
|
|
|
|
834
|
|
|
/** |
835
|
|
|
* @var string |
836
|
|
|
*/ |
837
|
|
|
protected $postInterfaceExpected = <<<EOT |
838
|
|
|
<?php |
839
|
|
|
|
840
|
|
|
namespace AppBundle\Entity; |
841
|
|
|
|
842
|
|
|
/** |
843
|
|
|
* Interface for entity : \AppBundle\Entity\Post |
844
|
|
|
*/ |
845
|
|
|
interface PostInterface |
846
|
|
|
{ |
847
|
|
|
|
848
|
|
|
/** |
849
|
|
|
* For property "content" |
850
|
|
|
* @param string \$content |
851
|
|
|
* @return \$this |
852
|
|
|
*/ |
853
|
|
|
public function setContent(\$content); |
854
|
|
|
|
855
|
|
|
/** |
856
|
|
|
* For property "content" |
857
|
|
|
* @return string |
858
|
|
|
*/ |
859
|
|
|
public function getContent(); |
860
|
|
|
|
861
|
|
|
/** |
862
|
|
|
* For property "createdAt" |
863
|
|
|
* @param \DateTime \$createdAt |
864
|
|
|
* @return \$this |
865
|
|
|
*/ |
866
|
|
|
public function setCreatedAt(\DateTime \$createdAt); |
867
|
|
|
|
868
|
|
|
/** |
869
|
|
|
* For property "createdAt" |
870
|
|
|
* @return \DateTime |
871
|
|
|
*/ |
872
|
|
|
public function getCreatedAt(); |
873
|
|
|
|
874
|
|
|
/** |
875
|
|
|
* For property "updatedAt" |
876
|
|
|
* @param \DateTime \$updatedAt |
877
|
|
|
* @return \$this |
878
|
|
|
*/ |
879
|
|
|
public function setUpdatedAt(\DateTime \$updatedAt); |
880
|
|
|
|
881
|
|
|
/** |
882
|
|
|
* For property "updatedAt" |
883
|
|
|
* @return \DateTime |
884
|
|
|
*/ |
885
|
|
|
public function getUpdatedAt(); |
886
|
|
|
|
887
|
|
|
} |
888
|
|
|
|
889
|
|
|
EOT; |
890
|
|
|
|
891
|
|
|
/** |
892
|
|
|
* @var string |
893
|
|
|
*/ |
894
|
|
|
protected $userTestClassExpected = <<<EOT |
895
|
|
|
<?php |
896
|
|
|
|
897
|
|
|
namespace AppBundle\Tests\Entity; |
898
|
|
|
|
899
|
|
|
/** |
900
|
|
|
* Test for \AppBundle\Entity\User |
901
|
|
|
*/ |
902
|
|
|
class UserTest extends \PHPUnit_Framework_TestCase |
903
|
|
|
{ |
904
|
|
|
|
905
|
|
|
/** |
906
|
|
|
* Entity to test |
907
|
|
|
* @var \AppBundle\Entity\UserInterface |
908
|
|
|
*/ |
909
|
|
|
private \$object = null; |
910
|
|
|
|
911
|
|
|
public function setUp() |
912
|
|
|
{ |
913
|
|
|
\$this->object = new \AppBundle\Entity\User(); |
914
|
|
|
} |
915
|
|
|
|
916
|
|
|
public function testConstructor() |
917
|
|
|
{ |
918
|
|
|
\$this->assertNotNull(\$this->object); |
919
|
|
|
\$this->assertInstanceof('\AppBundle\Entity\UserInterface', \$this->object); |
920
|
|
|
\$this->assertInstanceof('\AppBundle\Entity\User', \$this->object); |
921
|
|
|
\$this->assertInstanceof('\AppBundle\Entity\Base', \$this->object); |
922
|
|
|
} |
923
|
|
|
|
924
|
|
|
|
925
|
|
|
/** |
926
|
|
|
* @covers \AppBundle\Entity\User::setUsername |
927
|
|
|
*/ |
928
|
|
|
public function testSetUsername() |
929
|
|
|
{ |
930
|
|
|
\$this->markTestIncomplete( |
931
|
|
|
'This test has not been implemented yet.' |
932
|
|
|
); |
933
|
|
|
} |
934
|
|
|
|
935
|
|
|
/** |
936
|
|
|
* @covers \AppBundle\Entity\User::getUsername |
937
|
|
|
*/ |
938
|
|
|
public function testGetUsername() |
939
|
|
|
{ |
940
|
|
|
\$this->markTestIncomplete( |
941
|
|
|
'This test has not been implemented yet.' |
942
|
|
|
); |
943
|
|
|
} |
944
|
|
|
|
945
|
|
|
/** |
946
|
|
|
* @covers \AppBundle\Entity\User::setEmail |
947
|
|
|
*/ |
948
|
|
|
public function testSetEmail() |
949
|
|
|
{ |
950
|
|
|
\$this->markTestIncomplete( |
951
|
|
|
'This test has not been implemented yet.' |
952
|
|
|
); |
953
|
|
|
} |
954
|
|
|
|
955
|
|
|
/** |
956
|
|
|
* @covers \AppBundle\Entity\User::getEmail |
957
|
|
|
*/ |
958
|
|
|
public function testGetEmail() |
959
|
|
|
{ |
960
|
|
|
\$this->markTestIncomplete( |
961
|
|
|
'This test has not been implemented yet.' |
962
|
|
|
); |
963
|
|
|
} |
964
|
|
|
|
965
|
|
|
/** |
966
|
|
|
* @covers \AppBundle\Entity\User::isActive |
967
|
|
|
*/ |
968
|
|
|
public function testIsActive() |
969
|
|
|
{ |
970
|
|
|
\$this->markTestIncomplete( |
971
|
|
|
'This test has not been implemented yet.' |
972
|
|
|
); |
973
|
|
|
} |
974
|
|
|
|
975
|
|
|
/** |
976
|
|
|
* @covers \AppBundle\Entity\User::setActive |
977
|
|
|
*/ |
978
|
|
|
public function testSetActive() |
979
|
|
|
{ |
980
|
|
|
\$this->markTestIncomplete( |
981
|
|
|
'This test has not been implemented yet.' |
982
|
|
|
); |
983
|
|
|
} |
984
|
|
|
|
985
|
|
|
/** |
986
|
|
|
* @covers \AppBundle\Entity\User::getActive |
987
|
|
|
*/ |
988
|
|
|
public function testGetActive() |
989
|
|
|
{ |
990
|
|
|
\$this->markTestIncomplete( |
991
|
|
|
'This test has not been implemented yet.' |
992
|
|
|
); |
993
|
|
|
} |
994
|
|
|
|
995
|
|
|
/** |
996
|
|
|
* @covers \AppBundle\Entity\User::setPosts |
997
|
|
|
*/ |
998
|
|
|
public function testSetPosts() |
999
|
|
|
{ |
1000
|
|
|
\$this->markTestIncomplete( |
1001
|
|
|
'This test has not been implemented yet.' |
1002
|
|
|
); |
1003
|
|
|
} |
1004
|
|
|
|
1005
|
|
|
/** |
1006
|
|
|
* @covers \AppBundle\Entity\User::getPosts |
1007
|
|
|
*/ |
1008
|
|
|
public function testGetPosts() |
1009
|
|
|
{ |
1010
|
|
|
\$this->markTestIncomplete( |
1011
|
|
|
'This test has not been implemented yet.' |
1012
|
|
|
); |
1013
|
|
|
} |
1014
|
|
|
|
1015
|
|
|
/** |
1016
|
|
|
* @covers \AppBundle\Entity\User::setCreatedAt |
1017
|
|
|
*/ |
1018
|
|
|
public function testSetCreatedAt() |
1019
|
|
|
{ |
1020
|
|
|
\$this->markTestIncomplete( |
1021
|
|
|
'This test has not been implemented yet.' |
1022
|
|
|
); |
1023
|
|
|
} |
1024
|
|
|
|
1025
|
|
|
/** |
1026
|
|
|
* @covers \AppBundle\Entity\User::getCreatedAt |
1027
|
|
|
*/ |
1028
|
|
|
public function testGetCreatedAt() |
1029
|
|
|
{ |
1030
|
|
|
\$this->markTestIncomplete( |
1031
|
|
|
'This test has not been implemented yet.' |
1032
|
|
|
); |
1033
|
|
|
} |
1034
|
|
|
|
1035
|
|
|
/** |
1036
|
|
|
* @covers \AppBundle\Entity\User::setUpdatedAt |
1037
|
|
|
*/ |
1038
|
|
|
public function testSetUpdatedAt() |
1039
|
|
|
{ |
1040
|
|
|
\$this->markTestIncomplete( |
1041
|
|
|
'This test has not been implemented yet.' |
1042
|
|
|
); |
1043
|
|
|
} |
1044
|
|
|
|
1045
|
|
|
/** |
1046
|
|
|
* @covers \AppBundle\Entity\User::getUpdatedAt |
1047
|
|
|
*/ |
1048
|
|
|
public function testGetUpdatedAt() |
1049
|
|
|
{ |
1050
|
|
|
\$this->markTestIncomplete( |
1051
|
|
|
'This test has not been implemented yet.' |
1052
|
|
|
); |
1053
|
|
|
} |
1054
|
|
|
|
1055
|
|
|
/** |
1056
|
|
|
* @covers \AppBundle\Entity\User::setLastPost |
1057
|
|
|
*/ |
1058
|
|
|
public function testSetLastPost() |
1059
|
|
|
{ |
1060
|
|
|
\$this->markTestIncomplete( |
1061
|
|
|
'This test has not been implemented yet.' |
1062
|
|
|
); |
1063
|
|
|
} |
1064
|
|
|
|
1065
|
|
|
/** |
1066
|
|
|
* @covers \AppBundle\Entity\User::getLastPost |
1067
|
|
|
*/ |
1068
|
|
|
public function testGetLastPost() |
1069
|
|
|
{ |
1070
|
|
|
\$this->markTestIncomplete( |
1071
|
|
|
'This test has not been implemented yet.' |
1072
|
|
|
); |
1073
|
|
|
} |
1074
|
|
|
|
1075
|
|
|
/** |
1076
|
|
|
* @covers \AppBundle\Entity\User::setRoles |
1077
|
|
|
*/ |
1078
|
|
|
public function testSetRoles() |
1079
|
|
|
{ |
1080
|
|
|
\$this->markTestIncomplete( |
1081
|
|
|
'This test has not been implemented yet.' |
1082
|
|
|
); |
1083
|
|
|
} |
1084
|
|
|
|
1085
|
|
|
/** |
1086
|
|
|
* @covers \AppBundle\Entity\User::getRoles |
1087
|
|
|
*/ |
1088
|
|
|
public function testGetRoles() |
1089
|
|
|
{ |
1090
|
|
|
\$this->markTestIncomplete( |
1091
|
|
|
'This test has not been implemented yet.' |
1092
|
|
|
); |
1093
|
|
|
} |
1094
|
|
|
|
1095
|
|
|
} |
1096
|
|
|
|
1097
|
|
|
EOT; |
1098
|
|
|
|
1099
|
|
|
/** |
1100
|
|
|
* @var string |
1101
|
|
|
*/ |
1102
|
|
|
protected $postTestClassExpected = <<<EOT |
1103
|
|
|
<?php |
1104
|
|
|
|
1105
|
|
|
namespace AppBundle\Tests\Entity; |
1106
|
|
|
|
1107
|
|
|
/** |
1108
|
|
|
* Test for \AppBundle\Entity\Post |
1109
|
|
|
*/ |
1110
|
|
|
class PostTest extends \PHPUnit_Framework_TestCase |
1111
|
|
|
{ |
1112
|
|
|
|
1113
|
|
|
/** |
1114
|
|
|
* Entity to test |
1115
|
|
|
* @var \AppBundle\Entity\PostInterface |
1116
|
|
|
*/ |
1117
|
|
|
private \$object = null; |
1118
|
|
|
|
1119
|
|
|
public function setUp() |
1120
|
|
|
{ |
1121
|
|
|
\$this->object = new \AppBundle\Entity\Post(); |
1122
|
|
|
} |
1123
|
|
|
|
1124
|
|
|
public function testConstructor() |
1125
|
|
|
{ |
1126
|
|
|
\$this->assertNotNull(\$this->object); |
1127
|
|
|
\$this->assertInstanceof('\AppBundle\Entity\PostInterface', \$this->object); |
1128
|
|
|
\$this->assertInstanceof('\AppBundle\Entity\Post', \$this->object); |
1129
|
|
|
} |
1130
|
|
|
|
1131
|
|
|
|
1132
|
|
|
/** |
1133
|
|
|
* @covers \AppBundle\Entity\Post::setContent |
1134
|
|
|
*/ |
1135
|
|
|
public function testSetContent() |
1136
|
|
|
{ |
1137
|
|
|
\$this->markTestIncomplete( |
1138
|
|
|
'This test has not been implemented yet.' |
1139
|
|
|
); |
1140
|
|
|
} |
1141
|
|
|
|
1142
|
|
|
/** |
1143
|
|
|
* @covers \AppBundle\Entity\Post::getContent |
1144
|
|
|
*/ |
1145
|
|
|
public function testGetContent() |
1146
|
|
|
{ |
1147
|
|
|
\$this->markTestIncomplete( |
1148
|
|
|
'This test has not been implemented yet.' |
1149
|
|
|
); |
1150
|
|
|
} |
1151
|
|
|
|
1152
|
|
|
/** |
1153
|
|
|
* @covers \AppBundle\Entity\Post::setCreatedAt |
1154
|
|
|
*/ |
1155
|
|
|
public function testSetCreatedAt() |
1156
|
|
|
{ |
1157
|
|
|
\$this->markTestIncomplete( |
1158
|
|
|
'This test has not been implemented yet.' |
1159
|
|
|
); |
1160
|
|
|
} |
1161
|
|
|
|
1162
|
|
|
/** |
1163
|
|
|
* @covers \AppBundle\Entity\Post::getCreatedAt |
1164
|
|
|
*/ |
1165
|
|
|
public function testGetCreatedAt() |
1166
|
|
|
{ |
1167
|
|
|
\$this->markTestIncomplete( |
1168
|
|
|
'This test has not been implemented yet.' |
1169
|
|
|
); |
1170
|
|
|
} |
1171
|
|
|
|
1172
|
|
|
/** |
1173
|
|
|
* @covers \AppBundle\Entity\Post::setUpdatedAt |
1174
|
|
|
*/ |
1175
|
|
|
public function testSetUpdatedAt() |
1176
|
|
|
{ |
1177
|
|
|
\$this->markTestIncomplete( |
1178
|
|
|
'This test has not been implemented yet.' |
1179
|
|
|
); |
1180
|
|
|
} |
1181
|
|
|
|
1182
|
|
|
/** |
1183
|
|
|
* @covers \AppBundle\Entity\Post::getUpdatedAt |
1184
|
|
|
*/ |
1185
|
|
|
public function testGetUpdatedAt() |
1186
|
|
|
{ |
1187
|
|
|
\$this->markTestIncomplete( |
1188
|
|
|
'This test has not been implemented yet.' |
1189
|
|
|
); |
1190
|
|
|
} |
1191
|
|
|
|
1192
|
|
|
} |
1193
|
|
|
|
1194
|
|
|
EOT; |
1195
|
|
|
protected $postClassWithoutInterface = <<<EOT |
1196
|
|
|
<?php |
1197
|
|
|
|
1198
|
|
|
namespace AppBundle\Entity; |
1199
|
|
|
|
1200
|
|
|
/** |
1201
|
|
|
* |
1202
|
|
|
* |
1203
|
|
|
*/ |
1204
|
|
|
class Post |
1205
|
|
|
{ |
1206
|
|
|
|
1207
|
|
|
/** |
1208
|
|
|
* Post content |
1209
|
|
|
* |
1210
|
|
|
* @\Symfony\Component\Validator\Constraints\NotBlank() |
1211
|
|
|
* @\JMS\Serializer\Annotation\Type("string") |
1212
|
|
|
* @\JMS\Serializer\Annotation\SerializedName("content") |
1213
|
|
|
* @var string |
1214
|
|
|
*/ |
1215
|
|
|
private \$content; |
1216
|
|
|
|
1217
|
|
|
/** |
1218
|
|
|
* 'created_at' property |
1219
|
|
|
* |
1220
|
|
|
* |
1221
|
|
|
* @\JMS\Serializer\Annotation\Type("DateTime") |
1222
|
|
|
* @\JMS\Serializer\Annotation\SerializedName("created_at") |
1223
|
|
|
* @var \DateTime |
1224
|
|
|
*/ |
1225
|
|
|
private \$createdAt; |
1226
|
|
|
|
1227
|
|
|
/** |
1228
|
|
|
* 'updated_at' property |
1229
|
|
|
* |
1230
|
|
|
* |
1231
|
|
|
* @\JMS\Serializer\Annotation\Type("DateTime") |
1232
|
|
|
* @\JMS\Serializer\Annotation\SerializedName("updated_at") |
1233
|
|
|
* @var \DateTime |
1234
|
|
|
*/ |
1235
|
|
|
private \$updatedAt; |
1236
|
|
|
|
1237
|
|
|
|
1238
|
|
|
/** |
1239
|
|
|
* Constructor. |
1240
|
|
|
*/ |
1241
|
|
|
public function __construct() |
1242
|
|
|
{ |
1243
|
|
|
|
1244
|
|
|
} |
1245
|
|
|
|
1246
|
|
|
|
1247
|
|
|
/** |
1248
|
|
|
* For property "content" |
1249
|
|
|
* @param string \$content |
1250
|
|
|
* @return \$this |
1251
|
|
|
*/ |
1252
|
|
|
public function setContent(\$content) |
1253
|
|
|
{ |
1254
|
|
|
\$this->content = \$content; |
1255
|
|
|
return \$this; |
1256
|
|
|
} |
1257
|
|
|
|
1258
|
|
|
/** |
1259
|
|
|
* For property "content" |
1260
|
|
|
* @return string |
1261
|
|
|
*/ |
1262
|
|
|
public function getContent() |
1263
|
|
|
{ |
1264
|
|
|
return \$this->content; |
1265
|
|
|
} |
1266
|
|
|
|
1267
|
|
|
/** |
1268
|
|
|
* For property "createdAt" |
1269
|
|
|
* @param \DateTime \$createdAt |
1270
|
|
|
* @return \$this |
1271
|
|
|
*/ |
1272
|
|
|
public function setCreatedAt(\DateTime \$createdAt) |
1273
|
|
|
{ |
1274
|
|
|
\$this->createdAt = \$createdAt; |
1275
|
|
|
return \$this; |
1276
|
|
|
} |
1277
|
|
|
|
1278
|
|
|
/** |
1279
|
|
|
* For property "createdAt" |
1280
|
|
|
* @return \DateTime |
1281
|
|
|
*/ |
1282
|
|
|
public function getCreatedAt() |
1283
|
|
|
{ |
1284
|
|
|
return \$this->createdAt; |
1285
|
|
|
} |
1286
|
|
|
|
1287
|
|
|
/** |
1288
|
|
|
* For property "updatedAt" |
1289
|
|
|
* @param \DateTime \$updatedAt |
1290
|
|
|
* @return \$this |
1291
|
|
|
*/ |
1292
|
|
|
public function setUpdatedAt(\DateTime \$updatedAt) |
1293
|
|
|
{ |
1294
|
|
|
\$this->updatedAt = \$updatedAt; |
1295
|
|
|
return \$this; |
1296
|
|
|
} |
1297
|
|
|
|
1298
|
|
|
/** |
1299
|
|
|
* For property "updatedAt" |
1300
|
|
|
* @return \DateTime |
1301
|
|
|
*/ |
1302
|
|
|
public function getUpdatedAt() |
1303
|
|
|
{ |
1304
|
|
|
return \$this->updatedAt; |
1305
|
|
|
} |
1306
|
|
|
|
1307
|
|
|
} |
1308
|
|
|
|
1309
|
|
|
EOT; |
1310
|
|
|
|
1311
|
|
|
/** |
1312
|
|
|
* @var string |
1313
|
|
|
*/ |
1314
|
|
|
protected $postTestClassWithoutInterface = <<<EOT |
1315
|
|
|
<?php |
1316
|
|
|
|
1317
|
|
|
namespace AppBundle\Tests\Entity; |
1318
|
|
|
|
1319
|
|
|
/** |
1320
|
|
|
* Test for \AppBundle\Entity\Post |
1321
|
|
|
*/ |
1322
|
|
|
class PostTest extends \PHPUnit_Framework_TestCase |
1323
|
|
|
{ |
1324
|
|
|
|
1325
|
|
|
/** |
1326
|
|
|
* Entity to test |
1327
|
|
|
* @var \AppBundle\Entity\Post |
1328
|
|
|
*/ |
1329
|
|
|
private \$object = null; |
1330
|
|
|
|
1331
|
|
|
public function setUp() |
1332
|
|
|
{ |
1333
|
|
|
\$this->object = new \AppBundle\Entity\Post(); |
1334
|
|
|
} |
1335
|
|
|
|
1336
|
|
|
public function testConstructor() |
1337
|
|
|
{ |
1338
|
|
|
\$this->assertNotNull(\$this->object); |
1339
|
|
|
\$this->assertInstanceof('\AppBundle\Entity\Post', \$this->object); |
1340
|
|
|
} |
1341
|
|
|
|
1342
|
|
|
|
1343
|
|
|
/** |
1344
|
|
|
* @covers \AppBundle\Entity\Post::setContent |
1345
|
|
|
*/ |
1346
|
|
|
public function testSetContent() |
1347
|
|
|
{ |
1348
|
|
|
\$this->markTestIncomplete( |
1349
|
|
|
'This test has not been implemented yet.' |
1350
|
|
|
); |
1351
|
|
|
} |
1352
|
|
|
|
1353
|
|
|
/** |
1354
|
|
|
* @covers \AppBundle\Entity\Post::getContent |
1355
|
|
|
*/ |
1356
|
|
|
public function testGetContent() |
1357
|
|
|
{ |
1358
|
|
|
\$this->markTestIncomplete( |
1359
|
|
|
'This test has not been implemented yet.' |
1360
|
|
|
); |
1361
|
|
|
} |
1362
|
|
|
|
1363
|
|
|
/** |
1364
|
|
|
* @covers \AppBundle\Entity\Post::setCreatedAt |
1365
|
|
|
*/ |
1366
|
|
|
public function testSetCreatedAt() |
1367
|
|
|
{ |
1368
|
|
|
\$this->markTestIncomplete( |
1369
|
|
|
'This test has not been implemented yet.' |
1370
|
|
|
); |
1371
|
|
|
} |
1372
|
|
|
|
1373
|
|
|
/** |
1374
|
|
|
* @covers \AppBundle\Entity\Post::getCreatedAt |
1375
|
|
|
*/ |
1376
|
|
|
public function testGetCreatedAt() |
1377
|
|
|
{ |
1378
|
|
|
\$this->markTestIncomplete( |
1379
|
|
|
'This test has not been implemented yet.' |
1380
|
|
|
); |
1381
|
|
|
} |
1382
|
|
|
|
1383
|
|
|
/** |
1384
|
|
|
* @covers \AppBundle\Entity\Post::setUpdatedAt |
1385
|
|
|
*/ |
1386
|
|
|
public function testSetUpdatedAt() |
1387
|
|
|
{ |
1388
|
|
|
\$this->markTestIncomplete( |
1389
|
|
|
'This test has not been implemented yet.' |
1390
|
|
|
); |
1391
|
|
|
} |
1392
|
|
|
|
1393
|
|
|
/** |
1394
|
|
|
* @covers \AppBundle\Entity\Post::getUpdatedAt |
1395
|
|
|
*/ |
1396
|
|
|
public function testGetUpdatedAt() |
1397
|
|
|
{ |
1398
|
|
|
\$this->markTestIncomplete( |
1399
|
|
|
'This test has not been implemented yet.' |
1400
|
|
|
); |
1401
|
|
|
} |
1402
|
|
|
|
1403
|
|
|
} |
1404
|
|
|
|
1405
|
|
|
EOT; |
1406
|
|
|
|
1407
|
|
|
/** |
1408
|
|
|
* @var string |
1409
|
|
|
*/ |
1410
|
|
|
protected $userClassWithTemplatesSetExpected = <<<EOT |
1411
|
|
|
<?php |
1412
|
|
|
|
1413
|
|
|
namespace AppBundle\Entity; |
1414
|
|
|
|
1415
|
|
|
/** |
1416
|
|
|
* My own class template |
1417
|
|
|
* New User entity |
1418
|
|
|
* lorem ipsum |
1419
|
|
|
* second row |
1420
|
|
|
* @\Doctrine\Common\Annotations\Entity() |
1421
|
|
|
*/ |
1422
|
|
|
class User extends \AppBundle\Entity\Base implements \AppBundle\Entity\UserInterface |
1423
|
|
|
{ |
1424
|
|
|
|
1425
|
|
|
/** |
1426
|
|
|
* My own protected property |
1427
|
|
|
* 'id' property |
1428
|
|
|
* |
1429
|
|
|
* |
1430
|
|
|
* @\JMS\Serializer\Annotation\Type("integer") |
1431
|
|
|
* @\JMS\Serializer\Annotation\SerializedName("id") |
1432
|
|
|
* @var integer |
1433
|
|
|
*/ |
1434
|
|
|
protected \$id; |
1435
|
|
|
|
1436
|
|
|
/** |
1437
|
|
|
* Username for login |
1438
|
|
|
* |
1439
|
|
|
* @\Symfony\Component\Validator\Constraints\NotBlank(message = "Login can not be empty") |
1440
|
|
|
* @\Symfony\Component\Validator\Constraints\NotNull(message = "Login can not be null") |
1441
|
|
|
* @\JMS\Serializer\Annotation\Type("string") |
1442
|
|
|
* @\JMS\Serializer\Annotation\SerializedName("username") |
1443
|
|
|
* @var string |
1444
|
|
|
*/ |
1445
|
|
|
private \$username; |
1446
|
|
|
|
1447
|
|
|
/** |
1448
|
|
|
* User posts |
1449
|
|
|
* |
1450
|
|
|
* |
1451
|
|
|
* @\JMS\Serializer\Annotation\Type("Doctrine\Common\Collections\ArrayCollection<AppBundle\Entity\Post>") |
1452
|
|
|
* @\JMS\Serializer\Annotation\SerializedName("posts") |
1453
|
|
|
* @var \Doctrine\Common\Collections\ArrayCollection |
1454
|
|
|
*/ |
1455
|
|
|
private \$posts; |
1456
|
|
|
|
1457
|
|
|
/** |
1458
|
|
|
* Wether user is active or not |
1459
|
|
|
* |
1460
|
|
|
* @\Symfony\Component\Validator\Constraints\IsTrue() |
1461
|
|
|
* @\JMS\Serializer\Annotation\Type("boolean") |
1462
|
|
|
* @\JMS\Serializer\Annotation\SerializedName("active") |
1463
|
|
|
* @var boolean |
1464
|
|
|
*/ |
1465
|
|
|
private \$active; |
1466
|
|
|
|
1467
|
|
|
|
1468
|
|
|
/** |
1469
|
|
|
* Constructor. |
1470
|
|
|
* My own CONSTRUCT with parameter |
1471
|
|
|
*/ |
1472
|
|
|
public function __construct(\$zm) |
1473
|
|
|
{ |
1474
|
|
|
\$zm1 = \$zm; |
1475
|
|
|
\$this->posts = new \Doctrine\Common\Collections\ArrayCollection(); |
1476
|
|
|
} |
1477
|
|
|
|
1478
|
|
|
|
1479
|
|
|
/** |
1480
|
|
|
* For property "id" |
1481
|
|
|
* @param integer \$id |
1482
|
|
|
* @return \$this |
1483
|
|
|
*/ |
1484
|
|
|
final public function setId(\$id) |
1485
|
|
|
{ |
1486
|
|
|
// this is final setter |
1487
|
|
|
\$this->id = \$id; |
1488
|
|
|
return \$this; |
1489
|
|
|
} |
1490
|
|
|
|
1491
|
|
|
/** |
1492
|
|
|
* For property "id" |
1493
|
|
|
* My own getter template, I can do everything |
1494
|
|
|
* @return integer |
1495
|
|
|
*/ |
1496
|
|
|
public function getId(\$defaultValue = "default") |
1497
|
|
|
{ |
1498
|
|
|
if (empty(\$this->id)) { |
1499
|
|
|
return \$defaultValue; |
1500
|
|
|
} |
1501
|
|
|
|
1502
|
|
|
return \$this->id; |
1503
|
|
|
} |
1504
|
|
|
|
1505
|
|
|
/** |
1506
|
|
|
* For property "username" |
1507
|
|
|
* @param string \$username |
1508
|
|
|
* @return \$this |
1509
|
|
|
*/ |
1510
|
|
|
public function setUsername(\$username) |
1511
|
|
|
{ |
1512
|
|
|
\$this->username = \$username; |
1513
|
|
|
return \$this; |
1514
|
|
|
} |
1515
|
|
|
|
1516
|
|
|
/** |
1517
|
|
|
* For property "username" |
1518
|
|
|
* @return string |
1519
|
|
|
*/ |
1520
|
|
|
public function getUsername() |
1521
|
|
|
{ |
1522
|
|
|
return \$this->username; |
1523
|
|
|
} |
1524
|
|
|
|
1525
|
|
|
/** |
1526
|
|
|
* For property "posts" |
1527
|
|
|
* @param \Doctrine\Common\Collections\ArrayCollection \$posts |
1528
|
|
|
* @return \$this |
1529
|
|
|
*/ |
1530
|
|
|
public function setPosts(\Doctrine\Common\Collections\ArrayCollection \$posts) |
1531
|
|
|
{ |
1532
|
|
|
\$this->posts = \$posts; |
1533
|
|
|
return \$this; |
1534
|
|
|
} |
1535
|
|
|
|
1536
|
|
|
/** |
1537
|
|
|
* For property "posts" |
1538
|
|
|
* @return \Doctrine\Common\Collections\ArrayCollection |
1539
|
|
|
*/ |
1540
|
|
|
public function getPosts() |
1541
|
|
|
{ |
1542
|
|
|
return \$this->posts; |
1543
|
|
|
} |
1544
|
|
|
|
1545
|
|
|
/** |
1546
|
|
|
* For property "active" My own getter boolean template |
1547
|
|
|
* @return boolean |
1548
|
|
|
*/ |
1549
|
|
|
public function isActive() |
1550
|
|
|
{ |
1551
|
|
|
return (bool) \$this->active; |
1552
|
|
|
} |
1553
|
|
|
|
1554
|
|
|
/** |
1555
|
|
|
* For property "active" |
1556
|
|
|
* @param boolean \$active |
1557
|
|
|
* @return \$this |
1558
|
|
|
*/ |
1559
|
|
|
public function setActive(\$active) |
1560
|
|
|
{ |
1561
|
|
|
\$this->active = \$active; |
1562
|
|
|
return \$this; |
1563
|
|
|
} |
1564
|
|
|
|
1565
|
|
|
|
1566
|
|
|
|
1567
|
|
|
|
1568
|
|
|
/** |
1569
|
|
|
* nothing to do |
1570
|
|
|
*/ |
1571
|
|
|
public function __toString() |
1572
|
|
|
{ |
1573
|
|
|
return sprintf("class: %s", __CLASS__); |
1574
|
|
|
} |
1575
|
|
|
} |
1576
|
|
|
|
1577
|
|
|
EOT; |
1578
|
|
|
|
1579
|
|
|
/** |
1580
|
|
|
* @var string |
1581
|
|
|
*/ |
1582
|
|
|
protected $userInterfaceWithTemplatesSetExpected = <<<EOT |
1583
|
|
|
<?php |
1584
|
|
|
|
1585
|
|
|
namespace AppBundle\Entity; |
1586
|
|
|
|
1587
|
|
|
/** |
1588
|
|
|
* My own interface template |
1589
|
|
|
* Interface for entity : \AppBundle\Entity\User |
1590
|
|
|
*/ |
1591
|
|
|
interface UserInterface |
1592
|
|
|
{ |
1593
|
|
|
|
1594
|
|
|
/** |
1595
|
|
|
* For property "id" |
1596
|
|
|
* @param integer \$id |
1597
|
|
|
* @return \$this |
1598
|
|
|
* My own setter interface, I do not want type hinting and optional part! |
1599
|
|
|
*/ |
1600
|
|
|
public function setId(\$id); |
1601
|
|
|
|
1602
|
|
|
/** |
1603
|
|
|
* For property "id" My own protected getter interface template |
1604
|
|
|
* @return integer |
1605
|
|
|
*/ |
1606
|
|
|
protected function getId(); |
1607
|
|
|
|
1608
|
|
|
/** |
1609
|
|
|
* For property "username" |
1610
|
|
|
* @param string \$username |
1611
|
|
|
* @return \$this |
1612
|
|
|
*/ |
1613
|
|
|
public function setUsername(\$username); |
1614
|
|
|
|
1615
|
|
|
/** |
1616
|
|
|
* For property "username" |
1617
|
|
|
* @return string |
1618
|
|
|
*/ |
1619
|
|
|
public function getUsername(); |
1620
|
|
|
|
1621
|
|
|
/** |
1622
|
|
|
* For property "posts" |
1623
|
|
|
* @param \Doctrine\Common\Collections\ArrayCollection \$posts |
1624
|
|
|
* @return \$this |
1625
|
|
|
*/ |
1626
|
|
|
public function setPosts(\Doctrine\Common\Collections\ArrayCollection \$posts); |
1627
|
|
|
|
1628
|
|
|
/** |
1629
|
|
|
* For property "posts" |
1630
|
|
|
* @return \Doctrine\Common\Collections\ArrayCollection |
1631
|
|
|
*/ |
1632
|
|
|
public function getPosts(); |
1633
|
|
|
|
1634
|
|
|
/** |
1635
|
|
|
* For property "active" |
1636
|
|
|
* @return boolean |
1637
|
|
|
*/ |
1638
|
|
|
public function isActiveMyOwn(); |
1639
|
|
|
|
1640
|
|
|
/** |
1641
|
|
|
* For property "active" |
1642
|
|
|
* @param boolean \$active |
1643
|
|
|
* @return \$this |
1644
|
|
|
*/ |
1645
|
|
|
public function setActive(\$active); |
1646
|
|
|
|
1647
|
|
|
/** |
1648
|
|
|
* For property "active" |
1649
|
|
|
* @return boolean |
1650
|
|
|
*/ |
1651
|
|
|
public function getActive(); |
1652
|
|
|
|
1653
|
|
|
} |
1654
|
|
|
|
1655
|
|
|
EOT; |
1656
|
|
|
|
1657
|
|
|
/** |
1658
|
|
|
* @var string |
1659
|
|
|
*/ |
1660
|
|
|
protected $userTestClassWithTemplatesSetExpected = <<<EOT |
1661
|
|
|
<?php |
1662
|
|
|
|
1663
|
|
|
namespace AppBundle\Tests\Entity; |
1664
|
|
|
|
1665
|
|
|
/** |
1666
|
|
|
* I do not want to init object! |
1667
|
|
|
*/ |
1668
|
|
|
class UserTest extends \PHPUnit_Framework_TestCase |
1669
|
|
|
{ |
1670
|
|
|
|
1671
|
|
|
/** |
1672
|
|
|
* @covers \AppBundle\Entity\User::setId |
1673
|
|
|
*/ |
1674
|
|
|
public function testSetId() |
1675
|
|
|
{ |
1676
|
|
|
\$this->markTestIncomplete( |
1677
|
|
|
'This test has not been implemented yet. Some.' |
1678
|
|
|
); |
1679
|
|
|
// My own test method!! |
1680
|
|
|
} |
1681
|
|
|
|
1682
|
|
|
/** |
1683
|
|
|
* @covers \AppBundle\Entity\User::getId |
1684
|
|
|
*/ |
1685
|
|
|
public function testGetId() |
1686
|
|
|
{ |
1687
|
|
|
\$this->markTestIncomplete( |
1688
|
|
|
'This test has not been implemented yet. Some.' |
1689
|
|
|
); |
1690
|
|
|
// My own test method!! |
1691
|
|
|
} |
1692
|
|
|
|
1693
|
|
|
/** |
1694
|
|
|
* @covers \AppBundle\Entity\User::setUsername |
1695
|
|
|
*/ |
1696
|
|
|
public function testSetUsername() |
1697
|
|
|
{ |
1698
|
|
|
\$this->markTestIncomplete( |
1699
|
|
|
'This test has not been implemented yet.' |
1700
|
|
|
); |
1701
|
|
|
} |
1702
|
|
|
|
1703
|
|
|
/** |
1704
|
|
|
* @covers \AppBundle\Entity\User::getUsername |
1705
|
|
|
*/ |
1706
|
|
|
public function testGetUsername() |
1707
|
|
|
{ |
1708
|
|
|
\$this->markTestIncomplete( |
1709
|
|
|
'This test has not been implemented yet.' |
1710
|
|
|
); |
1711
|
|
|
} |
1712
|
|
|
|
1713
|
|
|
/** |
1714
|
|
|
* @covers \AppBundle\Entity\User::setPosts |
1715
|
|
|
*/ |
1716
|
|
|
public function testSetPosts() |
1717
|
|
|
{ |
1718
|
|
|
\$this->markTestIncomplete( |
1719
|
|
|
'This test has not been implemented yet.' |
1720
|
|
|
); |
1721
|
|
|
} |
1722
|
|
|
|
1723
|
|
|
/** |
1724
|
|
|
* @covers \AppBundle\Entity\User::getPosts |
1725
|
|
|
*/ |
1726
|
|
|
public function testGetPosts() |
1727
|
|
|
{ |
1728
|
|
|
\$this->markTestIncomplete( |
1729
|
|
|
'This test has not been implemented yet.' |
1730
|
|
|
); |
1731
|
|
|
} |
1732
|
|
|
|
1733
|
|
|
/** |
1734
|
|
|
* @covers \AppBundle\Entity\User::isActive |
1735
|
|
|
*/ |
1736
|
|
|
public function testIsActive() |
1737
|
|
|
{ |
1738
|
|
|
\$this->markTestIncomplete( |
1739
|
|
|
'This test has not been implemented yet.' |
1740
|
|
|
); |
1741
|
|
|
} |
1742
|
|
|
|
1743
|
|
|
/** |
1744
|
|
|
* @covers \AppBundle\Entity\User::setActive |
1745
|
|
|
*/ |
1746
|
|
|
public function testSetActive() |
1747
|
|
|
{ |
1748
|
|
|
\$this->markTestIncomplete( |
1749
|
|
|
'This test has not been implemented yet.' |
1750
|
|
|
); |
1751
|
|
|
} |
1752
|
|
|
|
1753
|
|
|
/** |
1754
|
|
|
* @covers \AppBundle\Entity\User::getActive |
1755
|
|
|
*/ |
1756
|
|
|
public function testGetActive() |
1757
|
|
|
{ |
1758
|
|
|
\$this->markTestIncomplete( |
1759
|
|
|
'This test has not been implemented yet.' |
1760
|
|
|
); |
1761
|
|
|
} |
1762
|
|
|
|
1763
|
|
|
} |
1764
|
|
|
|
1765
|
|
|
EOT; |
1766
|
|
|
|
1767
|
|
|
/** |
1768
|
|
|
* @var string |
1769
|
|
|
*/ |
1770
|
|
|
protected $postClassWithoutInterfaceExpected = <<<EOT |
1771
|
|
|
<?php |
1772
|
|
|
|
1773
|
|
|
namespace AppBundle\Entity; |
1774
|
|
|
|
1775
|
|
|
/** |
1776
|
|
|
* |
1777
|
|
|
* |
1778
|
|
|
*/ |
1779
|
|
|
class Post |
1780
|
|
|
{ |
1781
|
|
|
|
1782
|
|
|
/** |
1783
|
|
|
* 'id' property |
1784
|
|
|
* |
1785
|
|
|
* |
1786
|
|
|
* @\JMS\Serializer\Annotation\Type("integer") |
1787
|
|
|
* @\JMS\Serializer\Annotation\SerializedName("id") |
1788
|
|
|
* @var integer |
1789
|
|
|
*/ |
1790
|
|
|
private \$id; |
1791
|
|
|
|
1792
|
|
|
|
1793
|
|
|
/** |
1794
|
|
|
* Constructor. |
1795
|
|
|
*/ |
1796
|
|
|
public function __construct() |
1797
|
|
|
{ |
1798
|
|
|
|
1799
|
|
|
} |
1800
|
|
|
|
1801
|
|
|
|
1802
|
|
|
/** |
1803
|
|
|
* For property "id" |
1804
|
|
|
* @param integer \$id |
1805
|
|
|
* @return \$this |
1806
|
|
|
*/ |
1807
|
|
|
public function setId(\$id) |
1808
|
|
|
{ |
1809
|
|
|
\$this->id = \$id; |
1810
|
|
|
return \$this; |
1811
|
|
|
} |
1812
|
|
|
|
1813
|
|
|
/** |
1814
|
|
|
* For property "id" |
1815
|
|
|
* @return integer |
1816
|
|
|
*/ |
1817
|
|
|
public function getId() |
1818
|
|
|
{ |
1819
|
|
|
return \$this->id; |
1820
|
|
|
} |
1821
|
|
|
|
1822
|
|
|
} |
1823
|
|
|
|
1824
|
|
|
EOT; |
1825
|
|
|
|
1826
|
|
|
/** |
1827
|
|
|
* @dataProvider dataForTestRender |
1828
|
|
|
*/ |
1829
|
|
|
public function testRender($item, $expectedOutput) |
1830
|
|
|
{ |
1831
|
|
|
$result = $this->getRenderer()->render($item); |
1832
|
|
|
$this->assertEquals($expectedOutput, $result); |
1833
|
|
|
} |
1834
|
|
|
|
1835
|
|
|
public function dataForTestRender() |
1836
|
|
|
{ |
1837
|
|
|
$classManagers = $this->generateDataFromYamlHelper(); |
1838
|
|
|
$anotherClassManagers = $this->generateClassManagersFromYaml(Helper::getStructureYamlForTemplateChangeTest()); |
1839
|
|
|
$classManagersWithInlineConfiguration = $this->generateClassManagersFromYaml(Helper::getStructureYamlForTestInlineClassConfuration()); |
1840
|
|
|
|
1841
|
|
|
return [ |
1842
|
|
|
[$classManagers[0], $this->userClassExpected], |
1843
|
|
|
[$classManagers[1], $this->postClassExpected], |
1844
|
|
|
[$classManagers[0]->getInterface(), $this->userInterfaceExpected], |
1845
|
|
|
[$classManagers[1]->getInterface(), $this->postInterfaceExpected], |
1846
|
|
|
[$classManagers[0]->getTestClass(), $this->userTestClassExpected], |
1847
|
|
|
[$classManagers[1]->getTestClass(), $this->postTestClassExpected], |
1848
|
|
|
[$anotherClassManagers[0], $this->userClassWithTemplatesSetExpected], |
1849
|
|
|
[$anotherClassManagers[0]->getInterface(), $this->userInterfaceWithTemplatesSetExpected], |
1850
|
|
|
[$anotherClassManagers[0]->getTestClass(), $this->userTestClassWithTemplatesSetExpected], |
1851
|
|
|
[$classManagersWithInlineConfiguration[0], $this->postClassWithoutInterfaceExpected], |
1852
|
|
|
]; |
1853
|
|
|
} |
1854
|
|
|
|
1855
|
|
|
/** |
1856
|
|
|
* @dataProvider dataForTestRenderAndPutItemsToContent |
1857
|
|
|
*/ |
1858
|
|
|
public function testRenderAndPutItemsToContent($postClassExpected, $postClassWithNewPropertyExpected, $newItemPositionOffset) |
1859
|
|
|
{ |
1860
|
|
|
$itemsToRender = new ArrayCollection(); |
1861
|
|
|
$itemsToRender->add(Helper::prepareProperty("active", "boolean", "is post active", ["IsTrue()"])); |
1862
|
|
|
$result = $this->getRenderer()->renderAndPutItemsToContent($postClassExpected, $itemsToRender, $newItemPositionOffset); |
1863
|
|
|
$this->assertEquals($postClassWithNewPropertyExpected, $result); |
1864
|
|
|
} |
1865
|
|
|
|
1866
|
|
|
/** |
1867
|
|
|
* @dataProvider dataForTestRenderAndPutConstructorBodyToContent |
1868
|
|
|
*/ |
1869
|
|
|
public function testRenderAndPutConstructorBodyToContent($postClassExpected, $postClassWithUpdatedConstructor, $newItemPositionOffset) |
1870
|
|
|
{ |
1871
|
|
|
$constructorManager = new ClassConstructorManager(new ClassManager()); |
1872
|
|
|
$initProperties = new ArrayCollection(); |
1873
|
|
|
$initProperty = new InitPropertyManager(); |
1874
|
|
|
$initProperty->setProperty(Helper::prepareProperty("collection", "Doctrine\Common\Collections\ArrayCollection", "items collection", ["Valid(message = \"Collection has to be valid!\")"])); |
1875
|
|
|
$initProperty2 = new InitPropertyManager(); |
1876
|
|
|
$initProperty2->setProperty(Helper::prepareProperty("collection2", "Doctrine\Common\Collections\ArrayCollection", "items collection 2", ["Valid(message = \"Collection has to be valid!\")"])); |
1877
|
|
|
$initProperties->add($initProperty2); |
1878
|
|
|
$initProperties->add($initProperty); |
1879
|
|
|
$constructorManager->setInitProperties($initProperties); |
1880
|
|
|
$result = $this->getRenderer()->renderAndPutConstructorBodyToContent($postClassExpected, $constructorManager, $newItemPositionOffset); |
1881
|
|
|
$this->assertEquals($postClassWithUpdatedConstructor, $result); |
1882
|
|
|
} |
1883
|
|
|
|
1884
|
|
|
public function testRenderClassWithoutInterface() |
1885
|
|
|
{ |
1886
|
|
|
$class = $this->initDataFromYamlAndGetSecondClassWithoutInterface(); |
1887
|
|
|
$result = $this->getRenderer()->render($class); |
1888
|
|
|
$this->assertEquals($this->postClassWithoutInterface, $result); |
1889
|
|
|
} |
1890
|
|
|
|
1891
|
|
|
public function testRenderTestClassForClassWithoutInterface() |
1892
|
|
|
{ |
1893
|
|
|
$class = $this->initDataFromYamlAndGetSecondClassWithoutInterface(); |
1894
|
|
|
$result = $this->getRenderer()->render($class->getTestClass()); |
1895
|
|
|
$this->assertEquals($this->postTestClassWithoutInterface, $result); |
1896
|
|
|
} |
1897
|
|
|
|
1898
|
|
|
/** |
1899
|
|
|
* @return array |
1900
|
|
|
*/ |
1901
|
|
|
public function dataForTestRenderAndPutItemsToContent() |
1902
|
|
|
{ |
1903
|
|
|
return [ |
1904
|
|
|
[$this->postClassExpected, $this->postClassWithNewPropertyExpected, 41], |
1905
|
|
|
]; |
1906
|
|
|
} |
1907
|
|
|
|
1908
|
|
|
/** |
1909
|
|
|
* @return array |
1910
|
|
|
*/ |
1911
|
|
|
public function dataForTestRenderAndPutConstructorBodyToContent() |
1912
|
|
|
{ |
1913
|
|
|
return [ |
1914
|
|
|
[$this->postClassExpected, $this->postClassWithUpdatedConstructor, 47] |
1915
|
|
|
]; |
1916
|
|
|
} |
1917
|
|
|
|
1918
|
|
|
/** |
1919
|
|
|
* @return ClassManager |
1920
|
|
|
*/ |
1921
|
|
|
protected function initDataFromYamlAndGetSecondClassWithoutInterface() |
1922
|
|
|
{ |
1923
|
|
|
$classConfig = new ClassConfig(); |
1924
|
|
|
$classConfig->setNoInterface(true); |
1925
|
|
|
$classManagers = $this->generateDataFromYamlHelper($classConfig); |
1926
|
|
|
return $classManagers[1]; |
1927
|
|
|
} |
1928
|
|
|
|
1929
|
|
|
protected function generateDataFromYamlHelper(ClassConfig $classConfig = null) |
1930
|
|
|
{ |
1931
|
|
|
return $this->generateClassManagersFromYaml(Helper::getStructureYaml(), $classConfig); |
1932
|
|
|
} |
1933
|
|
|
|
1934
|
|
|
protected function generateClassManagersFromYaml($yaml, ClassConfig $classConfig = null) |
1935
|
|
|
{ |
1936
|
|
|
self::bootKernel(); |
1937
|
|
|
$structureGenerator = self::$kernel->getContainer()->get('seg.structure_generator'); |
1938
|
|
|
return $structureGenerator->buildEntitiesClassStructure($structureGenerator->parseToArray($yaml), $classConfig); |
1939
|
|
|
} |
1940
|
|
|
|
1941
|
|
|
/** |
1942
|
|
|
* @return Renderer |
1943
|
|
|
*/ |
1944
|
|
|
protected function getRenderer() |
1945
|
|
|
{ |
1946
|
|
|
self::bootKernel(); |
1947
|
|
|
return self::$kernel->getContainer()->get('seg.renderer'); |
1948
|
|
|
} |
1949
|
|
|
} |
1950
|
|
|
|