Resolve AT Protocol DIDs, handles, and schemas with intelligent caching for Laravel
1<?php
2
3namespace SocialDept\AtpResolver\Tests\Unit;
4
5use PHPUnit\Framework\TestCase;
6use SocialDept\AtpResolver\Exceptions\DidResolutionException;
7use SocialDept\AtpResolver\Resolvers\WebDidResolver;
8
9class WebDidResolverTest extends TestCase
10{
11 public function test_it_supports_web_method(): void
12 {
13 $resolver = new WebDidResolver();
14
15 $this->assertTrue($resolver->supports('web'));
16 $this->assertFalse($resolver->supports('plc'));
17 $this->assertFalse($resolver->supports('unknown'));
18 }
19
20 public function test_it_throws_exception_for_invalid_did_format(): void
21 {
22 $this->expectException(DidResolutionException::class);
23 $this->expectExceptionMessage('Invalid DID format');
24
25 $resolver = new WebDidResolver();
26 $resolver->resolve('invalid-did');
27 }
28
29 public function test_it_throws_exception_for_unsupported_method(): void
30 {
31 $this->expectException(DidResolutionException::class);
32 $this->expectExceptionMessage('Unsupported DID method: plc');
33
34 $resolver = new WebDidResolver();
35 $resolver->resolve('did:plc:abc123');
36 }
37}