Skip to content

Commit a5c26ba

Browse files
authored
[11.x] Test Improvements (#52933)
Ensure that it is expected that `Str::isUrl()` and `url` validation accepts URL without a valid TLD such as `localhost` Issue: #52921 Signed-off-by: Mior Muhammad Zaki <[email protected]>
1 parent ead6020 commit a5c26ba

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

tests/Support/SupportStrTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,7 @@ public function testIs()
529529
public function testIsUrl()
530530
{
531531
$this->assertTrue(Str::isUrl('https://laravel.com'));
532+
$this->assertTrue(Str::isUrl('http://localhost'));
532533
$this->assertFalse(Str::isUrl('invalid url'));
533534
}
534535

tests/Validation/ValidationValidatorTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4503,6 +4503,9 @@ public function testValidateUrlWithProtocols()
45034503
// Test with a standard protocol
45044504
$v = new Validator($trans, ['x' => 'http://laravel.com'], ['x' => 'url:https']);
45054505
$this->assertFalse($v->passes());
4506+
4507+
$v = new Validator($trans, ['x' => 'http://localhost'], ['x' => 'url']);
4508+
$this->assertTrue($v->passes());
45064509
}
45074510

45084511
#[DataProvider('validUrls')]

0 commit comments

Comments
 (0)