You are here

protected function ServicesClientBaseWebTestCase::removeEventPlugin in Services Client 7.2

Remove existing event plugin.

Parameters

ServicesClientEvent $event: Event from which should be condition removed.

string $type: Plugin type - condition, mapping

string $uuid: Condition UUID.

2 calls to ServicesClientBaseWebTestCase::removeEventPlugin()
ServicesClientBaseWebTestCase::removeEventCondition in tests/services_client.test
Remove existing event condition.
ServicesClientBaseWebTestCase::removeEventMapping in tests/services_client.test
Remove existing event mapping row.

File

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

Class

ServicesClientBaseWebTestCase
@file Tests for the Administration menu module.

Code

protected function removeEventPlugin($event, $type, $uuid) {
  $this
    ->drupalGet($event
    ->getHandler()
    ->getUrl('configure'));
  $xpath_selector = '//table//a[contains(text(), "Remove")][contains(@href, "' . $uuid . '")]';
  $result = $this
    ->xpath($xpath_selector);
  $result = reset($result);
  if (!empty($result)) {
    $parsed = parse_url((string) $result['href']);
    $query = array();
    parse_str($parsed['query'], $query);
    if (isset($query['token'])) {

      // Run remove plugin action.
      $this
        ->drupalGet($event
        ->getHandler()
        ->getUrl('plugin/' . $type . '/' . $uuid . '/remove'), array(
        'query' => array(
          'token' => $query['token'],
        ),
      ));
      $this
        ->assertText('Plugin was removed', "Plugin remove action was successful.");

      // Confirm that plugin was removed.
      $result = $this
        ->xpath($xpath_selector);
      if (empty($result)) {
        return TRUE;
      }
    }
  }
  return FALSE;
}