You are here

public function FeedsExUi::test in Feeds extensible parsers 7

Same name and namespace in other branches
  1. 7.2 src/Tests/FeedsExUi.test \FeedsExUi::test()

Tests basic UI functionality.

File

src/Tests/FeedsExUi.test, line 37
Contains FeedsExUi.

Class

FeedsExUi
User interface tests.

Code

public function test() {
  $path = 'admin/structure/feeds/syndication/settings/FeedsExTestUi';

  // Set context.
  $edit = array(
    'context[value]' => 'context value',
  );
  $this
    ->drupalPost($path, $edit, t('Save'));
  $this
    ->assertFieldByName(key($edit), reset($edit), 'Context value set.');

  // Add a value.
  $edit = array(
    'add[name]' => 'new name',
    'add[machine_name]' => 'new_value',
    'add[value]' => 'new value',
    'add[debug]' => 1,
  );
  $this
    ->drupalPost(NULL, $edit, t('Save'));
  $this
    ->assertFieldByName('sources[new_value][name]', 'new name', 'New expression name');
  $this
    ->assertFieldByName('sources[new_value][value]', 'new value', 'New expression value');
  $this
    ->assertFieldByName('sources[new_value][debug]', 1, 'Debug value set');

  // Remove the row.
  $edit = array(
    'sources[new_value][remove]' => 1,
  );
  $this
    ->drupalPost(NULL, $edit, t('Save'));
  $this
    ->assertNoFieldByName('sources[new_value][name]');
}