class SimpleReCaptchaFormManagerTest in Simple Google reCAPTCHA 8
Class SimpleReCaptchaFormManagerTest.
@group simple_recaptcha
@coversDefaultClass \Drupal\simple_recaptcha\SimpleReCaptchaFormManager
Hierarchy
- class \Drupal\Tests\UnitTestCase extends \PHPUnit\Framework\TestCase uses PhpunitCompatibilityTrait
- class \Drupal\Tests\simple_recaptcha\Unit\SimpleReCaptchaFormManagerTest
Expanded class hierarchy of SimpleReCaptchaFormManagerTest
File
- tests/
src/ Unit/ SimpleReCaptchaFormManagerTest.php, line 15
Namespace
Drupal\Tests\simple_recaptcha\UnitView source
class SimpleReCaptchaFormManagerTest extends UnitTestCase {
/**
* Test the formIdInList().
*
* @covers ::formIdInList
*
* @dataProvider dataFormIdProvider
*/
public function testFormIdInList($formId, $list, bool $expected) {
$result = SimpleReCaptchaFormManager::formIdInList($formId, $list);
$this
->assertSame($result, $expected);
}
/**
* Data to test form id is detected or not.
*/
public function dataFormIdProvider() {
return [
[
'user_login_form',
[
'user_login_form',
'user_pass',
'user_register_form',
],
TRUE,
],
[
'user_pass',
[
'user_login_form',
'user_pass',
'user_register_form',
],
TRUE,
],
[
'user_register_form',
[
'user_login_form',
'user_pass',
'user_register_form',
],
TRUE,
],
[
'user_login_form',
[
'user_login*',
'user_register*',
],
TRUE,
],
[
'user_pass',
[
'user_login*',
'user_register*',
],
FALSE,
],
[
'user_register_form',
[
'user_login*',
'user_register*',
],
TRUE,
],
[
'user_login_form',
[
'user_*',
],
TRUE,
],
[
'user_pass',
[
'user_*',
'user_*',
],
TRUE,
],
[
'user_register_form',
[
'user_*',
'user_*',
],
TRUE,
],
[
'user_login_form',
[
'user_*_form',
],
TRUE,
],
[
'user_pass',
[
'user_*_form',
],
FALSE,
],
[
'user_register_form',
[
'user_*_form',
],
TRUE,
],
[
'user_login_form',
[
'*user*',
],
TRUE,
],
[
'user_pass',
[
'*user*',
],
TRUE,
],
[
'user_register_form',
[
'*user*',
],
TRUE,
],
[
'user_login_form',
[
'*_user*',
],
FALSE,
],
[
'user_pass',
[
'*_user*',
],
FALSE,
],
[
'user_register_form',
[
'*_user*',
],
FALSE,
],
[
'user_login_form',
[
'user_other*',
'user_else*',
],
FALSE,
],
[
'user_pass',
[
'user_other*',
'user_else*',
],
FALSE,
],
[
'user_register_form',
[
'user_other*',
'user_else*',
],
FALSE,
],
];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PhpunitCompatibilityTrait:: |
public | function | Returns a mock object for the specified class using the available method. | |
PhpunitCompatibilityTrait:: |
public | function | Compatibility layer for PHPUnit 6 to support PHPUnit 4 code. | |
SimpleReCaptchaFormManagerTest:: |
public | function | Data to test form id is detected or not. | |
SimpleReCaptchaFormManagerTest:: |
public | function | Test the formIdInList(). | |
UnitTestCase:: |
protected | property | The random generator. | |
UnitTestCase:: |
protected | property | The app root. | 1 |
UnitTestCase:: |
protected | function | Asserts if two arrays are equal by sorting them first. | |
UnitTestCase:: |
protected | function | Mocks a block with a block plugin. | 1 |
UnitTestCase:: |
protected | function | Returns a stub class resolver. | |
UnitTestCase:: |
public | function | Returns a stub config factory that behaves according to the passed array. | |
UnitTestCase:: |
public | function | Returns a stub config storage that returns the supplied configuration. | |
UnitTestCase:: |
protected | function | Sets up a container with a cache tags invalidator. | |
UnitTestCase:: |
protected | function | Gets the random generator for the utility methods. | |
UnitTestCase:: |
public | function | Returns a stub translation manager that just returns the passed string. | |
UnitTestCase:: |
public | function | Generates a unique random string containing letters and numbers. | |
UnitTestCase:: |
protected | function | 340 |