Completed
Push — master ( 1da492...320203 )
by Henry
07:00
created

tests/unit/Validator/CaptchaTest.php (3 issues)

Labels
Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

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();
0 ignored issues
show
The method getOptionArray() does not seem to exist on object<Redaxscript\Tests\Validator\CaptchaTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
32
		$installer = $this->installerFactory();
0 ignored issues
show
The method installerFactory() does not seem to exist on object<Redaxscript\Tests\Validator\CaptchaTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
33
		$installer->init();
34
		$installer->rawCreate();
35
		$installer->insertSettings($optionArray);
36
	}
37
38
	/**
39
	 * tearDown
40
	 *
41
	 * @since 3.1.0
42
	 */
43
44
	public function tearDown() : void
45
	{
46
		$this->dropDatabase();
0 ignored issues
show
The method dropDatabase() does not seem to exist on object<Redaxscript\Tests\Validator\CaptchaTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
47
	}
48
49
	/**
50
	 * testValidate
51
	 *
52
	 * @since 2.6.0
53
	 *
54
	 * @param int $task
55
	 * @param string $hash
56
	 * @param bool $expect
57
	 *
58
	 * @dataProvider providerAutoloader
59
	 */
60
61
	public function testValidate(int $task = null, string $hash = null, bool $expect = null) : void
62
	{
63
		/* setup */
64
65
		$validator = new Validator\Captcha();
66
67
		/* actual */
68
69
		$actual = $validator->validate($task, $hash);
70
71
		/* compare */
72
73
		$this->assertEquals($expect, $actual);
74
	}
75
}
76