You are here

class AsafBaseTestCase in Asaf (ajax submit for any form) 8

Same name and namespace in other branches
  1. 7 tests/asaf.test \AsafBaseTestCase

Hierarchy

Expanded class hierarchy of AsafBaseTestCase

File

tests/asaf.test, line 3

View source
class AsafBaseTestCase extends DrupalWebTestCase {
  function setUp() {
    parent::setUp(array(
      'devel',
      'asaf',
      'asaf_example',
    ));
  }
  protected function getButtons($formId = NULL) {
    $buttons = array();
    $xpath = '//input[@type="submit"]';
    if (isset($formId)) {
      $xpath = '//form[@id="' . $formId . '"]' . $xpath;
    }
    $elements = $this
      ->xpath($xpath);
    foreach ($elements as $element) {
      $id = (string) $element['id'];
      $buttons[$id] = $id;
    }
    return $buttons;
  }

  /*
   * Initialize form area wrapper using regexp instead of js.
   */
  protected function initAsafFormWrapper() {
    $this->content = preg_replace('/(<form(.*)data-asaf-area-wrapper-id=\\"(.*?)\\"([\\s\\w\\W]*)<\\/form>)/i', '<div id="\\3">\\1</div>', $this->content);
  }

}

Members