public function HoneypotCssTestCase::testHoneypotCssAvailability in Honeypot 7
Test CSS file availability.
File
- ./
honeypot.test, line 410 - Testing for Honeypot module.
Class
- HoneypotCssTestCase
- Test Honeypot's CSS generation routines.
Code
public function testHoneypotCssAvailability() {
// Public CSS file can be consumed.
variable_set('file_default_scheme', 'public');
if ($wrapper = file_stream_wrapper_get_instance_by_uri(honeypot_get_css_file_path())) {
$url = $wrapper
->getExternalUrl();
}
$this
->drupalGet($url);
$this
->assertResponse(200);
// Private CSS file can not be consumed.
variable_set('file_default_scheme', 'private');
honeypot_cron();
if ($wrapper = file_stream_wrapper_get_instance_by_uri(honeypot_get_css_file_path())) {
$url = $wrapper
->getExternalUrl();
}
$this
->drupalGet($url);
$this
->assertNoResponse(200);
// Site default is private, but override honeypot's to public to consume.
variable_set('honeypot_file_default_scheme', 'public');
honeypot_cron();
if ($wrapper = file_stream_wrapper_get_instance_by_uri(honeypot_get_css_file_path())) {
$url = $wrapper
->getExternalUrl();
}
$this
->drupalGet($url);
$this
->assertResponse(200);
}