You are here

function OGMTBasicTest::testNodeOverridesEmptyValues in Open Graph meta tags 6

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

File

tests/Basic.test, line 131

Class

OGMTBasicTest
Tests for Open Graph meta tags.

Code

function testNodeOverridesEmptyValues() {

  /*
   * If no specific tag values set for node and there is not default fallback value set for the node's content type
   * then expect tags to be dynamically calculated.
   */
  $node = $this
    ->_build_test_node(1);
  $this->ogm_settings
    ->set(OPENGRAPH_META_VAR_CONTENT_TYPE_ . 'type1', '');
  $this->ogm
    ->save_node_data(1, array(
    OpenGraphMeta::TITLE => '',
    OpenGraphMeta::DESCRIPTION => '',
    OpenGraphMeta::IMAGE => '',
    OpenGraphMeta::TYPE => '',
  ));
  drupal_set_title($node->title);
  $this->ogm
    ->render_data($node, $this->ogm
    ->load_node_data($node));
  $this
    ->_check_rendered_meta_tags(array(
    'og:' . OpenGraphMeta::TITLE => $node->title,
    'og:' . OpenGraphMeta::DESCRIPTION => drupal_substr(strip_tags(OpenGraphMetaDrupalLayer::get_node_body($node)), 0, 200),
    'og:' . OpenGraphMeta::SITE_NAME => 'Drupal',
    'og:' . OpenGraphMeta::URL => url('node/1', array(
      'absolute' => TRUE,
    )),
  ), __FUNCTION__);
}