function CDNImageTestCase::testOtherContentLinkWrappingImage in CDN 7.2
File
- tests/cdn.test, line 614
- Test CDN.
Class
- CDNImageTestCase
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);
$template = function ($a_url, $img_url) {
return '<a href="' . $a_url . '"><img src="' . $img_url . '" /></a>';
};
$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).');
}