/** * Tests the usePalette() method. */ public function testUsePalette() { $image = new Image(new \DOMDocument(), new MetadataBag()); $this->setExpectedException('Imagine\\Exception\\RuntimeException'); $image->usePalette($this->getMock('Imagine\\Image\\Palette\\PaletteInterface')); }
/** * Extracts the SVG image size from the given XMLReader object. * * @param XMLReader $reader * * @return BoxInterface|null */ private function getSvgSizeFromReader(XMLReader $reader) { // Move the pointer to the first element in the document while ($reader->read() && $reader->nodeType !== XMLReader::ELEMENT) { } if ($reader->nodeType !== XMLReader::ELEMENT || $reader->name !== 'svg') { return null; } $document = new DOMDocument(); $svg = $document->createElement('svg'); $document->appendChild($svg); foreach (['width', 'height', 'viewBox'] as $key) { if ($value = $reader->getAttribute($key)) { $svg->setAttribute($key, $value); } } $image = new SvgImage($document, new MetadataBag()); return $image->getSize(); }