Passed
Push — refactor_render ( 1be99d...7e011e )
by Mattia
09:18
created

UserDataValidatorTest::shouldNotValidateEmail()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace MinepicTests\Helpers;
6
7
use MinepicTests\TestCase;
8
9
class UserDataValidatorTest extends TestCase
10
{
11
    public function shouldValidateUsernameDataProvider(): array
12
    {
13
        return [
14
            ['ZioPino'],
15
            ['Elon_Musk'],
16
            ['AVeryLongUsername'],
17
        ];
18
    }
19
20
    /**
21
     * @dataProvider shouldValidateUsernameDataProvider
22
     *
23
     * @param $value
24
     */
25
    public function testShouldValidateUsername($value): void
26
    {
27
        $this->assertTrue(
28
            \Minepic\Helpers\UserDataValidator::isValidUsername($value)
29
        );
30
    }
31
32
    public function shouldNotValidateUsernameDataProvider(): array
33
    {
34
        return [
35
            ['!LOL'],
36
            ['EB&ACA'],
37
            ['Invalid@Username'],
38
        ];
39
    }
40
41
    /**
42
     * @dataProvider shouldNotValidateUsernameDataProvider
43
     *
44
     * @param $value
45
     */
46
    public function testShouldNotValidateUsername($value): void
47
    {
48
        $this->assertFalse(
49
            \Minepic\Helpers\UserDataValidator::isValidUsername($value)
50
        );
51
    }
52
53
    public function shouldValidateUuidDataProvider(): array
54
    {
55
        return [
56
            ['6257a83ef36c4ba29115f4213869d5fb'],
57
            ['45f50155c09f4fdcb5cee30af2ebd1f0'],
58
            ['f498513ce8c84773be26ecfc7ed5185d'],
59
        ];
60
    }
61
62
    /**
63
     * @dataProvider shouldValidateUuidDataProvider
64
     *
65
     * @param $value
66
     */
67
    public function testShouldValidateUuid($value): void
68
    {
69
        $this->assertTrue(
70
            \Minepic\Helpers\UserDataValidator::isValidUuid($value)
71
        );
72
    }
73
74
    public function shouldNotValidateUuidDataProvider(): array
75
    {
76
        return [
77
            ['____a83ef36c4ba29115f4213869d5fb'],
78
            ['45f50155c09f4fdcb5cee30af2e!!!!'],
79
            ['f498513🤬84773be26ecfc7ed5185d'],
80
        ];
81
    }
82
83
    /**
84
     * @dataProvider shouldNotValidateUuidDataProvider
85
     *
86
     * @param $value
87
     */
88
    public function testShouldNotValidateUuid($value): void
89
    {
90
        $this->assertFalse(
91
            \Minepic\Helpers\UserDataValidator::isValidUuid($value)
92
        );
93
    }
94
95
    public function shouldValidateEmailDataProvider(): array
96
    {
97
        return [
98
            ['[email protected]'],
99
            ['[email protected]'],
100
            ['[email protected]'],
101
        ];
102
    }
103
104
    /**
105
     * @dataProvider shouldValidateEmailDataProvider
106
     *
107
     * @param $value
108
     */
109
    public function testShouldValidateEmail($value): void
110
    {
111
        $this->assertTrue(
112
            \Minepic\Helpers\UserDataValidator::isValidEmail($value)
113
        );
114
    }
115
116
    public function shouldNotValidateEmailDataProvider(): array
117
    {
118
        return [
119
            ['@[email protected]'],
120
            ['user.test+lole_xample.com'],
121
            ['[email protected]@lol'],
122
        ];
123
    }
124
125
    /**
126
     * @dataProvider shouldNotValidateEmailDataProvider
127
     *
128
     * @param $value
129
     */
130
    public function testShouldNotValidateEmail($value): void
131
    {
132
        $this->assertFalse(
133
            \Minepic\Helpers\UserDataValidator::isValidEmail($value)
134
        );
135
    }
136
}
137