@@ -11,7 +11,13 @@ public function test_execute_install_command_successfully()
1111 $ this ->artisan ('sail-ssl:install ' )
1212 ->expectsOutput ('Nginx container successfully installed in Docker Compose. ' )
1313 ->assertSuccessful ();
14- $ dockerCompose = file_get_contents ($ this ->app ->basePath ('docker-compose.yml ' ));
14+
15+ $ dockerCompose = $ this ->app ->basePath ('docker-compose.yml ' );
16+ if (!file_exists ($ dockerCompose )) {
17+ $ dockerCompose = $ this ->app ->basePath ('compose.yaml ' );
18+ }
19+
20+ $ dockerCompose = file_get_contents ($ dockerCompose );
1521 $ nginxStub = file_get_contents ('stubs/nginx.stub ' );
1622 $ volumeStub = file_get_contents ('stubs/volume.stub ' );
1723 $ this ->assertTrue (str_contains ($ dockerCompose , $ nginxStub ));
@@ -21,20 +27,32 @@ public function test_execute_install_command_successfully()
2127 public function test_throw_exception_when_docker_compose_yml_is_not_found ()
2228 {
2329 $ this ->expectException (\ErrorException::class);
24- unlink ($ this ->app ->basePath ('docker-compose.yml ' ));
30+ if (file_exists ($ this ->app ->basePath ('docker-compose.yml ' ))) {
31+ unlink ($ this ->app ->basePath ('docker-compose.yml ' ));
32+ } else if (file_exists ($ this ->app ->basePath ('compose.yaml ' ))) {
33+ unlink ($ this ->app ->basePath ('compose.yaml ' ));
34+ }
2535 $ this ->artisan ('sail-ssl:install ' )->assertFailed ();
2636 }
2737
2838 public function test_do_nothing_when_nginx_is_already_installed ()
2939 {
3040 // First execution
3141 $ this ->artisan ('sail-ssl:install ' )->assertSuccessful ();
32- $ dockerComposeAfter1stExec = file_get_contents ($ this ->app ->basePath ('docker-compose.yml ' ));
42+ $ dockerCompose = $ this ->app ->basePath ('docker-compose.yml ' );
43+ if (!file_exists ($ dockerCompose )) {
44+ $ dockerCompose = $ this ->app ->basePath ('compose.yaml ' );
45+ }
46+ $ dockerComposeAfter1stExec = file_get_contents ($ dockerCompose );
3347 // Execute again
3448 $ this ->artisan ('sail-ssl:install ' )
3549 ->expectsOutput ('Nginx container is already installed. Do nothing. ' )
3650 ->assertSuccessful ();
37- $ dockerComposeAfter2ndExec = file_get_contents ($ this ->app ->basePath ('docker-compose.yml ' ));
51+ $ dockerCompose = $ this ->app ->basePath ('docker-compose.yml ' );
52+ if (!file_exists ($ dockerCompose )) {
53+ $ dockerCompose = $ this ->app ->basePath ('compose.yaml ' );
54+ }
55+ $ dockerComposeAfter2ndExec = file_get_contents ($ dockerCompose );
3856 $ this ->assertEquals ($ dockerComposeAfter1stExec , $ dockerComposeAfter2ndExec );
3957 }
4058}
0 commit comments