@@ -23,12 +23,19 @@ public function testRunWithoutAdminAndReadmeCreation()
23
23
24
24
$ this ->mockFilePutContent ();
25
25
26
+ $ this ->mockShellExec (
27
+ ['arguments ' => 'composer require ronasit/laravel-helpers ' ],
28
+ ['arguments ' => 'composer require ronasit/laravel-swagger ' ],
29
+ ['arguments ' => 'composer require --dev ronasit/laravel-entity-generator ' ],
30
+ );
31
+
26
32
$ this
27
33
->artisan ('init "My App" ' )
28
34
->expectsOutput ('Project initialized successfully! ' )
29
35
->expectsQuestion ('Please enter an application URL ' , 'https://mysite.com ' )
30
36
->expectsConfirmation ('Do you want to generate an admin user? ' )
31
37
->expectsConfirmation ('Do you want to generate a README file? ' )
38
+ ->expectsConfirmation ('Do you want to install media package? ' )
32
39
->expectsConfirmation ('Do you want to uninstall project-initializator package? ' )
33
40
->assertExitCode (0 );
34
41
}
@@ -55,6 +62,12 @@ public function testRunWithAdminAndWithoutReadmeCreation()
55
62
]
56
63
);
57
64
65
+ $ this ->mockShellExec (
66
+ ['arguments ' => 'composer require ronasit/laravel-helpers ' ],
67
+ ['arguments ' => 'composer require ronasit/laravel-swagger ' ],
68
+ ['arguments ' => 'composer require --dev ronasit/laravel-entity-generator ' ],
69
+ );
70
+
58
71
$ this
59
72
->artisan ('init "My App" ' )
60
73
->expectsOutput ('Project initialized successfully! ' )
@@ -65,14 +78,13 @@ public function testRunWithAdminAndWithoutReadmeCreation()
65
78
->expectsQuestion ('Please enter an admin password ' , '123456 ' )
66
79
->expectsQuestion ('Please enter an admin role id ' , 1 )
67
80
->expectsConfirmation ('Do you want to generate a README file? ' )
81
+ ->expectsConfirmation ('Do you want to install media package? ' )
68
82
->expectsConfirmation ('Do you want to uninstall project-initializator package? ' )
69
83
->assertExitCode (0 );
70
84
}
71
85
72
86
public function testRunWithAdminAndDefaultReadmeCreation ()
73
87
{
74
- $ this ->mockShellExec ();
75
-
76
88
$ this ->mockFileGetContent (
77
89
[
78
90
'arguments ' => ['.env.example ' ],
@@ -131,6 +143,13 @@ public function testRunWithAdminAndDefaultReadmeCreation()
131
143
]
132
144
);
133
145
146
+ $ this ->mockShellExec (
147
+ ['arguments ' => 'git ls-remote --get-url origin ' , 'result ' => 'https://github.com/ronasit/laravel-helpers.git ' ],
148
+ ['arguments ' => 'composer require ronasit/laravel-helpers ' ],
149
+ ['arguments ' => 'composer require ronasit/laravel-swagger ' ],
150
+ ['arguments ' => 'composer require --dev ronasit/laravel-entity-generator ' ],
151
+ );
152
+
134
153
$ this
135
154
->artisan ('init "My App" ' )
136
155
->expectsOutput ('Project initialized successfully! ' )
@@ -195,6 +214,7 @@ public function testRunWithAdminAndDefaultReadmeCreation()
195
214
->expectsOutput ('- ArgoCD link ' )
196
215
->expectsOutput ('- Manager \'s email ' )
197
216
->expectsOutput ('- Code Owner/Team Lead \'s email ' )
217
+ ->expectsConfirmation ('Do you want to install media package? ' )
198
218
->expectsConfirmation ('Do you want to uninstall project-initializator package? ' )
199
219
->assertExitCode (0 );
200
220
}
@@ -245,6 +265,12 @@ public function testRunWithAdminAndPartialReadmeCreation()
245
265
]
246
266
);
247
267
268
+ $ this ->mockShellExec (
269
+ ['arguments ' => 'composer require ronasit/laravel-helpers ' ],
270
+ ['arguments ' => 'composer require ronasit/laravel-swagger ' ],
271
+ ['arguments ' => 'composer require --dev ronasit/laravel-entity-generator ' ],
272
+ );
273
+
248
274
$ this
249
275
->artisan ('init "My App" ' )
250
276
->expectsOutput ('Project initialized successfully! ' )
@@ -298,14 +324,13 @@ public function testRunWithAdminAndPartialReadmeCreation()
298
324
->expectsOutput ('Don`t forget to fill the following empty values: ' )
299
325
->expectsOutput ('- Issue Tracker link ' )
300
326
->expectsOutput ('- Code Owner/Team Lead \'s email ' )
327
+ ->expectsConfirmation ('Do you want to install media package? ' )
301
328
->expectsConfirmation ('Do you want to uninstall project-initializator package? ' )
302
329
->assertExitCode (0 );
303
330
}
304
331
305
- public function testRunWithAdminAndFullReadmeCreationAndRemovingInitializator ()
332
+ public function testRunWithAdminAndFullReadmeCreationAndRemovingInitializatorInstallationMedia ()
306
333
{
307
- $ this ->mockShellExec ();
308
-
309
334
$ this ->mockFileGetContent (
310
335
[
311
336
'arguments ' => ['.env.example ' ],
@@ -364,13 +389,14 @@ public function testRunWithAdminAndFullReadmeCreationAndRemovingInitializator()
364
389
]
365
390
);
366
391
367
- $ this ->mockNativeFunction ('RonasIT\ProjectInitializator\Commands ' , [
368
- $ this ->functionCall ('exec ' , [
369
- 'cd /app/tests/.. && composer remove ronasit/laravel-project-initializator ' ,
370
- 'optionalParameter ' ,
371
- 'optionalParameter ' ,
372
- ], 'success ' ),
373
- ]);
392
+ $ this ->mockShellExec (
393
+ ['arguments ' => 'git ls-remote --get-url origin ' , 'result ' => 'https://github.com/ronasit/laravel-helpers.git ' ],
394
+ ['arguments ' => 'composer require ronasit/laravel-helpers ' ],
395
+ ['arguments ' => 'composer require ronasit/laravel-swagger ' ],
396
+ ['arguments ' => 'composer require --dev ronasit/laravel-entity-generator ' ],
397
+ ['arguments ' => 'composer require ronasit/laravel-media ' ],
398
+ ['arguments ' => 'composer remove ronasit/laravel-project-initializator ' ],
399
+ );
374
400
375
401
$ this
376
402
->artisan ('init "My App" ' )
@@ -430,6 +456,7 @@ public function testRunWithAdminAndFullReadmeCreationAndRemovingInitializator()
430
456
->
expectsQuestion (
'Please enter a Laravel Nova \'s admin email ' ,
'[email protected] ' )
431
457
->expectsQuestion ('Please enter a Laravel Nova \'s admin password ' , '654321 ' )
432
458
->expectsOutput ('README generated successfully! ' )
459
+ ->expectsConfirmation ('Do you want to install media package? ' , 'yes ' )
433
460
->expectsConfirmation ('Do you want to uninstall project-initializator package? ' , 'yes ' )
434
461
->assertExitCode (0 );
435
462
}
0 commit comments