You are here

protected function ServicesClientBaseWebTestCase::addEventMapping in Services Client 7.2

Add new mapping row to event.

Parameters

ServicesClientEvent $event: Event where should be mapping added.

string $reader: Reader plugin name.

array $reader_config: Reader configuration.

string $formatter: Formatter plugin name.

array $formatter_config: Formatter configuration.

4 calls to ServicesClientBaseWebTestCase::addEventMapping()
ServicesClientErrorWebTestCase::testServicesClientErrors in services_client_error/tests/services_client_error.test
ServicesClientHooksWebTestCase::testServicesClientHooks in tests/services_client.test
ServicesClientWebTestCase::testAddingEvent in tests/services_client.test
Test basic event configuration actions.
ServicesClientWebTestCase::testServicesClientProcessing in tests/services_client.test

File

tests/services_client.test, line 230
Tests for the Administration menu module.

Class

ServicesClientBaseWebTestCase
@file Tests for the Administration menu module.

Code

protected function addEventMapping($event, $reader, $reader_config, $formatter, $formatter_config) {
  $this
    ->drupalGet($event
    ->getHandler()
    ->getUrl('add_plugin/mapping'));
  $uuid = $this
    ->getPluginUuidFromUrl();

  // Add initial plugin configuration.
  $this
    ->drupalPost($event
    ->getHandler()
    ->getUrl('plugin/mapping/' . $uuid . '/edit'), array(
    'reader' => $reader,
    'formatter' => $formatter,
  ), "Submit");

  // Submit plugin configuration.
  $config = array();
  foreach ($reader_config as $name => $value) {
    $config['reader_config[' . $name . ']'] = $value;
  }
  foreach ($formatter_config as $name => $value) {
    $config['formatter_config[' . $name . ']'] = $value;
  }
  $this
    ->drupalPost($event
    ->getHandler()
    ->getUrl('plugin/mapping/' . $uuid . '/edit'), $config, "Submit");
  return $uuid;
}