13 'wgCaptchaTriggers' => [
14 $action => $expectedResult,
17 $this->assertEquals( $expectedResult, $captcha->triggersCaptcha( $action ) );
23 $constants = $captchaTriggers->getConstants();
24 foreach ( $constants
as $const ) {
25 $data[] = [ $const,
true ];
26 $data[] = [ $const,
false ];
37 'wgCaptchaTriggers' => [
38 $trigger => !$expected,
40 'wgCaptchaTriggersOnNamespace' => [
42 $trigger => $expected,
47 $this->assertEquals( $expected, $captcha->triggersCaptcha( $trigger,
$title ) );
64 'CaptchaTriggers' => [
68 'autoloaderPaths' => []
71 $class =
new ReflectionClass(
'ExtensionRegistry' );
72 $instanceProperty = $class->getProperty(
'instance' );
73 $instanceProperty->setAccessible(
true );
74 $instanceProperty->setValue( $registry );
75 $method = $class->getMethod(
'exportExtractedData' );
76 $method->setAccessible(
true );
77 $method->invokeArgs( $registry, [ $info ] );
86 $this->assertEquals(
$value, $captcha->triggersCaptcha( $trigger ) );
101 'wgCaptchaTriggers' => [
102 $trigger => $expected
107 $this->assertEquals( $expected, $captcha->triggersCaptcha( $trigger ) );
123 $user->method(
'isAllowed' )->willReturn( $userIsAllowed );
127 $this->assertEquals( $expected, $actual );
145 $userIsMailConfirmed, $expected ) {
148 $user->method(
'isEmailConfirmed' )->willReturn( $userIsMailConfirmed );
150 $config->method(
'get' )->willReturn( $allowUserConfirmEmail );
152 $actual = $testObject->canSkipCaptcha(
$user, $config );
154 $this->assertEquals( $expected, $actual );
159 [
false,
false,
false ],
160 [
false,
true,
false ],
161 [
true,
false,
false ],
162 [
true,
true,
true ],
177 $request->method(
'getIP' )->willReturn( $requestIP );
181 'wgCaptchaWhitelistIP' => $IPWhitelist
186 $this->assertEquals( $expected, $actual );
191 [
'127.0.0.1', [
'127.0.0.1',
'127.0.0.2' ],
true ],
192 [
'127.0.0.1', [],
false ]