public static function AuthcacheP13nTestStubVerifyer::times in Authenticated User Page Caching (Authcache) 7.2
Invocation verifier testing the number of times a method was invoked.
2 calls to AuthcacheP13nTestStubVerifyer::times()
- AuthcacheP13nTestStubVerifyer::never in modules/
authcache_p13n/ tests/ authcache_p13n.stub.inc - Invocation verifier ensuring that a method was never invoked.
- AuthcacheP13nTestStubVerifyer::once in modules/
authcache_p13n/ tests/ authcache_p13n.stub.inc - Invocation verifier testing whether a method was invoked exacly once.
File
- modules/
authcache_p13n/ tests/ authcache_p13n.stub.inc, line 160 - Stub classes for testing.
Class
- AuthcacheP13nTestStubVerifyer
- Simple invocation verifier class.
Code
public static function times($expected) {
// Necessary until #1272900 lands
// @ignore style_function_spacing
return function ($invocations, $name, &$message) use ($expected) {
$actual = count($invocations);
$message = format_plural($expected, '@name: Expecting one invocation, got @actual.', '@name: Expecting @expected invocations, got @actual.', array(
'@name' => $name,
'@expected' => $expected,
'@actual' => $actual,
));
return $expected === $actual;
};
}