|
7 | 7 | use MongoDB\Codec\DecodeIfSupported;
|
8 | 8 | use MongoDB\Codec\EncodeIfSupported;
|
9 | 9 | use MongoDB\Codec\KnowsCodecLibrary;
|
10 |
| -use MongoDB\Exception\UnexpectedValueException; |
| 10 | +use MongoDB\Exception\UndecodableValueException; |
| 11 | +use MongoDB\Exception\UnencodableValueException; |
11 | 12 | use MongoDB\Tests\TestCase;
|
12 | 13 |
|
13 | 14 | class CodecLibraryTest extends TestCase
|
@@ -36,16 +37,16 @@ public function testDecodeNull(): void
|
36 | 37 |
|
37 | 38 | $this->assertFalse($codec->canDecode(null));
|
38 | 39 |
|
39 |
| - $this->expectException(UnexpectedValueException::class); |
40 |
| - $this->expectExceptionMessage('No decoder found for value of type "null"'); |
| 40 | + $this->expectException(UndecodableValueException::class); |
| 41 | + $this->expectExceptionMessage('Could not decode value of type "null"'); |
41 | 42 |
|
42 | 43 | $this->assertNull($codec->decode(null));
|
43 | 44 | }
|
44 | 45 |
|
45 | 46 | public function testDecodeUnsupportedValue(): void
|
46 | 47 | {
|
47 |
| - $this->expectException(UnexpectedValueException::class); |
48 |
| - $this->expectExceptionMessage('No decoder found for value of type "string"'); |
| 48 | + $this->expectException(UndecodableValueException::class); |
| 49 | + $this->expectExceptionMessage('Could not decode value of type "string"'); |
49 | 50 |
|
50 | 51 | $this->getCodecLibrary()->decode('foo');
|
51 | 52 | }
|
@@ -74,16 +75,16 @@ public function testEncodeNull(): void
|
74 | 75 |
|
75 | 76 | $this->assertFalse($codec->canEncode(null));
|
76 | 77 |
|
77 |
| - $this->expectException(UnexpectedValueException::class); |
78 |
| - $this->expectExceptionMessage('No encoder found for value of type "null"'); |
| 78 | + $this->expectException(UnencodableValueException::class); |
| 79 | + $this->expectExceptionMessage('Could not encode value of type "null"'); |
79 | 80 |
|
80 | 81 | $codec->encode(null);
|
81 | 82 | }
|
82 | 83 |
|
83 | 84 | public function testEncodeUnsupportedValue(): void
|
84 | 85 | {
|
85 |
| - $this->expectException(UnexpectedValueException::class); |
86 |
| - $this->expectExceptionMessage('No encoder found for value of type "string"'); |
| 86 | + $this->expectException(UnencodableValueException::class); |
| 87 | + $this->expectExceptionMessage('Could not encode value of type "string"'); |
87 | 88 |
|
88 | 89 | $this->getCodecLibrary()->encode('foo');
|
89 | 90 | }
|
|
0 commit comments