You are here

public function AuthcacheP13nTestFragmentAssemblyBuilder::testFragmentAssemblyBuilderLoader in Authenticated User Page Caching (Authcache) 7.2

Test request with loader.

File

modules/authcache_p13n/tests/authcache_p13n.request-handler.test, line 639
Define unit tests for request handler.

Class

AuthcacheP13nTestFragmentAssemblyBuilder
Tests update functionality unrelated to the database.

Code

public function testFragmentAssemblyBuilderLoader() {
  $partials = array(
    'param_1' => array(
      'renderer' => new AuthcacheP13nTestEchoPartial(),
      'loader' => new AuthcacheP13nTestEchoFragmentLoader(),
    ),
  );
  $builder = new AuthcacheP13nFragmentAssemblyBuilder($partials);
  $input = array(
    'a' => array(
      'param_1' => array(
        'load' => 'load',
      ),
    ),
  );
  $expect = array(
    'param_1' => array(
      'load' => array(
        'key' => 'load',
        'subject' => 'loaded',
      ),
    ),
  );
  $output = $builder
    ->build($input, array());
  $this
    ->assertEqual($expect, $output);
  $input = array(
    'a' => array(
      'param_1' => array(
        'load missing' => 'load missing',
      ),
    ),
  );
  $result = $builder
    ->build($input, array());
  $this
    ->assertFalse($result);
}