You are here

public function FusionApplyApiTestCase::testFusionApplySkinInfo in Fusion Accelerator 7.2

Same name and namespace in other branches
  1. 7 fusion_apply/tests/fusion_apply.test \FusionApplyApiTestCase::testFusionApplySkinInfo()

Tests hook_fusion_apply_skin_info().

File

fusion_apply/tests/fusion_apply.test, line 205
Tests for the Fusion Apply module.

Class

FusionApplyApiTestCase
Tests API functionality.

Code

public function testFusionApplySkinInfo() {

  // Verify that fusion_apply_get_skin_info() finds and returns all registered skins
  // in $module.fusion.inc files as well as Fusion Apply plugin files, but does not
  // return skins that are incompatible with the current Fusion Apply API version.
  $skin_info = fusion_apply_get_skin_info();
  $this
    ->verbose('Skins: ' . var_export($skin_info, TRUE));
  $module = 'fusion_apply_test';
  $path = drupal_get_path('module', $module);

  // fusion_apply_test_font is registered via hook_fusion_apply_skin_info() in
  // fusion_apply_test.fusion.inc.
  // @todo Figure out why this is failing.  Manual tests for skin plugins via $module.fusion.inc are fine.
  $this
    ->assertTrue(isset($skin_info['fusion_apply_test_font']), "Skin registered in {$module}.fusion.inc found.");
  $this
    ->assertEqual($skin_info['fusion_apply_test_font']['source']['path'], $path, t('Skin path points to module directory: @path', array(
    '@path' => $skin_info['fusion_apply_test_font']['source']['path'],
  )));
  unset($skin_info['fusion_apply_test_font']);

  // fusion_apply_test_example is registered via hook_fusion_apply_skin_PLUGIN_info() in
  // skins/example.inc.
  $this
    ->assertTrue(isset($skin_info['fusion_apply_test_example']), 'Skin registered in plugin file found.');
  $this
    ->assertEqual($skin_info['fusion_apply_test_example']['source']['path'], $path . '/skins/example', t('Skin path points to plugin directory: @path', array(
    '@path' => $skin_info['fusion_apply_test_example']['source']['path'],
  )));
  unset($skin_info['fusion_apply_test_example']);

  // fusion_apply_test_basetheme is registered via hook_fusion_apply_skin_info() in
  // fusion_apply_test_basetheme.fusion.inc.
  $this
    ->assertTrue(isset($skin_info['fusion_apply_test_basetheme']), 'Skin registered in $basetheme.fusion.inc found.');
  $this
    ->assertEqual($skin_info['fusion_apply_test_basetheme']['source']['path'], $path . '/themes/fusion_apply_test_basetheme', t('Skin path points to basetheme directory: @path', array(
    '@path' => $skin_info['fusion_apply_test_basetheme']['source']['path'],
  )));
  $default_theme = variable_get('theme_default', 'bartik');
  $this
    ->assertEqual($skin_info['fusion_apply_test_basetheme']['status'][$default_theme], 0, 'Basetheme skin is disabled for default theme.');
  $this
    ->assertEqual($skin_info['fusion_apply_test_basetheme']['status']['fusion_apply_test_basetheme'], 1, 'Basetheme skin is enabled for Fusion Apply test basetheme.');
  unset($skin_info['fusion_apply_test_basetheme']);

  // fusion_apply_test_subtheme is registered via hook_fusion_apply_skin_info() in
  // fusion_apply_test_subtheme.fusion.inc.
  $this
    ->assertTrue(isset($skin_info['fusion_apply_test_subtheme']), 'Skin registered in $subtheme.fusion.inc found.');
  $this
    ->assertEqual($skin_info['fusion_apply_test_subtheme']['source']['path'], $path . '/themes/fusion_apply_test_subtheme', t('Skin path points to subtheme directory: @path', array(
    '@path' => $skin_info['fusion_apply_test_subtheme']['source']['path'],
  )));
  unset($skin_info['fusion_apply_test_subtheme']);

  // Ensure that fusion_apply_test_incompatible is not contained.
  $this
    ->assertTrue(!isset($skin_info['fusion_apply_test_incompatible']), 'Incompatible skin not found.');

  // After asserting all expected, the list of skins should be empty.
  $this
    ->assertTrue(empty($skin_info), t('No unexpected skins found: <pre>@data</pre>', array(
    '@data' => var_export($skin_info, TRUE),
  )));
}