expectException(InvariantViolationException::class); $this->expectExceptionMessage('$from_encoding is invalid.'); Str\convert_encoding('Hello, World!', 'foobar', 'UTF-8'); } public function testConvertEncodingThrowsForInvalidToEncoding(): void { $this->expectException(InvariantViolationException::class); $this->expectExceptionMessage('$to_encoding is invalid.'); Str\convert_encoding('Hello, World!', 'ASCII', 'UTF-1337'); } }