Skip to content

Commit 4ee1a95

Browse files
devcircusdriesvints
authored andcommitted
Allow multiple spaces between words in subject (#322)
1 parent 94b796e commit 4ee1a95

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

app/Validation/DoesNotContainUrlRule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function validate($attribute, $value): bool
2222
{
2323
return ! collect(explode(' ', $value))->contains(function ($word) {
2424
return $this->validator
25-
->make(compact('word'), ['word' => 'url'])
25+
->make(compact('word'), ['word' => 'url|required'])
2626
->passes();
2727
});
2828
}

tests/Components/Validation/DoesNotContainUrlRuleTest.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class DoesNotContainUrlRuleTest extends TestCase
99
{
1010
const STRING_WITH_URL = 'This is a string http://example.com with an url in it.';
1111
const STRING_WITHOUT_URL = 'This is a string without an url in it.';
12-
const STRING_WITH_A_REGRESSION = 'JSON not possible with MSSQL running on Windows platform?';
12+
const STRING_WITH_EXTRA_SPACES = 'This is a string with extra spaces.';
1313

1414
/** @test */
1515
public function it_detects_a_url_in_a_string()
@@ -23,6 +23,12 @@ public function it_passes_when_no_url_is_present()
2323
$this->assertTrue($this->runRule(self::STRING_WITHOUT_URL));
2424
}
2525

26+
/** @test */
27+
public function it_passes_when_extra_spaces_are_present()
28+
{
29+
$this->assertTrue($this->runRule(self::STRING_WITH_EXTRA_SPACES));
30+
}
31+
2632
private function runRule(string $value): bool
2733
{
2834
return $this->app->make(DoesNotContainUrlRule::class)->validate(null, $value);

0 commit comments

Comments
 (0)