Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

phpunit.xml breaks sail if not present #651

Closed
zack6849 opened this issue Jan 12, 2024 · 1 comment · Fixed by #652
Closed

phpunit.xml breaks sail if not present #651

zack6849 opened this issue Jan 12, 2024 · 1 comment · Fixed by #652

Comments

@zack6849
Copy link
Contributor

zack6849 commented Jan 12, 2024

Sail Version

1.27

Laravel Version

10.10

PHP Version

8.2.4

Operating System

Windows (WSL)

OS Version

Ubuntu 20.04.6 LTS

Description

If there is no phpunit xml files, the sail:install command fails and crashes, it seems it assumes one of those two files HAS to exist for it to work

Steps To Reproduce

Create a laravel project, remove the phpunit files and then try to install sail

zack@DESKTOP-K3FU948 ~/Environments/foo (master*?) $ php artisan sail:install

 ┌ Which services would you like to install? ───────────────────┐
 │ mysql                                                        │
 └──────────────────────────────────────────────────────────────┘


   ErrorException

  file_get_contents(/home/zack/Environments/foo/phpunit.xml.dist): Failed to open stream: No such file or directory

  at vendor/laravel/sail/src/Console/Concerns/InteractsWithDockerComposeServices.php:175
    171▕         if (! file_exists($path = $this->laravel->basePath('phpunit.xml'))) {
    172▕             $path = $this->laravel->basePath('phpunit.xml.dist');
    173▕         }
    174▕
  ➜ 175▕         $phpunit = file_get_contents($path);
    176▕
    177▕         $phpunit = preg_replace('/^.*DB_CONNECTION.*\n/m', '', $phpunit);
    178▕         $phpunit = str_replace('<!-- <env name="DB_DATABASE" value=":memory:"/> -->', '<env name="DB_DATABASE" value="testing"/>', $phpunit);
    179▕

      +14 vendor frames

  15  artisan:35
      Illuminate\Foundation\Console\Kernel::handle()
taylorotwell added a commit that referenced this issue Jan 13, 2024
* [#651] Don't do anything if no phpunit files are present

* Update InteractsWithDockerComposeServices.php

---------

Co-authored-by: Taylor Otwell <taylor@laravel.com>
@crynobone
Copy link
Member

PR has been merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants