You are here

public function AuthcacheTestBackend::testBackendInitFailures in Authenticated User Page Caching (Authcache) 7.2

Test multiple calls to drupal_backend_init().

File

tests/authcache.backend.test, line 218
Test cases for pluggable cache backends.

Class

AuthcacheTestBackend
Cover authcache module.

Code

public function testBackendInitFailures() {

  // Test that non-existing functions / modules will not be invoked.
  $backends = array(
    array(
      'invalid_backend_module',
      'Cookie',
      FALSE,
    ),
  );
  $hook_boot = $this->stubbackend
    ->hook('boot', array(
    'backends' => $backends,
  ));
  $hook_save = $this->stubbackend
    ->hook('authcache_backend_cache_save');
  $this
    ->drupalGet('<front>');
  $this
    ->assertStub($hook_boot, HookStub::once());
  $this
    ->assertStub($hook_save, HookStub::never());

  // Test one successful, one failure.
  $backends = array(
    array(
      'authcache_backend_test',
      'Cookie',
      FALSE,
    ),
    array(
      'invalid_backend_module',
      'Cookie',
      FALSE,
    ),
  );
  $hook_boot = $this->stubbackend
    ->hook('boot', array(
    'backends' => $backends,
  ));
  $hook_save = $this->stubbackend
    ->hook('authcache_backend_cache_save');
  $this
    ->drupalGet('<front>');
  $this
    ->assertStub($hook_boot, HookStub::once());
  $this
    ->assertStub($hook_save, HookStub::once());
}