public function test_extractor_updates_urls_in_css() { $content = "body { background-image: url('/two.gif'); }"; $response = Simply_Static_Url_Response_Factory::build('css', $content, self::URL); $response->extract_urls(); $this->assertEquals("body { background-image: url('http://example.org/two.gif'); }", $response->body); }
/** * @covers Simply_Static_Url_Response::replace_url */ public function test_replace_url() { $origin_url = 'www.origin.test'; $destination_url = 'www.destination.test'; $content = $origin_url; $response = Simply_Static_Url_Response_Factory::build('html', $content); $response->replace_url($origin_url, $destination_url); $this->assertEquals($destination_url, $response->body); }
public static function build($content_type, $body, $url) { $response = Simply_Static_Url_Response_Factory::build($content_type, $body, $url); return new Simply_Static_Url_Extractor($response); }