You are here

function XMLSitemapI18nWebTestCase::setUp in XML sitemap 6.2

Same name and namespace in other branches
  1. 7.2 xmlsitemap_i18n/xmlsitemap_i18n.test \XMLSitemapI18nWebTestCase::setUp()

Set up an administrative user account and testing keys.

Overrides XMLSitemapTestHelper::setUp

1 call to XMLSitemapI18nWebTestCase::setUp()
XMLSitemapI18nNodeTest::setUp in xmlsitemap_i18n/xmlsitemap_i18n.test
Set up an administrative user account and testing keys.
1 method overrides XMLSitemapI18nWebTestCase::setUp()
XMLSitemapI18nNodeTest::setUp in xmlsitemap_i18n/xmlsitemap_i18n.test
Set up an administrative user account and testing keys.

File

xmlsitemap_i18n/xmlsitemap_i18n.test, line 17
Unit tests for the xmlsitemap_i18n module.

Class

XMLSitemapI18nWebTestCase
Common base test class for XML sitemap internationalization tests.

Code

function setUp($modules = array()) {

  // Call parent::setUp() allowing test cases to pass further modules.
  $modules[] = 'locale';
  $modules[] = 'translation';
  $modules[] = 'i18n';
  $modules[] = 'xmlsitemap_i18n';
  parent::setUp($modules);

  // Add predefined language and reset the locale cache.
  require_once './includes/locale.inc';
  locale_add_language('fr', NULL, NULL, LANGUAGE_LTR, '', 'fr');
  language_list('language', TRUE);
  drupal_init_language();
  variable_set('xmlsitemap_languages', array(
    'en',
    'fr',
  ));
  variable_set('language_negotiation', LANGUAGE_NEGOTIATION_PATH);

  // Create the two different language-context sitemaps.
  db_query("DELETE FROM {xmlsitemap_sitemap}");
  $sitemap = new stdClass();
  $sitemap->context['language'] = 'en';
  xmlsitemap_sitemap_save($sitemap);
  $sitemap = new stdClass();
  $sitemap->context['language'] = 'fr';
  xmlsitemap_sitemap_save($sitemap);
}