1
0
mirror of https://github.com/laravel/valet.git synced 2026-02-04 08:10:07 +01:00

77 Commits

Author SHA1 Message Date
Matt Stauffer
e893f5f05c Satisfy PHPUnit 2025-06-18 21:26:19 -07:00
Chris Brown
b622f1d09a Add PHPUnit 12 support, and upgrade phpunit-polyfills
Added `DataProvider` attribute, to support newer PHPUnit, in order to support latest phpunit-polyfills.

Closes #1512 which only did part of the update
2025-02-28 13:06:56 -05:00
mattstauffer
76ece5380a Fix code styling 2024-11-25 17:14:52 +00:00
mattstauffer
9a4a7a1693 Fix code styling 2023-08-27 02:47:47 +00:00
Chris Brown
615d61dc8e Install older PHP versions via alternate tap
Fixes #1407

Homebrew's support policy now aggressively disables older versions earlier than it did previously.
That is why we tap the `shivammathur/php` repository.

But since Homebrew also now "keeps" those old formulae but marks them as disabled, when Valet runs `brew install php@7.4` it fails because Homebrew just aborts due to its flags in the outdated formula.
(They mark it as "disabled" and/or "keg_only :versioned_formula", but don't actually delete the formula from their repository.)
To override that we must use `brew install shivammathur/php/php@7.4` internally.

Therefore, we need to maintain a list of which PHP Versions we wish to specifically prefix with the `shivammathur/php` tap in order to bypass Homebrew's flags.

**ANNUAL MAINTENANCE**
1. This PR adds the array of `LIMITED_PHP_VERSIONS` which we will have to update annually when new PHP versions are retired as others are released.
2. We should also annually update the `LATEST_PHP_VERSION` string.
2023-05-05 22:17:42 -04:00
mattstauffer
cbb571f7ac Fix code styling 2023-04-26 13:13:37 +00:00
Matt Stauffer
3790e512af Merge branch 'master' into version-4 2023-02-15 13:21:58 -05:00
driesvints
044bdc15a8 Fix code styling 2023-02-14 16:56:59 +00:00
Matt Stauffer
303462ffd1 Add Expose support, drop ngrok binary and move it to be managed by Brew, drop copying ngrok share URL to clipbaord
* Extract basic driver with public/ from basic driver, and simplify both

* Apply fixes from StyleCI

* Set HTTP_HOST in BaseDriverTest

* Move server helpers to their own file; add type hints

* Update drivers location and loading

- Extract much of server.php into a `Server` class
- Move all but the Laravel and Basic drivers into a subfolder
- Load all but the Laravel and Basic drivers via glob
- Add `beforeLoading` hook to simplify the `frontControllerPath` method for some drivers

* Apply fixes from StyleCI

* Add additional notes to upgrade.md

* Apply fixes from StyleCI

* Require PHP 8.0

* Add type hints and return type hints to Brew

* Apply fixes from StyleCI

* Add type hints and return type hints to CommandLine

* Add type hints and return type hints to Configuration

* Add type hints and return type hints to Diagnose

* Apply fixes from StyleCI

* Add type hints and return type hints to DnsMasq

* Add type hints and return hints to Filesystem

* Add type hints and return types to Nginx

* Add type hints and return types to ngrok

* Add type hints and return types to PhpFpm

* Apply fixes from StyleCI

* Add type hints and return types to Site and Valet

* Apply fixes from StyleCI

* Require passing a version number to isolate command

* Apply fixes from StyleCI

* Bump compat to php 8; add type hints and return types to helpers

* Apply fixes from StyleCI

* Use constructor promotion

* Apply fixes from StyleCI

* Write tests for Server.php

* Apply fixes from StyleCI

* Move upgrade calls into Upgrader class, and add upgrade to check for old custom drivers

* Apply fixes from StyleCI

* Replace some \n with PHP_EOL; move custom drivers into Custom namespace

* Apply fixes from StyleCI

* Add doc blocks

* Clean up NullWriter; drop legacy config check

* Allow null response from frontControllerPath

* Apply fixes from StyleCI

* Drop exits, fix 404 path

* Better handle new installations

* Apply fixes from StyleCI

* Drop extensions

* Clean up DX for fetch-share-url

* Apply fixes from StyleCI

* Fix site::unlink method signature and docblock

* Tweak the wording for the which command

* Support isolated sites running PHP 7.4

* Add a bunch more CLI command tests (#1332)

* Wip some cli tests

* Apply fixes from StyleCI

* Test parked command

* Test forget command

* Update Filesystem::rmDirAndContents to respect symlinks

* Wip cli commands

* Apply fixes from StyleCI

* Test link command, unlink command, and secure command

* Apply fixes from StyleCI

* Add tests for unsecure, unsecure --all, secured commands

Add placeholders for the remaining CLI commands
Add nginx::restart to unsecure --all command

Co-authored-by: StyleCI Bot <bot@styleci.io>

* Drop old config migrations

* Add status command (#1329)

* Build the foundation of a status command

* Apply fixes from StyleCI

* Wip testing status command

* Apply fixes from StyleCI

* Fix status test

* Apply fixes from StyleCI

* Fix race condition in creating test config file

* Apply fixes from StyleCI

* Reset container for each test

* Differentiate response code based on success or failure of status command

* Apply fixes from StyleCI

* Add the ability to test if a Brew service is running

* Apply fixes from StyleCI

* Check for more services running in status command

* Apply fixes from StyleCI

* Test Status

* Apply fixes from StyleCI

* Drop Yoast from base application test case

Co-authored-by: StyleCI Bot <bot@styleci.io>

* Test most of the remaining CLI commands

* Test set tld command

* Test set loopback command

* Test proxy, unproxy, and proxies commands

* Apply fixes from StyleCI

* Test which command

* Test diagnose command

* Test directory-listing and which-php commands

* Text isolate and unisolate and isolated commands

* Apply fixes from StyleCI

* Test trust command

* Apply fixes from StyleCI

* Test on-latest-version command

* Move uninstall text to a class, and tweak text and presentation

* Apply fixes from StyleCI

* Test use command

* Test stop command

* Test start command

* Test restart command

Co-authored-by: StyleCI Bot <bot@styleci.io>

* Drop unnecessary doc blocks (#1339)

* Drop unnecessary doc blocks

* Apply fixes from StyleCI

Co-authored-by: StyleCI Bot <bot@styleci.io>

* Tweak status output and install output

* Add debug instructions to valet status, expand "valet installed" status check

* Drop extensions directory

* Apply fixes from StyleCI

* Remove more docblocks

* Upgrade ngrok to 3.1.0

* Test force uninstall command

* Test log command

* Drop copying Ngrok share to clipboard; add first steps of Expose code

* Add logic paths for Expose vs. ngrok and the share-tool config

* Apply fixes from StyleCI

* Take the first steps of manually installing ngrok and expose when needed

* Apply fixes from StyleCI

* Next steps Brew-installed ngrok

* Apply fixes from StyleCI

* Add class to represent Composer; continue ngrok + expose updates

* Apply fixes from StyleCI

* Add ensureInstalled() method to Expose and installOrFail() to Composer

* Apply fixes from StyleCI

* Require global PHP 8+ to install

* Exit if invalid domain is passed to valet share

* Update Composer dependencies to use Illuminate/Container

* Drop the idea of passing a custom domain to valet share

Co-authored-by: StyleCI Bot <bot@styleci.io>
2023-01-13 21:34:37 -05:00
Matt Stauffer
831779cec0 Remove more docblocks 2023-01-11 11:40:32 -05:00
Matt Stauffer
9b503a2ed3 Add type hints and return type hints to Brew 2022-12-18 15:40:12 -06:00
Dries Vints
a0e1e02a47 Test Valet commands (#1256)
* 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>
2022-12-02 09:32:28 +01:00
Matt Stauffer
ef151b076e Fix tests to prepend 'disable auto cleanup' env var 2022-12-01 20:31:49 -05:00
Dries Vints
d0d42acff7 PHP 8.2 support (#1279)
* PHP 8.2 support

* wip

* Apply fixes from StyleCI

* wip

* wip

* wip

* Update tests.yml

Co-authored-by: StyleCI Bot <bot@styleci.io>
2022-09-08 13:37:17 +02:00
Matt Stauffer
0045896d8e Merge pull request #1216 from NasirNobin/feature/valet-run
PHP version isolation helper for command line
2022-03-31 09:55:22 -04:00
be57ffaf36 CI fixes 2022-03-29 20:07:19 +02:00
a52355ec49 Restore original directory permissions
As discussed in #1220, cleaning up after stopping Homebrew services that
run as root is probably the best solution for now.

What's changed:

- Stopping any Homebrew service now restores the appropriate permissions
  for the Homebrew directories
- Stopping nginx now also happens via $this->brew
  (to avoid code duplication)

The tests were updated to reflect this change.
2022-03-29 19:59:33 +02:00
Nasir Uddin Nobin
40cb21ec91 Apply suggestions from code review
Co-authored-by: Matt Stauffer <mattstauffer@users.noreply.github.com>
2022-03-29 08:56:01 +06:00
NasirNobin
23aebbe1d9 StyleCI Patch 2022-03-24 05:17:13 +06:00
Nasir Uddin Nobin
6d3d191f44 [wip] Valet run/refactor with brew opt (#9) 2022-03-24 05:15:45 +06:00
Nasir Uddin Nobin
fbf96b9abc Apply suggestions from code review
Co-authored-by: Shifat Hossain <52673893+shifat160@users.noreply.github.com>
2022-03-23 14:16:57 +06:00
NasirNobin
6f085bc70e StyleCI Patch 2022-03-23 04:13:00 +06:00
Nasir Uddin Nobin
605118d3e4 Update tests/BrewTest.php 2022-03-23 03:46:11 +06:00
Nasir Uddin Nobin
faeee5eb9a Apply suggestions from code review 2022-03-23 02:02:49 +06:00
NasirNobin
ca2924daca Self code review 2022-03-23 01:35:30 +06:00
NasirNobin
84f59b4890 test readability 2022-03-22 19:44:10 +06:00
NasirNobin
720fed1a43 refactor code & tests 2022-03-22 19:07:45 +06:00
NasirNobin
245c68e708 wip 2022-03-22 17:05:10 +06:00
NasirNobin
d9ebb471b7 tests added 2022-03-22 17:00:24 +06:00
NasirNobin
1824ae4989 wip 2022-03-22 16:25:26 +06:00
StyleCI Bot
e797774ade Apply fixes from StyleCI 2022-03-12 05:06:07 +00:00
Matt Stauffer
eefc06b07f Drop PHP 5.6; extract site-specific PHP version isolation to its own commands 2022-03-12 00:05:51 -05:00
Cristian Calara
70335bade8 Fix styleci & drop typehint for php5.6 compatibility 2022-01-08 11:05:41 +02:00
Cristian Calara
9e3a89c742 Stop root homebrew services on php version switch
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.
2022-01-08 10:30:13 +02:00
Taylor Otwell
101abeae0e Apply fixes from StyleCI 2021-12-06 10:40:37 +00:00
Chris Brown
c549c1786a Stop non-root homebrew services during restarts
This is intended to assist with avoiding having competing non-root instances of valet dependency services running due to userland use of brew CLI commands.

Now, when running `valet stop` or `valet restart` it will (silently) attempt to stop the non-root instance (ignoring any errors thrown), before stopping (and/or starting) the sudo/root instance which is normally used.

(Though obvious, I'll point out that this only applies to services Valet manages.)

Fixes #1057
2021-06-13 01:33:22 -04:00
Matt Stauffer
04d42b3895 Merge pull request #1008 from drbyte/valet-use-improvements
Improvements to "valet use" command
2020-11-29 22:49:25 -05:00
Chris Brown
0b341a7ca1 Update test suite to phpunit 9.5
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.
2020-11-29 12:10:05 -05:00
Chris Brown
7d98b24330 Update tests for valet-use improvements 2020-11-28 23:52:28 -05:00
soilSpoon
cbb59c2251 Update brew list command to remove deprecation warning 2020-11-27 22:21:27 +09:00
soilSpoon
2c06a5d4f0 Modify the paths of packages to be based on brew prefix
- brew
- dnsmasq
- nginx
- php-fpm
- log
- etc
2020-11-15 14:38:18 +09:00
soilSpoon
6a4cb74392 Modify php binary path to be based on brew prefix 2020-11-14 21:42:13 +09:00
Miguel Piedrafita
778a877fdf Support php@8.0 and php@8.1 2020-10-28 15:16:18 +00:00
Chris Brown
95264a6e0d Modernize PHP unit tests
Replaces and closes #564
2019-12-27 15:09:04 -05:00
Matt Stauffer
fb562977f0 Fix 7.7 typo in brew test 2019-11-30 14:21:31 -05:00
lee
b2faf6cc5a added assertions to fix test 2019-11-29 23:29:25 +01:00
James Barnard
e5e7c74f1d use formula to restart php instead of version 2019-01-29 12:29:28 -05:00
James Barnard
0bf3078220 update to unlink not the current version but the currently linked formula path (handles bug with latest version under php path) 2019-01-28 20:26:13 -05:00
James Barnard
ece3a1ff2f clean up to remove search, refactor to better handle versions using regex 2019-01-28 20:26:13 -05:00
James Barnard
6158e5129b add more tests for new methods and bits of clean up 2019-01-28 20:26:13 -05:00