@@ -28,6 +28,28 @@ public function tearDown()
2828 }
2929
3030
31+ public function test_get_certificates_will_return_with_multi_segment_tld ()
32+ {
33+ $ files = Mockery::mock (Filesystem::class);
34+ $ files ->shouldReceive ('scandir ' )
35+ ->once ()
36+ ->with ($ certPath = '/Users/testuser/.config/valet/Certificates ' )
37+ ->andReturn (['helloworld.multi.segment.tld.com.crt ' ]);
38+ $ config = Mockery::mock (Configuration::class);
39+ $ config ->shouldReceive ('read ' )
40+ ->once ()
41+ ->andReturn (['tld ' => 'multi.segment.tld.com ' ]);
42+
43+ swap (Filesystem::class, $ files );
44+ swap (Configuration::class, $ config );
45+
46+ /** @var Site $site */
47+ $ site = resolve (Site::class);
48+ $ certs = $ site ->getCertificates ($ certPath );
49+ $ this ->assertSame (['helloworld ' => 0 ], $ certs ->all ());
50+ }
51+
52+
3153 public function test_get_sites_will_return_if_secured ()
3254 {
3355 $ files = Mockery::mock (Filesystem::class);
@@ -206,6 +228,12 @@ public function test_certificates_trim_tld_for_custom_tlds()
206228 'fiveletters.local.crt ' ,
207229 ]);
208230
231+ $ config = Mockery::mock (Configuration::class);
232+ $ config ->shouldReceive ('read ' )
233+ ->once ()
234+ ->andReturn (['tld ' => 'other ' ]);
235+
236+ swap (Configuration::class, $ config );
209237 swap (Filesystem::class, $ files );
210238
211239 $ site = resolve (Site::class);
0 commit comments