Exemple #1
0
 /**
  * Make sure that hrefs get sanitized correctly
  */
 public function testSanitizeHrefs()
 {
     $initialData = file_get_contents('tests/data/hrefTestOne.svg');
     $expected = file_get_contents('tests/data/hrefCleanOne.svg');
     $cleanData = $this->class->sanitize($initialData);
     $this->assertXmlStringEqualsXmlString($expected, $cleanData);
 }
 /**
  * Checks if thise file is a valid SVG.
  *
  * @return boolean|null
  */
 protected function leadSVG()
 {
     // Create a new sanitizer instance
     $sanitizer = new Sanitizer();
     // Load the dirty svg
     $dirtySVG = file_get_contents($this->file);
     // Pass it to the sanitizer and get it back clean
     $cleanSVG = $sanitizer->sanitize($dirtySVG);
     if (is_string($cleanSVG)) {
         return $this->closeCase("svg", "image/svg+xml");
     }
     return false;
 }