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

Drop test coverage for deprecated method

This commit is contained in:
Matt Stauffer
2022-03-13 22:29:09 -04:00
parent fd47384768
commit 148eb0174d

View File

@@ -114,83 +114,6 @@ public function test_utilized_php_versions()
$this->assertEquals(['php@7.1', 'php@7.2', 'php@7.3'], resolve(PhpFpm::class)->utilizedPhpVersions());
}
public function test_global_php_version_update_will_swap_socks()
{
$this->markTestIncomplete('Needs deleting or refactoring');
$fileSystemMock = Mockery::mock(Filesystem::class);
$phpFpmMock = Mockery::mock(PhpFpm::class, [
Mockery::mock(Brew::class),
Mockery::mock(CommandLine::class),
$fileSystemMock,
resolve(Configuration::class),
Mockery::mock(Site::class),
Mockery::mock(Nginx::class),
])->makePartial();
swap(PhpFpm::class, $phpFpmMock);
$fileSystemMock->shouldReceive('scandir')
->once()
->with(VALET_HOME_PATH.'/Nginx')
->andReturn([
'.gitkeep',
'isolated-site-71.test',
'isolated-site-72.test',
'isolated-site-73.test',
'non-isolated-site.test',
]);
// Skip dotfiles
$fileSystemMock->shouldNotReceive('get')->with(VALET_HOME_PATH.'/Nginx/.gitkeep');
// Any isolated site running on php72 would be replaced with default valet.sock,
// as 72 will be the default version after the global PHP version switch
$fileSystemMock->shouldReceive('get')
->once()
->with(VALET_HOME_PATH.'/Nginx/isolated-site-72.test')
->andReturn('# Valet isolated PHP version : 72'.PHP_EOL.'server { fastcgi_pass: valet72.sock }');
$fileSystemMock->shouldReceive('put')->once()->withArgs([
VALET_HOME_PATH.'/Nginx/isolated-site-72.test',
'# Valet isolated PHP version : 72'.PHP_EOL.'server { fastcgi_pass: valet.sock }',
]);
// Any isolated site running on current PHP version (with valet.sock),
// should be still be running on the same version after the global version update
$fileSystemMock->shouldReceive('get')
->once()
->with(VALET_HOME_PATH.'/Nginx/isolated-site-71.test')
->andReturn('# Valet isolated PHP version : 71'.PHP_EOL.'server { fastcgi_pass: valet.sock }');
$fileSystemMock->shouldReceive('put')->once()->withArgs([
VALET_HOME_PATH.'/Nginx/isolated-site-71.test',
'# Valet isolated PHP version : 71'.PHP_EOL.'server { fastcgi_pass: valet71.sock }',
]);
// PHP 7.3 sites won't be affected here
$fileSystemMock->shouldReceive('get')
->once()
->with(VALET_HOME_PATH.'/Nginx/isolated-site-73.test')
->andReturn('# Valet isolated PHP version : 73'.PHP_EOL.'server { fastcgi_pass: valet73.sock }');
$fileSystemMock->shouldNotReceive('put')->withArgs([
VALET_HOME_PATH.'/Nginx/isolated-site-73.test',
Mockery::any(),
]);
// Nginx config that doesn't have the isolation header, It would not swap .sock files
$fileSystemMock->shouldReceive('get')->once()->with(VALET_HOME_PATH.'/Nginx/non-isolated-site.test')->andReturn('valet.sock');
$fileSystemMock->shouldNotReceive('put')->withArgs([
VALET_HOME_PATH.'/Nginx/non-isolated-site.test',
'valet71.sock',
]);
// Switching from php7.1 to php7.2
resolve(PhpFpm::class)->updateConfigurationForGlobalUpdate('php@7.2', 'php@7.1');
}
public function test_stop_unused_php_versions()
{
$brewMock = Mockery::mock(Brew::class);
@@ -323,9 +246,6 @@ public function test_use_version_if_already_linked_php_will_unlink_before_instal
$cliMock->shouldReceive('quietly')->with('sudo rm '.VALET_HOME_PATH.'/valet.sock')->once();
$fileSystemMock->shouldReceive('unlink')->with(VALET_HOME_PATH.'/valet.sock')->once();
// $phpFpmMock->shouldReceive('createConfigurationFiles')->with('php@7.1')->once();
// $phpFpmMock->shouldReceive('updateConfigurationForGlobalUpdate')->withArgs(['php@7.2', 'php@7.1'])->once();
$brewMock->shouldReceive('supportedPhpVersions')->andReturn(collect([
'php@7.2',
'php@7.1',
@@ -389,7 +309,6 @@ public function test_isolate_will_isolate_a_site()
$brewMock->shouldNotReceive('unlink');
$phpFpmMock->shouldNotReceive('stopRunning');
$phpFpmMock->shouldNotReceive('install');
// $phpFpmMock->shouldNotReceive('updateConfigurationForGlobalUpdate');
$this->assertSame(null, $phpFpmMock->isolateDirectory('test', 'php@7.2'));
}