@@ -13,15 +13,55 @@ public function testRunWithoutAdminAndReadmeCreation()
1313 $ this ->mockFileGetContent (
1414 [
1515 'arguments ' => ['.env.example ' ],
16- 'result ' => $ this ->getFixture ('env.example .yml ' ),
16+ 'result ' => $ this ->getFixture ('env.example_app_name_pascal_case .yml ' ),
1717 ],
1818 [
1919 'arguments ' => ['.env.development ' ],
20- 'result ' => $ this ->getFixture ('env.development .yml ' ),
20+ 'result ' => $ this ->getFixture ('env.development_app_name_pascal_case .yml ' ),
2121 ],
2222 );
2323
24- $ this ->mockFilePutContent ();
24+ $ this ->mockFilePutContent (
25+ 'env.example_app_name_pascal_case.yml ' ,
26+ 'env.development_app_name_pascal_case.yml ' ,
27+ );
28+
29+ $ this ->mockShellExec (
30+ ['arguments ' => 'composer require ronasit/laravel-helpers --ansi ' ],
31+ ['arguments ' => 'composer require ronasit/laravel-swagger --ansi ' ],
32+ ['arguments ' => 'composer require --dev ronasit/laravel-entity-generator --ansi ' ],
33+ ['arguments ' => 'composer require laravel/telescope --ansi ' ],
34+ ['arguments ' => 'php artisan telescope:install --ansi ' ],
35+ );
36+
37+ $ this
38+ ->artisan ('init "MyApp" ' )
39+ ->expectsOutput ('Project initialized successfully! ' )
40+ ->expectsQuestion ('Please enter an application URL ' , 'https://mysite.com ' )
41+ ->expectsConfirmation ('Do you want to generate an admin user? ' )
42+ ->expectsConfirmation ('Do you want to generate a README file? ' )
43+ ->expectsConfirmation ('Do you want to install media package? ' )
44+ ->expectsConfirmation ('Do you want to uninstall project-initializator package? ' )
45+ ->assertExitCode (0 );
46+ }
47+
48+ public function testRunWithoutAdminAndReadmeCreationConvertAppNameToPascalCase ()
49+ {
50+ $ this ->mockFileGetContent (
51+ [
52+ 'arguments ' => ['.env.example ' ],
53+ 'result ' => $ this ->getFixture ('env.example_app_name_pascal_case.yml ' ),
54+ ],
55+ [
56+ 'arguments ' => ['.env.development ' ],
57+ 'result ' => $ this ->getFixture ('env.development_app_name_pascal_case.yml ' ),
58+ ],
59+ );
60+
61+ $ this ->mockFilePutContent (
62+ 'env.example_app_name_pascal_case.yml ' ,
63+ 'env.development_app_name_pascal_case.yml ' ,
64+ );
2565
2666 $ this ->mockShellExec (
2767 ['arguments ' => 'composer require ronasit/laravel-helpers --ansi ' ],
@@ -33,6 +73,7 @@ public function testRunWithoutAdminAndReadmeCreation()
3373
3474 $ this
3575 ->artisan ('init "My App" ' )
76+ ->expectsConfirmation ('The application name is not in PascalCase, would you like to use MyApp ' , 'yes ' )
3677 ->expectsOutput ('Project initialized successfully! ' )
3778 ->expectsQuestion ('Please enter an application URL ' , 'https://mysite.com ' )
3879 ->expectsConfirmation ('Do you want to generate an admin user? ' )
@@ -56,12 +97,14 @@ public function testRunWithAdminAndWithoutReadmeCreation()
5697 );
5798
5899 $ this ->mockFilePutContent (
100+ 'env.example.yml ' ,
101+ 'env.development.yml ' ,
59102 [
60103 'database/migrations/2018_11_11_111111_add_default_user.php ' ,
61104 $ this ->getFixture ('migration.php ' ),
62105 'optionalParameter ' ,
63106 'optionalParameter ' ,
64- ]
107+ ],
65108 );
66109
67110 $ this ->mockShellExec (
@@ -74,6 +117,7 @@ public function testRunWithAdminAndWithoutReadmeCreation()
74117
75118 $ this
76119 ->artisan ('init "My App" ' )
120+ ->expectsConfirmation ('The application name is not in PascalCase, would you like to use MyApp ' )
77121 ->expectsOutput ('Project initialized successfully! ' )
78122 ->expectsQuestion ('Please enter an application URL ' , 'https://mysite.com ' )
79123 ->expectsConfirmation ('Do you want to generate an admin user? ' , 'yes ' )
@@ -133,6 +177,8 @@ public function testRunWithAdminAndDefaultReadmeCreation()
133177 );
134178
135179 $ this ->mockFilePutContent (
180+ 'env.example.yml ' ,
181+ 'env.development.yml ' ,
136182 [
137183 'database/migrations/2018_11_11_111111_add_default_user.php ' ,
138184 $ this ->getFixture ('migration.php ' ),
@@ -158,6 +204,7 @@ public function testRunWithAdminAndDefaultReadmeCreation()
158204
159205 $ this
160206 ->artisan ('init "My App" ' )
207+ ->expectsConfirmation ('The application name is not in PascalCase, would you like to use MyApp ' )
161208 ->expectsOutput ('Project initialized successfully! ' )
162209 ->expectsQuestion ('Please enter an application URL ' , 'https://mysite.com ' )
163210 ->expectsConfirmation ('Do you want to generate an admin user? ' , 'yes ' )
@@ -263,6 +310,8 @@ public function testRunWithAdminAndPartialReadmeCreation()
263310 );
264311
265312 $ this ->mockFilePutContent (
313+ 'env.example.yml ' ,
314+ 'env.development.yml ' ,
266315 [
267316 'README.md ' ,
268317 $ this ->getFixture ('partial_readme.md ' ),
@@ -281,6 +330,7 @@ public function testRunWithAdminAndPartialReadmeCreation()
281330
282331 $ this
283332 ->artisan ('init "My App" ' )
333+ ->expectsConfirmation ('The application name is not in PascalCase, would you like to use MyApp ' )
284334 ->expectsOutput ('Project initialized successfully! ' )
285335 ->expectsQuestion ('Please enter an application URL ' , 'https://mysite.com ' )
286336 ->expectsConfirmation ('Do you want to generate an admin user? ' )
@@ -383,6 +433,8 @@ public function testRunWithAdminAndFullReadmeCreationAndRemovingInitializatorIns
383433 );
384434
385435 $ this ->mockFilePutContent (
436+ 'env.example.yml ' ,
437+ 'env.development.yml ' ,
386438 [
387439 'database/migrations/2018_11_11_111111_add_default_user.php ' ,
388440 $ this ->getFixture ('migration.php ' ),
@@ -410,6 +462,7 @@ public function testRunWithAdminAndFullReadmeCreationAndRemovingInitializatorIns
410462
411463 $ this
412464 ->artisan ('init "My App" ' )
465+ ->expectsConfirmation ('The application name is not in PascalCase, would you like to use MyApp ' )
413466 ->expectsOutput ('Project initialized successfully! ' )
414467 ->expectsQuestion ('Please enter an application URL ' , 'https://mysite.com ' )
415468 ->expectsConfirmation ('Do you want to generate an admin user? ' , 'yes ' )
0 commit comments