add to be url expectation

This commit is contained in:
JonPurvis
2023-10-09 20:02:11 +01:00
parent 2ffafd445d
commit 5101b9dce3
3 changed files with 48 additions and 0 deletions

View File

@ -1142,4 +1142,20 @@ final class Expectation
return $this;
}
/**
* Asserts that the value is a url
*
* @return self<TValue>
*/
public function toBeUrl(string $message = ''): self
{
if ($message === '') {
$message = "Failed asserting that {$this->value} is a url.";
}
Assert::assertTrue(Str::isUrl((string) $this->value), $message);
return $this;
}
}