Completed
Push — master ( 9458ed...7d322b )
by Henry
10:04
created

PasswordTest::testGetPattern()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 9.7998
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
namespace Redaxscript\Tests\Validator;
3
4
use Redaxscript\Tests\TestCaseAbstract;
5
use Redaxscript\Validator;
6
7
/**
8
 * PasswordTest
9
 *
10
 * @since 2.6.0
11
 *
12
 * @package Redaxscript
13
 * @category Tests
14
 * @author Henry Ruhs
15
 *
16
 * @covers Redaxscript\Validator\Password
17
 */
18
19
class PasswordTest extends TestCaseAbstract
20
{
21
	/**
22
	 * testGetPattern
23
	 *
24
	 * @since 4.3.0
25
	 */
26
27
	public function testGetPattern() : void
28
	{
29
		/* setup */
30
31
		$validator = new Validator\Password();
32
33
		/* actual */
34
35
		$actual = $validator->getPattern();
36
37
		/* compare */
38
39
		$this->assertIsString($actual);
40
	}
41
42
	/**
43
	 * testValidate
44
	 *
45
	 * @since 4.3.0
46
	 *
47
	 * @param string $password
48
	 * @param bool $expect
49
	 *
50
	 * @dataProvider providerAutoloader
51
	 */
52
53
	public function testValidate(string $password = null, bool $expect = null) : void
54
	{
55
		/* setup */
56
57
		$validator = new Validator\Password();
58
59
		/* actual */
60
61
		$actual = $validator->validate($password);
62
63
		/* compare */
64
65
		$this->assertEquals($expect, $actual);
66
	}
67
68
	/**
69
	 * testMatchHash
70
	 *
71
	 * @since 4.3.0
72
	 *
73
	 * @param string $password
74
	 * @param string $hash
75
	 * @param bool $expect
76
	 *
77
	 * @dataProvider providerAutoloader
78
	 */
79
80
	public function testMatchHash(string $password = null, string $hash = null, bool $expect = null) : void
81
	{
82
		/* setup */
83
84
		$validator = new Validator\Password();
85
86
		/* actual */
87
88
		$actual = $validator->matchHash($password, $hash);
89
90
		/* compare */
91
92
		$this->assertEquals($expect, $actual);
93
	}
94
}
95