You are here

function SiteVerifyFunctionalTestCase::testMetaTag in Site verification 7

Same name and namespace in other branches
  1. 6 site_verify.test \SiteVerifyFunctionalTestCase::testMetaTag()
  2. 7.2 site_verify.test \SiteVerifyFunctionalTestCase::testMetaTag()

File

./site_verify.test, line 24
Tests for the site_verify module.

Class

SiteVerifyFunctionalTestCase
@file Tests for the site_verify module.

Code

function testMetaTag() {
  $this
    ->drupalGet('admin/config/search/verifications');
  $this
    ->assertText('No verifications available.');
  $this
    ->clickLink('Add verification');

  // Add a dummy Google meta tag.
  $edit = array(
    'engine' => 'google',
  );
  $this
    ->drupalPost('admin/config/search/verifications/add', $edit, t('Next'));
  $meta_tag = '<meta name="google-site-verification" content="' . $this
    ->randomName() . '">';
  $edit = array(
    'meta' => $meta_tag,
  );
  $this
    ->drupalPost(NULL, $edit, t('Save'));
  $this
    ->assertText('Verification saved.');
  $this
    ->assertText('Google');

  // Check if it displays on the front page.
  $this
    ->drupalGet('');
  $this
    ->assertRaw($meta_tag, 'Verification code displayed on front page.');

  // Now try to delete it.
  $this
    ->drupalGet('admin/config/search/verifications');
  $this
    ->clickLink('Delete');
  $this
    ->drupalPost(NULL, array(), t('Delete'));
  $this
    ->assertText('Verification for Google has been deleted.');
  $this
    ->assertText('No verifications available.');
}