You are here

public function AuthcacheP13nTestRequestBuilder::testGetRequestCallback in Authenticated User Page Caching (Authcache) 7.2

Cover authcache_p13n_request_exists().

File

modules/authcache_p13n/tests/authcache_p13n.request-builder.test, line 54
Defines test classes for request builder.

Class

AuthcacheP13nTestRequestBuilder
Request builder test cases.

Code

public function testGetRequestCallback() {
  variable_set('authcache_p13n_router', 'AuthcacheP13nTestRequestRouterStub');
  $result = authcache_p13n_request_exists('non-existing-request');
  $this
    ->assertFalse($result);
  $result = authcache_p13n_request_exists('test/good');
  $this
    ->assertTrue($result);
  $result = authcache_p13n_request_get_callback('test/bad', array(
    'my-args' => array(
      'some' => 'args',
    ),
  ));
  $this
    ->assertFalse($result);
  $expect = array(
    'path' => 'http://example.com/authcache.php',
    'options' => array(
      'query' => array(
        'r' => 'test/good',
        'a' => array(
          'my-args' => array(
            'some' => 'args',
          ),
        ),
      ),
    ),
  );
  $result = authcache_p13n_request_get_callback('test/good', array(
    'my-args' => array(
      'some' => 'args',
    ),
  ));
  $this
    ->assertEqual($expect, $result);
  variable_del('authcache_p13n_router');
}