'Metatag core tag handling', 'description' => 'Test Metatag integration with the locale module.', 'group' => 'Metatag', 'dependencies' => array('ctools', 'token'), ); } /** * Test that the core meta tags work correctly. */ function testCoreTagRemoval() { // The default generator strings from core and Metatag. $generator_core = 'Drupal 7 (http://drupal.org)'; $generator_metatag = 'Drupal 7 (https://www.drupal.org)'; // Load the front page. $this->drupalGet(''); $this->assertResponse(200); // Confirm that the Generator tag is the default. $xpath = $this->xpath("//meta[@name='generator']"); $this->assertEqual(count($xpath), 1, 'Exactly one generator meta tag found.'); $this->assertEqual($xpath[0]['content'], $generator_metatag); // Update the global config to remove the 'generator' value. $config = metatag_config_load('global'); unset($config->config['generator']); metatag_config_save($config); // Dump out the current config, to aid with debugging. $this->verbose($config); // Load the front page. $this->drupalGet(''); $this->assertResponse(200); // Confirm that the Generator tag no longer exists. $xpath = $this->xpath("//meta[@name='generator']"); $this->assertEqual(count($xpath), 0, 'No generator meta tag found.'); // Tell Metatag to leave core's meta tags in place. variable_set('metatag_leave_core_tags', TRUE); // Clear the Metatag caches. metatag_flush_caches(); // Clear the page caches. drupal_flush_all_caches(); // Load the front page again. $this->drupalGet(''); $this->assertResponse(200); // Confirm that the Generator tag is using core's default again, i.e. core // is responsible for adding it. Also, core uses the meta tag name // "Generator" instead of 'generator' like Metatag uses. $xpath = $this->xpath("//meta[@name='Generator']"); $this->assertEqual(count($xpath), 1, 'Exactly one generator meta tag found.'); $this->assertEqual($xpath[0]['content'], $generator_core); } }