You are here

public function AuthcacheFormTestHelpers::testFormMatchFormID in Authenticated User Page Caching (Authcache) 7.2

Cover _authcache_form_match_form_id().

File

modules/authcache_form/tests/authcache_form.test, line 34
Test classes for Authcache Form module.

Class

AuthcacheFormTestHelpers
Test helper functions

Code

public function testFormMatchFormID() {
  $patterns = implode("\n", array(
    'some-form',
    '*-with-prefix',
  )) . "\n";
  $patterns .= implode("\r\n", array(
    'X*Y*Z',
    'with-suffix-*',
  )) . "\r\n";
  $tests = array(
    'no-match' => FALSE,
    'some-form' => TRUE,
    '-with-prefix' => TRUE,
    'form-id-with-prefix' => TRUE,
    'XYZ' => TRUE,
    'XweirdYform-idZ' => TRUE,
    'with-suffix-' => TRUE,
    'with-suffix-bla' => TRUE,
  );
  foreach ($tests as $form_id => $expect) {
    $result = _authcache_form_match_form_id($form_id, $patterns);
    $this
      ->assertEqual($expect, $result);
  }
}