@@ -74,6 +74,18 @@ public function getCommandTests()
74
74
->setFixtureFilesPath (__DIR__ .'/../fixtures/MakeCommand ' )
75
75
];
76
76
77
+ yield 'command_in_custom_root_namespace ' => [MakerTestDetails::createTest (
78
+ $ this ->getMakerInstance (MakeCommand::class),
79
+ [
80
+ // command name
81
+ 'app:foo ' ,
82
+ ])
83
+ ->setFixtureFilesPath (__DIR__ .'/../fixtures/MakeCommand ' )
84
+ ->changeRootNamespace ('Custom ' )
85
+ ->addPreMakeCommand ("echo 'maker: \n root_namespace: Custom \n' > config/packages/dev/maker.yaml " )
86
+ ->addPreMakeCommand ('composer dump-autoload ' )
87
+ ];
88
+
77
89
yield 'controller_basic ' => [MakerTestDetails::createTest (
78
90
$ this ->getMakerInstance (MakeController::class),
79
91
[
@@ -87,6 +99,22 @@ public function getCommandTests()
87
99
})
88
100
];
89
101
102
+ yield 'controller_basic_in_custom_root_namespace ' => [MakerTestDetails::createTest (
103
+ $ this ->getMakerInstance (MakeController::class),
104
+ [
105
+ // controller class name
106
+ 'FooBar ' ,
107
+ ])
108
+ ->setFixtureFilesPath (__DIR__ .'/../fixtures/MakeController ' )
109
+ ->changeRootNamespace ('Custom ' )
110
+ ->addPreMakeCommand ("echo 'maker: \n root_namespace: Custom \n' > config/packages/dev/maker.yaml " )
111
+ ->addPreMakeCommand ('composer dump-autoload ' )
112
+ ->assert (function (string $ output , string $ directory ) {
113
+ // make sure the template was not configured
114
+ $ this ->assertContainsCount ('created: ' , $ output , 1 );
115
+ })
116
+ ];
117
+
90
118
yield 'controller_with_template_and_base ' => [MakerTestDetails::createTest (
91
119
$ this ->getMakerInstance (MakeController::class),
92
120
[
@@ -156,6 +184,19 @@ public function getCommandTests()
156
184
})
157
185
];
158
186
187
+ yield 'fixtures_in_custom_root_namespace ' => [MakerTestDetails::createTest (
188
+ $ this ->getMakerInstance (MakeFixtures::class),
189
+ [
190
+ 'AppFixtures '
191
+ ])
192
+ ->changeRootNamespace ('Custom ' )
193
+ ->addPreMakeCommand ("echo 'maker: \n root_namespace: Custom \n' > config/packages/dev/maker.yaml " )
194
+ ->addPreMakeCommand ('composer dump-autoload ' )
195
+ ->assert (function (string $ output , string $ directory ) {
196
+ $ this ->assertContains ('created: src/DataFixtures/AppFixtures.php ' , $ output );
197
+ })
198
+ ];
199
+
159
200
yield 'form_basic ' => [MakerTestDetails::createTest (
160
201
$ this ->getMakerInstance (MakeForm::class),
161
202
[
@@ -166,6 +207,19 @@ public function getCommandTests()
166
207
->setFixtureFilesPath (__DIR__ .'/../fixtures/MakeForm ' )
167
208
];
168
209
210
+ yield 'form_basic_in_custom_root_namespace ' => [MakerTestDetails::createTest (
211
+ $ this ->getMakerInstance (MakeForm::class),
212
+ [
213
+ // form name
214
+ 'FooBar ' ,
215
+ '' ,
216
+ ])
217
+ ->setFixtureFilesPath (__DIR__ .'/../fixtures/MakeFormInCustomRootNamespace ' )
218
+ ->changeRootNamespace ('Custom ' )
219
+ ->addPreMakeCommand ("echo 'maker: \n root_namespace: Custom \n' > config/packages/dev/maker.yaml " )
220
+ ->addPreMakeCommand ('composer dump-autoload ' )
221
+ ];
222
+
169
223
yield 'form_with_entity ' => [MakerTestDetails::createTest (
170
224
$ this ->getMakerInstance (MakeForm::class),
171
225
[
@@ -208,6 +262,18 @@ public function getCommandTests()
208
262
->setFixtureFilesPath (__DIR__ .'/../fixtures/MakeFunctional ' )
209
263
];
210
264
265
+ yield 'functional_in_custom_root_namespace ' => [MakerTestDetails::createTest (
266
+ $ this ->getMakerInstance (MakeFunctionalTest::class),
267
+ [
268
+ // functional test class name
269
+ 'FooBar ' ,
270
+ ])
271
+ ->setFixtureFilesPath (__DIR__ .'/../fixtures/MakeFunctionalInCustomRootNamespace ' )
272
+ ->changeRootNamespace ('Custom ' )
273
+ ->addPreMakeCommand ("echo 'maker: \n root_namespace: Custom \n' > config/packages/dev/maker.yaml " )
274
+ ->addPreMakeCommand ('composer dump-autoload ' )
275
+ ];
276
+
211
277
yield 'subscriber ' => [MakerTestDetails::createTest (
212
278
$ this ->getMakerInstance (MakeSubscriber::class),
213
279
[
@@ -218,6 +284,19 @@ public function getCommandTests()
218
284
])
219
285
];
220
286
287
+ yield 'subscriber_in_custom_root_namespace ' => [MakerTestDetails::createTest (
288
+ $ this ->getMakerInstance (MakeSubscriber::class),
289
+ [
290
+ // subscriber name
291
+ 'FooBar ' ,
292
+ // event name
293
+ 'kernel.request ' ,
294
+ ])
295
+ ->changeRootNamespace ('Custom ' )
296
+ ->addPreMakeCommand ("echo 'maker: \n root_namespace: Custom \n' > config/packages/dev/maker.yaml " )
297
+ ->addPreMakeCommand ('composer dump-autoload ' )
298
+ ];
299
+
221
300
yield 'subscriber_unknown_event_class ' => [MakerTestDetails::createTest (
222
301
$ this ->getMakerInstance (MakeSubscriber::class),
223
302
[
@@ -238,6 +317,19 @@ public function getCommandTests()
238
317
])
239
318
];
240
319
320
+ yield 'serializer_encoder_in_custom_root_namespace ' => [MakerTestDetails::createTest (
321
+ $ this ->getMakerInstance (MakeSerializerEncoder::class),
322
+ [
323
+ // encoder class name
324
+ 'FooBarEncoder ' ,
325
+ // encoder format
326
+ 'foobar ' ,
327
+ ])
328
+ ->changeRootNamespace ('Custom ' )
329
+ ->addPreMakeCommand ("echo 'maker: \n root_namespace: Custom \n' > config/packages/dev/maker.yaml " )
330
+ ->addPreMakeCommand ('composer dump-autoload ' )
331
+ ];
332
+
241
333
yield 'twig_extension ' => [MakerTestDetails::createTest (
242
334
$ this ->getMakerInstance (MakeTwigExtension::class),
243
335
[
@@ -246,6 +338,17 @@ public function getCommandTests()
246
338
])
247
339
];
248
340
341
+ yield 'twig_extension_in_custom_root_namespace ' => [MakerTestDetails::createTest (
342
+ $ this ->getMakerInstance (MakeTwigExtension::class),
343
+ [
344
+ // extension class name
345
+ 'FooBar ' ,
346
+ ])
347
+ ->changeRootNamespace ('Custom ' )
348
+ ->addPreMakeCommand ("echo 'maker: \n root_namespace: Custom \n' > config/packages/dev/maker.yaml " )
349
+ ->addPreMakeCommand ('composer dump-autoload ' )
350
+ ];
351
+
249
352
yield 'unit_test ' => [MakerTestDetails::createTest (
250
353
$ this ->getMakerInstance (MakeUnitTest::class),
251
354
[
@@ -254,6 +357,17 @@ public function getCommandTests()
254
357
])
255
358
];
256
359
360
+ yield 'unit_test_in_custom_root_namespace ' => [MakerTestDetails::createTest (
361
+ $ this ->getMakerInstance (MakeUnitTest::class),
362
+ [
363
+ // class name
364
+ 'FooBar ' ,
365
+ ])
366
+ ->changeRootNamespace ('Custom ' )
367
+ ->addPreMakeCommand ("echo 'maker: \n root_namespace: Custom \n' > config/packages/dev/maker.yaml " )
368
+ ->addPreMakeCommand ('composer dump-autoload ' )
369
+ ];
370
+
257
371
yield 'validator ' => [MakerTestDetails::createTest (
258
372
$ this ->getMakerInstance (MakeValidator::class),
259
373
[
@@ -262,6 +376,17 @@ public function getCommandTests()
262
376
])
263
377
];
264
378
379
+ yield 'validator_in_custom_root_namespace ' => [MakerTestDetails::createTest (
380
+ $ this ->getMakerInstance (MakeValidator::class),
381
+ [
382
+ // validator name
383
+ 'FooBar ' ,
384
+ ])
385
+ ->changeRootNamespace ('Custom ' )
386
+ ->addPreMakeCommand ("echo 'maker: \n root_namespace: Custom \n' > config/packages/dev/maker.yaml " )
387
+ ->addPreMakeCommand ('composer dump-autoload ' )
388
+ ];
389
+
265
390
yield 'voter ' => [MakerTestDetails::createTest (
266
391
$ this ->getMakerInstance (MakeVoter::class),
267
392
[
@@ -270,6 +395,17 @@ public function getCommandTests()
270
395
])
271
396
];
272
397
398
+ yield 'voter_in_custom_root_namespace ' => [MakerTestDetails::createTest (
399
+ $ this ->getMakerInstance (MakeVoter::class),
400
+ [
401
+ // voter class name
402
+ 'FooBar ' ,
403
+ ])
404
+ ->changeRootNamespace ('Custom ' )
405
+ ->addPreMakeCommand ("echo 'maker: \n root_namespace: Custom \n' > config/packages/dev/maker.yaml " )
406
+ ->addPreMakeCommand ('composer dump-autoload ' )
407
+ ];
408
+
273
409
yield 'auth_empty ' => [MakerTestDetails::createTest (
274
410
$ this ->getMakerInstance (MakeAuthenticator::class),
275
411
[
@@ -278,6 +414,17 @@ public function getCommandTests()
278
414
])
279
415
];
280
416
417
+ yield 'auth_empty_in_custom_root_namespace ' => [MakerTestDetails::createTest (
418
+ $ this ->getMakerInstance (MakeAuthenticator::class),
419
+ [
420
+ // class name
421
+ 'AppCustomAuthenticator ' ,
422
+ ])
423
+ ->changeRootNamespace ('Custom ' )
424
+ ->addPreMakeCommand ("echo 'maker: \n root_namespace: Custom \n' > config/packages/dev/maker.yaml " )
425
+ ->addPreMakeCommand ('composer dump-autoload ' )
426
+ ];
427
+
281
428
yield 'migration_with_changes ' => [MakerTestDetails::createTest (
282
429
$ this ->getMakerInstance (MakeMigration::class),
283
430
[/* no input */ ])
@@ -302,6 +449,33 @@ public function getCommandTests()
302
449
})
303
450
];
304
451
452
+ yield 'migration_with_changes_in_custom_root_namespace ' => [MakerTestDetails::createTest (
453
+ $ this ->getMakerInstance (MakeMigration::class),
454
+ [/* no input */ ])
455
+ ->setFixtureFilesPath (__DIR__ .'/../fixtures/MakeMigrationInCustomRootNamespace ' )
456
+ ->changeRootNamespace ('Custom ' )
457
+ ->addPreMakeCommand ("echo 'maker: \n root_namespace: Custom \n' > config/packages/dev/maker.yaml " )
458
+ ->addPreMakeCommand ('composer dump-autoload ' )
459
+ ->configureDatabase (false )
460
+ // doctrine-migrations-bundle only requires doctrine-bundle, which
461
+ // only requires doctrine/dbal. But we're testing with the ORM,
462
+ // so let's install it
463
+ ->addExtraDependencies ('doctrine/orm ' )
464
+ ->assert (function (string $ output , string $ directory ) {
465
+ $ this ->assertContains ('Success ' , $ output );
466
+
467
+ $ finder = new Finder ();
468
+ $ finder ->in ($ directory .'/src/Migrations ' )
469
+ ->name ('*.php ' );
470
+ $ this ->assertCount (1 , $ finder );
471
+
472
+ // see that the exact filename is in the output
473
+ $ iterator = $ finder ->getIterator ();
474
+ $ iterator ->rewind ();
475
+ $ this ->assertContains (sprintf ('"src/Migrations/%s" ' , $ iterator ->current ()->getFilename ()), $ output );
476
+ })
477
+ ];
478
+
305
479
yield 'migration_no_changes ' => [MakerTestDetails::createTest (
306
480
$ this ->getMakerInstance (MakeMigration::class),
307
481
[/* no input */ ])
@@ -331,6 +505,24 @@ public function getCommandTests()
331
505
})
332
506
];
333
507
508
+ yield 'crud_basic_in_custom_root_namespace ' => [MakerTestDetails::createTest (
509
+ $ this ->getMakerInstance (MakeCrud::class),
510
+ [
511
+ // entity class name
512
+ 'SweetFood ' ,
513
+ ])
514
+ ->setFixtureFilesPath (__DIR__ .'/../fixtures/MakeCrudInCustomRootNamespace ' )
515
+ ->changeRootNamespace ('Custom ' )
516
+ ->addPreMakeCommand ("echo 'maker: \n root_namespace: Custom \n' > config/packages/dev/maker.yaml " )
517
+ ->addPreMakeCommand ('composer dump-autoload ' )
518
+ // need for crud web tests
519
+ ->configureDatabase ()
520
+ ->assert (function (string $ output , string $ directory ) {
521
+ $ this ->assertContains ('created: src/Controller/SweetFoodController.php ' , $ output );
522
+ $ this ->assertContains ('created: src/Form/SweetFoodType.php ' , $ output );
523
+ })
524
+ ];
525
+
334
526
yield 'crud_repository ' => [MakerTestDetails::createTest (
335
527
$ this ->getMakerInstance (MakeCrud::class),
336
528
[
0 commit comments