FaviconDeliveryTestCase.test in Favicon 7.2
File
tests/FaviconDeliveryTestCase.test
View source
<?php
class FaviconDeliveryTestCase extends FaviconTestBase {
public static function getInfo() {
return array(
'name' => 'Favicon delivery',
'description' => 'Tests the various delivery methods for favicons.',
'group' => 'Favicon',
);
}
public function setUp() {
parent::setUp();
variable_set('cache', TRUE);
}
public function testDelivery() {
$favicon_contents = file_get_contents(DrupalFavicon::DEFAULT_URI);
$account = $this
->drupalCreateUser(array(
'administer site configuration',
));
$this
->drupalLogin($account);
$this
->drupalPost('admin/config/system/favicon', array(), 'Save configuration');
$this
->drupalGet('favicon.ico');
$this
->assertUrl('favicon.ico');
$this
->assertIdentical($this
->drupalGetContent(), $favicon_contents);
$this
->drupalLogout();
$this
->drupalGet('favicon.ico');
$this
->assertUrl('favicon.ico');
$this
->assertIdentical($this
->drupalGetContent(), $favicon_contents);
$this
->drupalLogin($account);
$edit = array(
'favicon_delivery_callback' => 'DrupalFavicon::deliverFileRedirect',
);
$this
->drupalPost('admin/config/system/favicon', $edit, 'Save configuration');
$this
->drupalGet('favicon.ico');
$this
->assertUrl(file_create_url('misc/favicon.ico'));
$this
->assertIdentical($this
->drupalGetContent(), $favicon_contents);
$this
->drupalLogout();
$this
->drupalGet('favicon.ico');
$this
->assertUrl(file_create_url('misc/favicon.ico'));
$this
->assertIdentical($this
->drupalGetContent(), $favicon_contents);
}
}