Skip to content
This repository was archived by the owner on Sep 22, 2025. It is now read-only.

Commit 4e20b20

Browse files
committed
Update polyfill to the latest RFC update around serialization
1 parent d649e09 commit 4e20b20

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

tests/WhatWg/UrlTest.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Uri\WhatWg;
6+
7+
use PHPUnit\Framework\Attributes\Test;
8+
use PHPUnit\Framework\TestCase;
9+
10+
final class UrlTest extends TestCase
11+
{
12+
#[Test]
13+
public function it_will_fail_parse_an_invalid_url(): void
14+
{
15+
$errors = [];
16+
$url = Url::parse("invalid url", null, $errors);
17+
18+
self::assertNull($url);
19+
self::assertNotEmpty($errors);
20+
self::assertInstanceOf(UrlValidationError::class, $errors[0]);
21+
self::assertSame(UrlValidationErrorType::MissingSchemeNonRelativeUrl, $errors[0]->type);
22+
}
23+
24+
#[Test]
25+
public function it_will_return_soft_errors_when_uri_is_parsed_with_errors(): void
26+
{
27+
$softErrors = [];
28+
$url = new Url(" https://example.org", null, $softErrors);
29+
30+
self::assertSame('https://example.org/', $url->toAsciiString());
31+
self::assertNotEmpty($softErrors);
32+
self::assertInstanceOf(UrlValidationError::class, $softErrors[0]);
33+
self::assertSame(UrlValidationErrorType::InvalidUrlUnit, $softErrors[0]->type);
34+
}
35+
}

0 commit comments

Comments
 (0)