You are here

public static function HookStub::times in Authenticated User Page Caching (Authcache) 7.2

Returns a verifyier which succeeds when a hook was invoked exactly n times.

Parameters

int $times: Number of times this hook is expected to be invoked.

8 calls to HookStub::times()
AuthcacheFieldTest::testNodeMarkupSubstitution in modules/authcache_field/authcache_field.test
Test that the field markup is substituted by a partial.
AuthcacheFlagTest::testNodeMarkupSubstitution in modules/authcache_flag/authcache_flag.test
Test that the flag markup is substituted by a partial.
AuthcacheFlagTest::testTaxonomyTermMarkupSubstitution in modules/authcache_flag/authcache_flag.test
Test that the flag markup is substituted by a partial for taxonomy terms.
AuthcacheFlagTest::testUserMarkupSubstitution in modules/authcache_flag/authcache_flag.test
Test that the flag markup is substituted by a partial.
AuthcacheMenuTestItemTitle::testNodeViewLocalTask in modules/authcache_menu/tests/authcache_menu.test
Test local tasts on node-view.

... See full list

File

tests/HookStub.inc, line 268
Defines some helper classes for stubbing and recording hook invocations.

Class

HookStub
Static methods for keeping track of enabled hooks and invocations.

Code

public static function times($times) {

  // Necessary until #1272900 lands
  // @ignore style_function_spacing
  return function ($invocations, &$message) use ($times) {
    $message = format_plural($times, 'Expecting one invocation, got @actual.', 'Expecting @expected invocations, got @actual.', array(
      '@expected' => $times,
      '@actual' => count($invocations),
    ));
    return count($invocations) === $times;
  };
}