You are here

function OGMTBasicTest::testOverridesWithDefaultFallbackValues in Open Graph meta tags 7

Same name and namespace in other branches
  1. 6 tests/Basic.test \OGMTBasicTest::testOverridesWithDefaultFallbackValues()

File

tests/Basic.test, line 155

Class

OGMTBasicTest
Tests for Open Graph meta tags.

Code

function testOverridesWithDefaultFallbackValues() {

  /*
   * If no specific 'type' tag value is set for node and and there is a fallback value set on the content type
   * then expect that value to be used for the final tag.
   */
  $node = $this
    ->_build_test_node(1);
  $this->ogm_settings
    ->set(OPENGRAPH_META_VAR_CONTENT_TYPE_ . 'type1', 'product');
  $this->ogm_settings
    ->set(OPENGRAPH_META_VAR_SITE_NAME, 'TestSite');
  $this->ogm
    ->save_node_data(1, array(
    OpenGraphMeta::TITLE => 'abc',
    OpenGraphMeta::DESCRIPTION => 'def',
    OpenGraphMeta::IMAGE => 'test.jpg',
    OpenGraphMeta::TYPE => '',
  ));
  $this->ogm
    ->render_data($node, $this->ogm
    ->load_node_data($node));
  $this
    ->_check_rendered_meta_tags(array(
    'og:' . OpenGraphMeta::TITLE => 'abc',
    'og:' . OpenGraphMeta::DESCRIPTION => 'def',
    'og:' . OpenGraphMeta::IMAGE => url('test.jpg', array(
      'absolute' => TRUE,
    )),
    'og:' . OpenGraphMeta::TYPE => 'product',
    'og:' . OpenGraphMeta::SITE_NAME => 'TestSite',
    'og:' . OpenGraphMeta::URL => url('node/1', array(
      'absolute' => TRUE,
    )),
  ), __FUNCTION__);
}