CaptchaTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 57
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 10 1
A tearDown() 0 4 1
A testValidate() 0 14 1
1
<?php
2
namespace Redaxscript\Tests\Validator;
3
4
use Redaxscript\Tests\TestCaseAbstract;
5
use Redaxscript\Validator;
6
7
/**
8
 * CaptchaTest
9
 *
10
 * @since 2.2.0
11
 *
12
 * @package Redaxscript
13
 * @category Tests
14
 * @author Henry Ruhs
15
 * @author Sven Weingartner
16
 *
17
 * @covers Redaxscript\Validator\Captcha
18
 */
19
20
class CaptchaTest extends TestCaseAbstract
21
{
22
	/**
23
	 * setUp
24
	 *
25
	 * @since 3.1.0
26
	 */
27
28
	public function setUp() : void
29
	{
30
		parent::setUp();
31
		$optionArray = $this->getOptionArray();
32
		$installer = $this->installerFactory();
33
		$installer->init();
34
		$installer->rawCreate();
35
		$installer->insertSettings($optionArray);
36
37
	}
38
39
	/**
40
	 * tearDown
41
	 *
42
	 * @since 3.1.0
43
	 */
44
45
	public function tearDown() : void
46
	{
47
		$this->dropDatabase();
48
	}
49
50
	/**
51
	 * testValidate
52
	 *
53
	 * @since 2.6.0
54
	 *
55
	 * @param int $task
56
	 * @param string $hash
57
	 * @param bool $expect
58
	 *
59
	 * @dataProvider providerAutoloader
60
	 */
61
62
	public function testValidate(int $task = null, string $hash = null, bool $expect = null) : void
63
	{
64
		/* setup */
65
66
		$validator = new Validator\Captcha();
67
68
		/* actual */
69
70
		$actual = $validator->validate($task, $hash);
71
72
		/* compare */
73
74
		$this->assertEquals($expect, $actual);
75
	}
76
}
77