You are here

function OGMTBasicTest::testOverridesWithNodeSpecificValues in Open Graph meta tags 7

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

File

tests/Basic.test, line 182

Class

OGMTBasicTest
Tests for Open Graph meta tags.

Code

function testOverridesWithNodeSpecificValues() {

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