8000 [12.x] Introducing `toUri` to the `Stringable` Class by devajmeireles · Pull Request #55862 · laravel/framework · GitHub
[go: up one dir, main page]

Skip to content

[12.x] Introducing toUri to the Stringable Class #55862

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Tests
  • Loading branch information
devajmeireles committed May 26, 2025
commit ae2c774254dc1e672c47aae75ea0bffa19b2afbd
12 changes: 12 additions & 0 deletions tests/Support/SupportStringableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Illuminate\Support\Collection;
use Illuminate\Support\HtmlString;
use Illuminate\Support\Stringable;
use Illuminate\Support\Uri;
use League\CommonMark\Environment\EnvironmentBuilderInterface;
use League\CommonMark\Extension\ExtensionInterface;
use PHPUnit\Framework\TestCase;
Expand Down Expand Up @@ -1397,6 +1398,17 @@ public function testToDateThrowsException()
$this->stringable('not a date')->toDate();
}

public function testToUri()
{
$sentence = 'Laravel is a PHP framework. You can access the docs in: {https://laravel.com/docs}';

$uri = $this->stringable($sentence)->between('{', '}')->toUri();

$this->assertInstanceOf(Uri::class, $uri);
$this->assertSame('https://laravel.com/docs', (string) $uri);
$this->assertSame('https://laravel.com/docs', $uri->toHtml());
}

public function testArrayAccess()
{
$str = $this->stringable('my string');
Expand Down
0