You are here

function ViewsBaseUrlMultilingualTestCase::testLanguageBasedUrl in Views base url 7

Test whether the links are created based on site's default language.

File

tests/views_base_url.test, line 163
Views base url test functions.

Class

ViewsBaseUrlMultilingualTestCase

Code

function testLanguageBasedUrl() {
  $languages = language_list();
  $this
    ->drupalGet('views-base-url-test');
  $this
    ->assertResponse(200, t('Page is accessible when language not provided'));
  $this
    ->assertLinkByHref($languages['de']->prefix . '/views-base-url-test', 0, t('Link available to switch to another language of the page'));
  $this
    ->drupalGet('views-base-url-test', array(
    'language' => $languages['en'],
  ));
  $this
    ->assertResponse(200, t('Page is accessible in site\'s default language'));
  $this
    ->assertLinkByHref($languages['de']->prefix . '/views-base-url-test', 0, t('Link available to switch to another language of the page'));
  $this
    ->drupalGet('views-base-url-test', array(
    'language' => $languages['de'],
  ));
  $this
    ->assertResponse(200, t('Page is accessible in another language'));
  $this
    ->assertLinkByHref($languages['en']->prefix . '/views-base-url-test', 0, t('Link available to switch to another language of the page'));
}