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

FixtureCustomMethod   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 6
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 0
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Tests\CustomerGauge\Password;
4
5
use PHPUnit\Framework\TestCase;
6
use CustomerGauge\Password\Rule;
7
use CustomerGauge\Password\RuleChain;
8
9
class RuleChainTest extends TestCase
10
{
11
    public function test_it_can_validate_rules()
12
    {
13
        $rule = $this->createMock(Rule::class);
14
15
        $rule->expects($this->once())
16
            ->method('__invoke');
17
18
        $validate = new RuleChain($rule);
19
20
        $validate('password');
21
    }
22
23
    public function test_it_can_validate_callables()
24
    {
25
        $function = function() {};
26
27
        $customMethod = new FixtureCustomMethod;
28
29
        $rule = $this->createMock(Rule::class);
30
31
        $rule->expects($this->once())
32
            ->method('__invoke');
33
34
        $validate = new RuleChain(
35
            'is_string',
36
            $function,
37
            [$customMethod, 'customMethod'],
38
            $rule
39
        );
40
41
        $validate('password');
42
    }
43
}
44
45
class FixtureCustomMethod
46
{
47
    public function customMethod(string $value) : void
48
    {
49
    }
50
}
51