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\PlcDidResolver;
8
9class PlcDidResolverTest extends TestCase
10{
11 public function test_it_supports_plc_method(): void
12 {
13 $resolver = new PlcDidResolver();
14
15 $this->assertTrue($resolver->supports('plc'));
16 $this->assertFalse($resolver->supports('web'));
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 PlcDidResolver();
26 $resolver->resolve('invalid-did');
27 }
28
29 public function test_it_throws_exception_for_incomplete_did(): void
30 {
31 $this->expectException(DidResolutionException::class);
32 $this->expectExceptionMessage('Invalid DID format');
33
34 $resolver = new PlcDidResolver();
35 $resolver->resolve('did:plc');
36 }
37
38 public function test_it_throws_exception_for_unsupported_method(): void
39 {
40 $this->expectException(DidResolutionException::class);
41 $this->expectExceptionMessage('Unsupported DID method: web');
42
43 $resolver = new PlcDidResolver();
44 $resolver->resolve('did:web:example.com');
45 }
46}