Completed
Push — master ( bcf360...98d48e )
by Abdala
03:37
created

LowercaseTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 20
loc 20
rs 10
c 0
b 0
f 0

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace Tests\CustomerGauge\Password\Rule;
4
5
use PHPUnit\Framework\TestCase;
6
use CustomerGauge\Password\Rule\Lowercase;
7
use CustomerGauge\Password\Exception\InvalidPassword;
8
9
class LowercaseTest extends TestCase
10
{
11
    public function test_it_can_validate_at_least_one_lowercase_letter()
12
    {
13
        self::expectException(InvalidPassword::class);
14
15
        $lowercase = new Lowercase(); 
16
17
        $lowercase('PASSWORD');
18
    }
19
20
    public function test_it_can_validate_at_least_two_lowercase_letters()
21
    {
22
        self::expectException(InvalidPassword::class);
23
24
        $lowercase = new Lowercase(2); 
25
26
        $lowercase('PASSWORd!');
27
    }
28
}
29