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.
Including the linked resolv.conf helps with troubleshooting situations where dns appears to not be working.
(Mostly the goal is to determine whether a conflicting entry is listed too early, or if the localhost is not listed first when others are present.)
- properly detects if the requested version is already installed, and skips re-installing/re-starting/re-configuring
- allows --force to re-configure anyway
- smarter treatment of 'php' when it's aliased to another specific installed version
Old: `/usr/local/var/log/php-fpm.log`
New: `~/.config/valet/Log/php-fpm.log`
(We already put `~/.config/valet/Log/nginx-error.log` there)
This avoids ARM Mac differences in directory paths.
When we added the `proxy` feature in https://github.com/laravel/valet/pull/913 we inadvertently broke the `tld` command.
It was concatenating old+new tld when searching for existing configs, thus it couldn't find the correct file, which triggered the reported error.
Fixes#984
This PR fixes the lookup by allowing the correct intended lookup tld to be passed in. It also checks that the file exists before trying to read it.
Fatal error: Uncaught Symfony\Component\Console\Exception\LogicException: Cannot set a default value when using InputOption::VALUE_NONE mode. in ~/.composer/vendor/laravel/valet/vendor/symfony/console/Input/InputOption.php:159
Sometimes I find myself wondering how to un-park a folder, and it takes me awhile to find `forget` in the list.
Adding `unpark` as an alias may be helpful.
Updated the `proxies` method to return the URL + .tld
as the rendered output wasn't exactly what one would
expect. While not critical, it was not consistent.
Refactored some of the Site class to aid in testing using
a fake instead of relying on a ton of mocking.
The Site fake has support for both using `tests/output`
as well as named fixtures (`tests/fixtures/Proxies`).
Testing for certificate I/O is pretty whack, but this is
the best I could come up with that would still ensure
the certificate stuff was getting called without
actually requiring `sudo` to run phpunit.
Replaced instances referring directly to `VALET_HOME_PATH`
with calls to the new `valetHomePath()`. This method
is taken over in the fake Site implementation so
that everything runs the same using the fake
Site without having to change other
assumptions.
Updated several "path" methods (and many of their usages)
to take the "thing" you are looking for so you can
either get the path to the type of "thing" you
are looking for or the direct path to the
specific "thing" you are looking for.
Examples:
```
// ~/.config/valet/Nginx
$site->nginxPath();
// ~/.config/valet/Nginx/some-site.com.test
$site->nginxPath('some-site.com.test');
```
Made some other tests related to the existence of `Sites`
directory that resulted in updating the mocks for
many of the other tests.
All in all, it should make other aspects of the Site class
handle things more gracefully if `Sites` doesn't exist.