@@ -10,11 +10,20 @@ class InitCommandTest extends TestCase
1010
1111 public function testRunWithoutAdminAndReadmeCreationConvertAppNameToPascalCaseTelescopeAlreadyInstalled ()
1212 {
13+ $ this ->mockNativeFunction (
14+ '\RonasIT\ProjectInitializator\Extensions\ConfigWriter ' ,
15+ $ this ->callFileExists (base_path ('config/telescope.php ' )),
16+ $ this ->callFileGetContent (base_path ('config/telescope.php ' ), $ this ->getFixture ('telescope_config.php ' )),
17+ $ this ->callFileExists (base_path ('config/auto-doc.php ' )),
18+ $ this ->callFileGetContent (base_path ('config/auto-doc.php ' ), $ this ->getFixture ('auto_doc.php ' )),
19+ );
20+
1321 $ this ->mockNativeFunction (
1422 '\Winter\LaravelConfigWriter ' ,
1523 $ this ->changeEnvFileCall ('.env.example ' , 'env.example.yml ' , 'env.example_app_name_pascal_case.yml ' ),
1624 $ this ->changeEnvFileCall ('.env.development ' , 'env.development.yml ' , 'env.development_app_name_pascal_case.yml ' ),
17- $ this ->changeConfigFileCall (base_path ('config/auto-doc.php ' ), 'auto_doc.php ' , 'auto_doc_after_changes.php ' ),
25+ $ this ->callFilePutContent (base_path ('config/telescope.php ' ), $ this ->getFixture ('telescope_config_after_initialization.php ' )),
26+ $ this ->callFilePutContent (base_path ('config/auto-doc.php ' ), $ this ->getFixture ('auto_doc_after_changes.php ' )),
1827 );
1928
2029 $ this ->mockNativeFunction (
@@ -63,11 +72,20 @@ public function testRunWithoutAdminAndReadmeCreationConvertAppNameToPascalCaseTe
6372
6473 public function testRunWithoutAdminAndReadmeCreation ()
6574 {
75+ $ this ->mockNativeFunction (
76+ '\RonasIT\ProjectInitializator\Extensions\ConfigWriter ' ,
77+ $ this ->callFileExists (base_path ('config/telescope.php ' )),
78+ $ this ->callFileGetContent (base_path ('config/telescope.php ' ), $ this ->getFixture ('telescope_config.php ' )),
79+ $ this ->callFileExists (base_path ('config/auto-doc.php ' )),
80+ $ this ->callFileGetContent (base_path ('config/auto-doc.php ' ), $ this ->getFixture ('auto_doc.php ' )),
81+ );
82+
6683 $ this ->mockNativeFunction (
6784 '\Winter\LaravelConfigWriter ' ,
6885 $ this ->changeEnvFileCall ('.env ' , 'env.example.yml ' , 'env.example_app_name_pascal_case.yml ' ),
6986 $ this ->changeEnvFileCall ('.env.development ' , 'env.development.yml ' , 'env.development_app_name_pascal_case.yml ' ),
70- $ this ->changeConfigFileCall (base_path ('config/auto-doc.php ' ), 'auto_doc.php ' , 'auto_doc_after_changes.php ' ),
87+ $ this ->callFilePutContent (base_path ('config/telescope.php ' ), $ this ->getFixture ('telescope_config_after_initialization.php ' )),
88+ $ this ->callFilePutContent (base_path ('config/auto-doc.php ' ), $ this ->getFixture ('auto_doc_after_changes.php ' )),
7189 );
7290
7391 $ this ->mockNativeFunction (
@@ -115,11 +133,20 @@ public function testRunWithoutAdminAndReadmeCreation()
115133
116134 public function testRunWithAdminAndWithoutReadmeCreation ()
117135 {
136+ $ this ->mockNativeFunction (
137+ '\RonasIT\ProjectInitializator\Extensions\ConfigWriter ' ,
138+ $ this ->callFileExists (base_path ('config/telescope.php ' )),
139+ $ this ->callFileGetContent (base_path ('config/telescope.php ' ), $ this ->getFixture ('telescope_config.php ' )),
140+ $ this ->callFileExists (base_path ('config/auto-doc.php ' )),
141+ $ this ->callFileGetContent (base_path ('config/auto-doc.php ' ), $ this ->getFixture ('auto_doc.php ' )),
142+ );
143+
118144 $ this ->mockNativeFunction (
119145 '\Winter\LaravelConfigWriter ' ,
120146 $ this ->changeEnvFileCall ('.env.example ' , 'env.example.yml ' , 'env.example_app_name_not_pascal_case.yml ' ),
121147 $ this ->changeEnvFileCall ('.env.development ' , 'env.development.yml ' , 'env.development_app_name_not_pascal_case.yml ' ),
122- $ this ->changeConfigFileCall (base_path ('config/auto-doc.php ' ), 'auto_doc.php ' , 'auto_doc_after_changes.php ' ),
148+ $ this ->callFilePutContent (base_path ('config/telescope.php ' ), $ this ->getFixture ('telescope_config_after_initialization.php ' )),
149+ $ this ->callFilePutContent (base_path ('config/auto-doc.php ' ), $ this ->getFixture ('auto_doc_after_changes.php ' )),
123150 );
124151
125152 $ this ->mockNativeFunction (
@@ -171,13 +198,22 @@ public function testRunWithAdminAndWithoutReadmeCreation()
171198
172199 public function testRunWithAdminAndDefaultReadmeCreation ()
173200 {
201+ $ this ->mockNativeFunction (
202+ '\RonasIT\ProjectInitializator\Extensions\ConfigWriter ' ,
203+ $ this ->callFileExists (base_path ('config/telescope.php ' )),
204+ $ this ->callFileGetContent (base_path ('config/telescope.php ' ), $ this ->getFixture ('telescope_config.php ' )),
205+ $ this ->callFileExists (base_path ('config/auto-doc.php ' )),
206+ $ this ->callFileGetContent (base_path ('config/auto-doc.php ' ), $ this ->getFixture ('auto_doc.php ' )),
207+ );
208+
174209 $ this ->mockNativeFunction (
175210 '\Winter\LaravelConfigWriter ' ,
176211 $ this ->changeEnvFileCall ('.env.example ' , 'env.example.yml ' , 'env.example_app_name_not_pascal_case.yml ' ),
177212 $ this ->changeEnvFileCall ('.env.development ' , 'env.development.yml ' , 'env.development_app_name_not_pascal_case.yml ' ),
178213 $ this ->changeEnvFileCall ('.env.development ' , 'env.development.yml ' , 'env.development_clerk_credentials_added.yml ' ),
179214 $ this ->changeEnvFileCall ('.env.example ' , 'env.example.yml ' , 'env.example_clerk_credentials_added.yml ' ),
180- $ this ->changeConfigFileCall (base_path ('config/auto-doc.php ' ), 'auto_doc.php ' , 'auto_doc_after_changes.php ' ),
215+ $ this ->callFilePutContent (base_path ('config/telescope.php ' ), $ this ->getFixture ('telescope_config_after_initialization.php ' )),
216+ $ this ->callFilePutContent (base_path ('config/auto-doc.php ' ), $ this ->getFixture ('auto_doc_after_changes.php ' )),
181217 );
182218
183219 $ this ->mockNativeFunction (
@@ -297,11 +333,20 @@ public function testRunWithAdminAndDefaultReadmeCreation()
297333
298334 public function testRunWithAdminAndPartialReadmeCreation ()
299335 {
336+ $ this ->mockNativeFunction (
337+ '\RonasIT\ProjectInitializator\Extensions\ConfigWriter ' ,
338+ $ this ->callFileExists (base_path ('config/telescope.php ' )),
339+ $ this ->callFileGetContent (base_path ('config/telescope.php ' ), $ this ->getFixture ('telescope_config.php ' )),
340+ $ this ->callFileExists (base_path ('config/auto-doc.php ' )),
341+ $ this ->callFileGetContent (base_path ('config/auto-doc.php ' ), $ this ->getFixture ('auto_doc.php ' )),
342+ );
343+
300344 $ this ->mockNativeFunction (
301345 '\Winter\LaravelConfigWriter ' ,
302346 $ this ->changeEnvFileCall ('.env.example ' , 'env.example.yml ' , 'env.example_app_name_not_pascal_case.yml ' ),
303347 $ this ->changeEnvFileCall ('.env.development ' , 'env.development.yml ' , 'env.development_app_name_not_pascal_case.yml ' ),
304- $ this ->changeConfigFileCall (base_path ('config/auto-doc.php ' ), 'auto_doc.php ' , 'auto_doc_after_changes.php ' ),
348+ $ this ->callFilePutContent (base_path ('config/telescope.php ' ), $ this ->getFixture ('telescope_config_after_initialization.php ' )),
349+ $ this ->callFilePutContent (base_path ('config/auto-doc.php ' ), $ this ->getFixture ('auto_doc_after_changes.php ' )),
305350 );
306351
307352 $ this ->mockNativeFunction (
@@ -399,11 +444,20 @@ public function testRunWithAdminAndPartialReadmeCreation()
399444
400445 public function testRunWithAdminAndFullReadmeCreationAndRemovingInitializatorInstallationMedia ()
401446 {
447+ $ this ->mockNativeFunction (
448+ '\RonasIT\ProjectInitializator\Extensions\ConfigWriter ' ,
449+ $ this ->callFileExists (base_path ('config/telescope.php ' )),
450+ $ this ->callFileGetContent (base_path ('config/telescope.php ' ), $ this ->getFixture ('telescope_config.php ' )),
451+ $ this ->callFileExists (base_path ('config/auto-doc.php ' )),
452+ $ this ->callFileGetContent (base_path ('config/auto-doc.php ' ), $ this ->getFixture ('auto_doc.php ' )),
453+ );
454+
402455 $ this ->mockNativeFunction (
403456 '\Winter\LaravelConfigWriter ' ,
404457 $ this ->changeEnvFileCall ('.env.example ' , 'env.example.yml ' , 'env.example_app_name_not_pascal_case.yml ' ),
405458 $ this ->changeEnvFileCall ('.env.development ' , 'env.development.yml ' , 'env.development_app_name_not_pascal_case.yml ' ),
406- $ this ->changeConfigFileCall (base_path ('config/auto-doc.php ' ), 'auto_doc.php ' , 'auto_doc_after_changes.php ' ),
459+ $ this ->callFilePutContent (base_path ('config/telescope.php ' ), $ this ->getFixture ('telescope_config_after_initialization.php ' )),
460+ $ this ->callFilePutContent (base_path ('config/auto-doc.php ' ), $ this ->getFixture ('auto_doc_after_changes.php ' )),
407461 );
408462
409463 $ this ->mockNativeFunction (
@@ -517,11 +571,20 @@ public function testRunWithAdminAndFullReadmeCreationAndRemovingInitializatorIns
517571
518572 public function testRunWithoutAdminAndUsingTelescope ()
519573 {
574+ $ this ->mockNativeFunction (
575+ '\RonasIT\ProjectInitializator\Extensions\ConfigWriter ' ,
576+ $ this ->callFileExists (base_path ('config/telescope.php ' )),
577+ $ this ->callFileGetContent (base_path ('config/telescope.php ' ), $ this ->getFixture ('telescope_config.php ' )),
578+ $ this ->callFileExists (base_path ('config/auto-doc.php ' )),
579+ $ this ->callFileGetContent (base_path ('config/auto-doc.php ' ), $ this ->getFixture ('auto_doc.php ' )),
580+ );
581+
520582 $ this ->mockNativeFunction (
521583 '\Winter\LaravelConfigWriter ' ,
522584 $ this ->changeEnvFileCall ('.env.example ' , 'env.example.yml ' , 'env.example_app_name_not_pascal_case.yml ' ),
523585 $ this ->changeEnvFileCall ('.env.development ' , 'env.development.yml ' , 'env.development_app_name_not_pascal_case.yml ' ),
524- $ this ->changeConfigFileCall (base_path ('config/auto-doc.php ' ), 'auto_doc.php ' , 'auto_doc_after_changes.php ' ),
586+ $ this ->callFilePutContent (base_path ('config/telescope.php ' ), $ this ->getFixture ('telescope_config_after_initialization.php ' )),
587+ $ this ->callFilePutContent (base_path ('config/auto-doc.php ' ), $ this ->getFixture ('auto_doc_after_changes.php ' )),
525588 );
526589
527590 $ this ->mockNativeFunction (
@@ -623,15 +686,24 @@ public function testRunWithoutAdminAndUsingTelescope()
623686
624687 public function testRunWithClerkMobileAppWithPintInstalled (): void
625688 {
689+ $ this ->mockNativeFunction (
690+ '\RonasIT\ProjectInitializator\Extensions\ConfigWriter ' ,
691+ $ this ->callFileExists (base_path ('config/telescope.php ' )),
692+ $ this ->callFileGetContent (base_path ('config/telescope.php ' ), $ this ->getFixture ('telescope_config.php ' )),
693+ $ this ->callFileExists (base_path ('config/auto-doc.php ' )),
694+ $ this ->callFileGetContent (base_path ('config/auto-doc.php ' ), $ this ->getFixture ('auto_doc.php ' )),
695+ );
696+
626697 $ this ->mockNativeFunction (
627698 '\Winter\LaravelConfigWriter ' ,
628699 $ this ->changeEnvFileCall ('.env.example ' , 'env.example.yml ' , 'env.example_app_name_not_pascal_case.yml ' ),
629700 $ this ->changeEnvFileCall ('.env.development ' , 'env.development.yml ' , 'env.development_app_name_not_pascal_case.yml ' ),
630701 $ this ->changeEnvFileCall ('.env.development ' , 'env.development.yml ' , 'env.development_clerk_credentials_added_mobile_app.yml ' ),
631702 $ this ->changeEnvFileCall ('.env.example ' , 'env.example.yml ' , 'env.example_clerk_credentials_added_mobile_app.yml ' ),
632- $ this ->changeConfigFileCall (base_path ('config/auto-doc.php ' ), 'auto_doc.php ' , 'auto_doc_after_changes.php ' ),
703+ $ this ->callFilePutContent (base_path ('config/telescope.php ' ), $ this ->getFixture ('telescope_config_after_initialization.php ' )),
704+ $ this ->callFilePutContent (base_path ('config/auto-doc.php ' ), $ this ->getFixture ('auto_doc_after_changes.php ' )),
633705 );
634-
706+
635707 $ this ->mockNativeFunction (
636708 'RonasIT\ProjectInitializator\Commands ' ,
637709 $ this ->callFileExists ('.env ' , false ),
0 commit comments