mirror of
https://github.com/laravel/valet.git
synced 2026-02-08 01:10:08 +01:00
test case updated
This commit is contained in:
@@ -58,7 +58,7 @@ public function findHttpTunnelUrl(array $tunnels, string $domain): ?string
|
|||||||
// If there are active tunnels on the Ngrok instance we will spin through them and
|
// If there are active tunnels on the Ngrok instance we will spin through them and
|
||||||
// find the one responding on HTTP. Each tunnel has an HTTP and a HTTPS address
|
// find the one responding on HTTP. Each tunnel has an HTTP and a HTTPS address
|
||||||
foreach ($tunnels as $tunnel) {
|
foreach ($tunnels as $tunnel) {
|
||||||
if (($tunnel->proto === 'http' || $tunnel->proto === 'https') && strpos($tunnel->config->addr, strtolower($domain))) {
|
if (($tunnel->proto === 'http' || $tunnel->proto === 'https') && stripos($tunnel->config->addr, $domain)) {
|
||||||
return $tunnel->public_url;
|
return $tunnel->public_url;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,26 +31,21 @@ public function test_it_matches_correct_share_tunnel()
|
|||||||
'config' => (object) [
|
'config' => (object) [
|
||||||
'addr' => 'http://mysite.test:80',
|
'addr' => 'http://mysite.test:80',
|
||||||
],
|
],
|
||||||
'public_url' => 'http://bad-proto.ngrok.io/',
|
'public_url' => 'https://right-one.ngrok.io/',
|
||||||
],
|
],
|
||||||
(object) [
|
(object) [
|
||||||
'proto' => 'http',
|
'proto' => 'http',
|
||||||
'config' => (object) [
|
'config' => (object) [
|
||||||
'addr' => 'http://nottherightone.test:80',
|
'addr' => 'http://mynewsite.test:80',
|
||||||
],
|
],
|
||||||
'public_url' => 'http://bad-site.ngrok.io/',
|
'public_url' => 'http://new-right-one.ngrok.io/',
|
||||||
],
|
|
||||||
(object) [
|
|
||||||
'proto' => 'http',
|
|
||||||
'config' => (object) [
|
|
||||||
'addr' => 'http://mysite.test:80',
|
|
||||||
],
|
|
||||||
'public_url' => 'http://right-one.ngrok.io/',
|
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
$ngrok = resolve(Ngrok::class);
|
$ngrok = resolve(Ngrok::class);
|
||||||
$this->assertEquals('http://right-one.ngrok.io/', $ngrok->findHttpTunnelUrl($tunnels, 'mysite'));
|
$this->assertEquals('https://right-one.ngrok.io/', $ngrok->findHttpTunnelUrl($tunnels, 'mysite'));
|
||||||
|
$this->assertEquals('http://new-right-one.ngrok.io/', $ngrok->findHttpTunnelUrl($tunnels, 'mynewsite'));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_it_checks_against_lowercased_domain()
|
public function test_it_checks_against_lowercased_domain()
|
||||||
|
|||||||
Reference in New Issue
Block a user