function CDNImageTestCase::testOtherContentLinkWrappingImage in CDN 7.2
File
- tests/
cdn.test, line 614 - Test CDN.
Class
Code
function testOtherContentLinkWrappingImage() {
$cdn = 'http://cdn-a.com';
$this
->variableSet(CDN_BASIC_MAPPING_VARIABLE, "{$cdn}|.png .jpeg");
$this
->variableSet(CDN_MODE_VARIABLE, CDN_MODE_BASIC);
// Image altering type 2: "linked image", i.e. "<a><img /></a>"..
$template = function ($a_url, $img_url) {
return '<a href="' . $a_url . '"><img src="' . $img_url . '" /></a>';
};
// Test that images linking to a URL with an extension that matches a
// mapped extension, even if the extension is different than the image,
// are modified.
$a_url = base_path() . 'node.jpeg';
$img_url = base_path() . 'foo/bar/image.png';
$html = $template($a_url, $img_url);
$html = cdn_post_render_html_alter($html);
$this
->assertIdentical($template($cdn . $a_url, $cdn . $img_url), $html, 'Other content link wrapping image correctly altered.');
$a_url = base_path() . 'node.gif';
$html = $template($a_url, $img_url);
$html = cdn_post_render_html_alter($html);
$this
->assertIdentical($template($a_url, $cdn . $img_url), $html, 'Other content link wrapping correctly NOT altered (extension does not map).');
}