You are here

function sweaverThemeSettings::assertLogoFavicon in Sweaver 7

Same name and namespace in other branches
  1. 6 tests/sweaver.themesettings.test \sweaverThemeSettings::assertLogoFavicon()

Asserts for Logo & Favicon writes on file system.

Parameters

$scenario: The id of the scenario.

$style_id: The if of the style.

$gone: Whether the files should be gone or not.

$draft: Whether the draft version should exist or not.

$live: Whether the live version should exist or not.

$logo: The exentension of the logo.

$favicon_check: Whether we need to assert for the favicon.

4 calls to sweaverThemeSettings::assertLogoFavicon()
sweaverThemeSettings::testScenarioA in tests/sweaver.themesettings.test
Scenario A.
sweaverThemeSettings::testScenarioB in tests/sweaver.themesettings.test
Scenario B.
sweaverThemeSettings::testScenarioC in tests/sweaver.themesettings.test
Scenario C.
sweaverThemeSettings::testScenarioD in tests/sweaver.themesettings.test
Scenario D.

File

tests/sweaver.themesettings.test, line 363
Advanced tests for sweaver editor + theme settings.

Class

sweaverThemeSettings
@file Advanced tests for sweaver editor + theme settings.

Code

function assertLogoFavicon($scenario, $style_id, $gone, $draft = '', $live = '', $logo = '', $favicon_check = TRUE) {
  if ($gone) {
    $draft_logo_png = $this
      ->sweaver_public_path() . '/sweaver/logo_bartik_' . $style_id . '_draft.png';
    $live_logo_png = $this
      ->sweaver_public_path() . '/sweaver/logo_bartik_' . $style_id . '_live.png';
    $draft_logo_gif = $this
      ->sweaver_public_path() . '/sweaver/logo_bartik_' . $style_id . '_draft.gif';
    $live_logo_gif = $this
      ->sweaver_public_path() . '/sweaver/logo_bartik_' . $style_id . '_live.gif';
    $draft_favicon = $this
      ->sweaver_public_path() . '/sweaver/favicon_bartik_' . $style_id . '_draft.ico';
    $live_favicon = $this
      ->sweaver_public_path() . '/sweaver/favicon_bartik_' . $style_id . '_live.ico';
    $this
      ->assertFalse(file_exists($draft_logo_png), t('Draft png logo is gone for style id ' . $style_id . ' in scenario ' . $scenario . ' (' . $draft_logo_png . ') '));
    $this
      ->assertFalse(file_exists($live_logo_png), t('Live png logo is gone for style id ' . $style_id . ' in scenario ' . $scenario . ' (' . $live_logo_png . ') '));
    $this
      ->assertFalse(file_exists($draft_logo_gif), t('Draft gif logo is gone for style id ' . $style_id . ' in scenario ' . $scenario . ' (' . $draft_logo_gif . ') '));
    $this
      ->assertFalse(file_exists($live_logo_gif), t('Live gif logo is gone for style id ' . $style_id . ' in scenario ' . $scenario . ' (' . $live_logo_gif . ') '));
    $this
      ->assertFalse(file_exists($draft_favicon), t('Draft favicon is gone for style id ' . $style_id . ' in scenario ' . $scenario . ' (' . $draft_favicon . ') '));
    $this
      ->assertFalse(file_exists($live_favicon), t('Live favicon is gone for style id ' . $style_id . ' in scenario ' . $scenario . ' (' . $live_favicon . ') '));
  }
  else {
    $draft_logo = $this
      ->sweaver_public_path() . '/sweaver/logo_bartik_' . $style_id . '_draft.' . $logo;
    $live_logo = $this
      ->sweaver_public_path() . '/sweaver/logo_bartik_' . $style_id . '_live.' . $logo;
    $draft_favicon = $this
      ->sweaver_public_path() . '/sweaver/favicon_bartik_' . $style_id . '_draft.ico';
    $live_favicon = $this
      ->sweaver_public_path() . '/sweaver/favicon_bartik_' . $style_id . '_live.ico';

    // Draft.
    if ($draft) {
      $this
        ->assertTrue(file_exists($draft_logo), t('Draft logo exists for style id ' . $style_id . ' in scenario ' . $scenario));
      $this
        ->assertTrue(file_exists($draft_favicon), t('Draft Favicon exists for style id ' . $style_id . ' in scenario ' . $scenario));
    }
    else {
      $this
        ->assertFalse(file_exists($draft_logo), t('Draft logo does not exist for style id ' . $style_id . ' in scenario ' . $scenario));
      $this
        ->assertFalse(file_exists($draft_favicon), t('Draft Favicon does not exist for style id ' . $style_id . ' in scenario ' . $scenario));
    }

    // Live
    if ($live) {
      $this
        ->assertTrue(file_exists($live_logo), t('Live logo exists for style id ' . $style_id . ' in scenario ' . $scenario));
      $this
        ->assertTrue(file_exists($live_favicon), t('Live Favicon exists for style id ' . $style_id . ' in scenario ' . $scenario));
    }
    else {
      $this
        ->assertFalse(file_exists($live_logo), t('Live logo does not exist for style id ' . $style_id . ' in scenario ' . $scenario));
      if ($favicon_check) {
        $this
          ->assertFalse(file_exists($live_favicon), t('Live Favicon does not exist for style id ' . $style_id . ' in scenario ' . $scenario));
      }
    }
  }
}