1
0
mirror of https://github.com/laravel/valet.git synced 2026-02-06 16:50:09 +01:00

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.
This commit is contained in:
Chris Brown
2020-11-28 13:23:59 -05:00
parent b01556272d
commit 0b341a7ca1
12 changed files with 68 additions and 128 deletions

View File

@@ -10,17 +10,16 @@
use function Valet\swap;
use Illuminate\Container\Container;
class DnsMasqTest extends PHPUnit_Framework_TestCase
class DnsMasqTest extends Yoast\PHPUnitPolyfills\TestCases\TestCase
{
public function setUp()
public function set_up()
{
$_SERVER['SUDO_USER'] = user();
Container::setInstance(new Container);
}
public function tearDown()
public function tear_down()
{
exec('rm -rf '.__DIR__.'/output');
mkdir(__DIR__.'/output');
@@ -29,7 +28,6 @@ public function tearDown()
Mockery::close();
}
public function test_install_installs_and_places_configuration_files_in_proper_locations()
{
$brew = Mockery::mock(Brew::class);
@@ -56,7 +54,6 @@ public function test_install_installs_and_places_configuration_files_in_proper_l
);
}
public function test_update_tld_removes_old_resolver_and_reinstalls()
{
$cli = Mockery::mock(CommandLine::class);
@@ -68,7 +65,6 @@ public function test_update_tld_removes_old_resolver_and_reinstalls()
}
}
class StubForCreatingCustomDnsMasqConfigFiles extends DnsMasq
{
public function dnsmasqUserConfigDir()