decoder = new DataUriImageDecoder(); $this->decoder->setDriver(new Driver()); } public function testDecode(): void { $result = $this->decoder->decode( sprintf('data:image/jpeg;base64,%s', base64_encode($this->getTestResourceData('blue.gif'))) ); $this->assertInstanceOf(Image::class, $result); } public function testDecoderNonString(): void { $this->expectException(DecoderException::class); $this->decoder->decode(new stdClass()); } public function testDecoderInvalid(): void { $this->expectException(DecoderException::class); $this->decoder->decode('invalid'); } public function testDecoderNonImage(): void { $this->expectException(DecoderException::class); $this->decoder->decode('data:text/plain;charset=utf-8,test'); } }