You are here

function OGMTBasicTest::testMetaTagsEnabledForContentType in Open Graph meta tags 6

Same name and namespace in other branches
  1. 7.2 tests/Basic.test \OGMTBasicTest::testMetaTagsEnabledForContentType()
  2. 7 tests/Basic.test \OGMTBasicTest::testMetaTagsEnabledForContentType()

File

tests/Basic.test, line 45

Class

OGMTBasicTest
Tests for Open Graph meta tags.

Code

function testMetaTagsEnabledForContentType() {

  /*
   * Check the logic when enable tags to be enabled/disabled for a given content type.
   */

  // turn on all content types (no variable set)
  $this->ogm_settings->vars = array();
  $this
    ->assertTrue($this->ogm
    ->tags_are_enabled_for_content_type('type1'));

  // turn on all content types (variable set)
  $this->ogm_settings
    ->set(OPENGRAPH_META_VAR_CONTENT_TYPES_ENABLED, array());
  $this
    ->assertTrue($this->ogm
    ->tags_are_enabled_for_content_type('type1'));

  // turn on specific content type
  $this->ogm_settings
    ->set(OPENGRAPH_META_VAR_CONTENT_TYPES_ENABLED, array(
    'type1' => 1,
    'type2' => 0,
  ));
  $this
    ->assertTrue($this->ogm
    ->tags_are_enabled_for_content_type('type1'));
  $this
    ->assertFalse($this->ogm
    ->tags_are_enabled_for_content_type('type2'));
}