You are here

public function FeedsUIUserInterfaceTestCase::testInvalidLanguage in Feeds 7.2

Tests if the user is warned when an invalid language is selected.

File

feeds_ui/feeds_ui.test, line 187
Tests for Feeds Admin UI module.

Class

FeedsUIUserInterfaceTestCase
Test basic Feeds UI functionality.

Code

public function testInvalidLanguage() {

  // Add the Dutch language.
  $edit = array(
    'langcode' => 'nl',
  );
  $this
    ->drupalPost('admin/config/regional/language/add', $edit, t('Add language'));

  // Create an importer.
  $this
    ->createImporterConfiguration('Test feed', 'test_feed');

  // Change processor's language to Dutch.
  $this
    ->setSettings('test_feed', 'FeedsNodeProcessor', array(
    'language' => 'nl',
  ));

  // Assert that there is no error message yet.
  $this
    ->assertNoText('There are some issues with the importer configuration');

  // Now remove the Dutch language.
  $path = 'admin/config/regional/language/delete/nl';
  $this
    ->drupalPost($path, array(), t('Delete'));

  // Assert error message on processor settings page.
  $this
    ->drupalGet('admin/structure/feeds/test_feed/settings/FeedsNodeProcessor');
  $this
    ->assertText(format_string('Invalid value @invalid_lang for config option Language.', array(
    '@invalid_lang' => 'nl',
  )));

  // But the option should still be selected.
  $this
    ->assertFieldByName('language', 'nl');
}