You are here

function i18nAccessTestCase::assertNoLanguageOption in Translation Access 7

Same name and namespace in other branches
  1. 6 i18n_access.test \i18nAccessTestCase::assertNoLanguageOption()

Assert that a language option does not exist in the language select field on the current page.

Parameters

$langcode: Value of the language option to assert.

$message: Message to display.

$group: The group this message belongs to.

Return value

TRUE on pass, FALSE on fail.

1 call to i18nAccessTestCase::assertNoLanguageOption()
i18nAccessTestCase::testTranslatorUser in ./i18n_access.test
Test translator user. User with 'create story content' and 'edit own story content' permissions should be able to create and edit story nodes only in the languages that they have permissions for.

File

./i18n_access.test, line 141
Test suite for i18n_access.module

Class

i18nAccessTestCase
@file Test suite for i18n_access.module

Code

function assertNoLanguageOption($langcode, $message, $group = 'Other') {
  $xpath = '//select[@name="language"]/option';
  $fields = $this
    ->xpath($xpath);

  // If value specified then check array for match.
  $found = TRUE;
  if (isset($langcode)) {
    $found = FALSE;
    if ($fields) {
      foreach ($fields as $field) {
        if ($field['value'] == $langcode) {
          $found = TRUE;
        }
      }
    }
  }
  return $this
    ->assertFalse($fields && $found, $message, $group);
}