$text = 'This is a <img src="http://foo.bar/image.jpg" />'; $course_url = "http://example.com/testcourse"; $pf = new \WeBWorK\Server\Util\ProblemFormatter(); $found = $pf->convert_image_urls($text, $course_url); $this->assertContains('src="http://foo.bar/image.jpg"', $found); } public function test_convert_image_urls_should_ignore_spaces_after_attribute_names() { $text = 'This is a <a href = "/link">link</a> and <img src = "/image.jpg" />';