function BirthdaysTestCase::testStarsigns in Birthdays 6
Test the starsigns visibility options.
File
- ./
birthdays.test, line 147 - Tests for the Birthdays module.
Class
- BirthdaysTestCase
- @file Tests for the Birthdays module.
Code
function testStarsigns() {
$this
->drupalLogin($this->web_user);
// Set birthday of user.
$birthday = array(
$this->field->name . '[month]' => 3,
$this->field->name . '[day]' => 23,
$this->field->name . '[year]' => 1980,
);
$this
->drupalPost('user/' . $this->web_user->uid . '/edit/' . $this->field->category, $birthday, t('Save'));
// Confirm absense of starsign.
$this
->drupalGet('user');
$this
->assertNoText('aries', 'Starsign is not displayed.');
// Set starsigns to visible, without link.
variable_set('birthdays_show_starsign', BIRTHDAYS_STARSIGN_NOLINK);
// Confirm presence of starsign, but absense of link.
$this
->drupalGet('user');
$this
->assertRaw('<span class="birthdays-starsign"><img src="' . base_path() . drupal_get_path('module', 'birthdays') . '/starsigns/aries.gif" alt="aries" /></span>', 'Starsign is displayed without link.');
// Set starsigns to visible, with link.
variable_set('birthdays_show_starsign', BIRTHDAYS_STARSIGN_LINK);
// Confirm presence of starsign, with link.
$this
->drupalGet('user');
$this
->assertRaw('<span class="birthdays-starsign"><a href="http://astrology.yahoo.com/astrology/general/dailyoverview/aries" target="_blank" title="aries"><img src="' . base_path() . drupal_get_path('module', 'birthdays') . '/starsigns/aries.gif" alt="aries" /></a></span>', 'Starsign is displayed with link.');
}