You are here

public function XMLSitemapI18nWebTestCase::setUp in XML sitemap 7.2

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

Set up an administrative user account and testing keys.

@codingStandardsIgnoreEnd

Overrides XMLSitemapTestHelper::setUp

1 call to XMLSitemapI18nWebTestCase::setUp()
XMLSitemapI18nNodeTest::setUp in xmlsitemap_i18n/xmlsitemap_i18n.test
Setup.
1 method overrides XMLSitemapI18nWebTestCase::setUp()
XMLSitemapI18nNodeTest::setUp in xmlsitemap_i18n/xmlsitemap_i18n.test
Setup.

File

xmlsitemap_i18n/xmlsitemap_i18n.test, line 27
Unit tests for the xmlsitemap_i18n project.

Class

XMLSitemapI18nWebTestCase
Common base test class for XML sitemap internationalization tests.

Code

public 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 DRUPAL_ROOT . '/includes/locale.inc';
  locale_add_language('fr', NULL, NULL, LANGUAGE_LTR, '', 'fr');
  drupal_language_initialize();
  variable_set('language_negotiation', LOCALE_LANGUAGE_NEGOTIATION_URL_PREFIX);

  // Create the two different language-context sitemaps.
  db_delete('xmlsitemap_sitemap')
    ->execute();
  $sitemap = new stdClass();
  $sitemap->context = array(
    'language' => 'en',
  );
  xmlsitemap_sitemap_save($sitemap);
  $sitemap = new stdClass();
  $sitemap->context = array(
    'language' => 'fr',
  );
  xmlsitemap_sitemap_save($sitemap);
}