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

Check for tld on end of certificate file name to support multi segment tld's

This commit is contained in:
James Barnard
2019-10-02 13:56:51 +01:00
parent eb0f03869c
commit e5dceb2bc5
2 changed files with 40 additions and 2 deletions

View File

@@ -28,6 +28,28 @@ public function tearDown()
}
public function test_get_certificates_will_return_without_multi_segment_tld()
{
$files = Mockery::mock(Filesystem::class);
$files->shouldReceive('scandir')
->once()
->with($certPath = '/Users/testuser/.config/valet/Certificates')
->andReturn(['helloworld.multi.segment.tld.com.crt']);
$config = Mockery::mock(Configuration::class);
$config->shouldReceive('read')
->once()
->andReturn(['tld' => 'multi.segment.tld.com']);
swap(Filesystem::class, $files);
swap(Configuration::class, $config);
/** @var Site $site */
$site = resolve(Site::class);
$certs = $site->getCertificates($certPath);
$this->assertSame(['helloworld' => 0], $certs->all());
}
public function test_symlink_creates_symlink_to_given_path()
{
$files = Mockery::mock(Filesystem::class);
@@ -77,6 +99,12 @@ public function test_certificates_trim_tld_for_custom_tlds()
'fiveletters.local.crt',
]);
$config = Mockery::mock(Configuration::class);
$config->shouldReceive('read')
->once()
->andReturn(['tld' => 'other']);
swap(Configuration::class, $config);
swap(Filesystem::class, $files);
$site = resolve(Site::class);