While my PR #1514 fixed recreating the FPM configs, it introduced a different issue:
Due to the use of `utilizedPhpVersions()`, the code now also configured the FPM config for the alias `php` version.
This caused it to invoke the configure function with an empty version string and thus overwriting the FPM config for (in my case) the php@8.4 config templated with `valet.sock` instead of the correct `valet84.sock`.
The nginx sites that were configured to proxy their requests to the `valet84.sock` then failed because it did not exist anymore.
We fixed this by always including the actual linked PHP version via the `linkedPhp` function. This returns `php8.4` instead of `php`.
`php` is an alias anyway and this also removes another unnecessary service restart call. Previously, this would also try to restart the `php` service via brew which was already restarted through the restart of `php@8.4`, which is an alias in brew.
This also fixes an issue with the previous PR, to correctly symlink `valet.sock` again to the linked PHP version, which we oversaw.
* First attempt at testing CLI commands
* Apply fixes from StyleCI
* Protect from running locally
* Fix test
* wip
* wip
* wip
* wip
* wip
* Update app.php
* Create config folder and files for CLI tests
* Apply fixes from StyleCI
* Fix some formatting
* Fix imports
* Update all output() calls to use the writer passed in by the command
Ugly capture of all $outputs from commands, by passing them into `writer()` to be bound into the container, where they can then be pulled out from calls to `output()` and its buddies `info()`, `table()`, and `warning()`.
* Apply fixes from StyleCI
* Flesh out park command test
* Apply fixes from StyleCI
* Drop php 7.0 and 7.1
Co-authored-by: StyleCI Bot <bot@styleci.io>
Co-authored-by: Matt Stauffer <matt@tighten.co>
- Add --site to isolate
- Add --site to unisolate
- Refactor some tests
- Update Site@getSiteUrl to throw an exception instead of returning false
- Fix a few minor typos/grammatical issues
- Fix the isolated directories test given new table shape
- Updated useVersion test to no longer hit the real filesystem
Co-Authored-By: Jacob Baker-Kretzmar <18192441+bakerkretzmar@users.noreply.github.com>
Before the change, when running `valet use` the code intended to stop currently running PHP services. But the `getRunningServices` method only returned non-root running services. As PHP services started by Valet are run using `sudo` (so running as root), they were not returned and subsequently not stopped.
This change is intended to fix the above and stop PHP services that are started by Valet on a PHP version switch.
Update test suite to phpunit 9.5 syntax
Refactored to use polyfill for older PHP versions via `yoast/phpunit-polyfills`
Note: this includes 2 important differences from usual phpunit test suites:
- instead of extending `PHPUnit\Framework\TestCase` we extend `Yoast\PHPUnitPolyfills\TestCases\TestCase`
- instead of handling fixtures via `setUp()` and `tearDown()` we use `set_up()` and `tear_down()` respectively
Comment regarding formatting: I chose to use the FQDN in the `extends` syntax of the class declaration instead of using `use` so that it is more quickly apparent that we're doing something slightly different than usual phpunit syntax, particularly in regards to the set_up() / tear_down() methods that appear immediately following the `extends` line.