Completed
Push — development ( bff125...0f5c1f )
by Fabian
07:22
created

ExcludedEmailDomainsTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 2
dl 0
loc 26
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testIsExcluded() 0 10 3
A dataIsExcluded() 0 10 1
1
<?php
2
/**
3
 * integer_net Magento Module
4
 *
5
 * @category   IntegerNet
6
 * @package    IntegerNet
7
 * @copyright  Copyright (c) 2016 integer_net GmbH (http://www.integer-net.de/)
8
 * @author     Fabian Schmengler <[email protected]>
9
 */
10
11
namespace IntegerNet\Anonymizer\Config;
12
13
14
class ExcludedEmailDomainsTest extends \PHPUnit_Framework_TestCase
15
{
16
    /**
17
     * @dataProvider dataIsExcluded
18
     */
19
    public function testIsExcluded($domains, $excluded, $notExcluded)
20
    {
21
        $excludedEmailDomains = new ExcludedEmailDomains($domains);
22
        foreach ($excluded as $ex) {
23
            $this->assertTrue($excludedEmailDomains->matches($ex));
24
        }
25
        foreach ($notExcluded as $notEx) {
26
            $this->assertFalse($excludedEmailDomains->matches($notEx));
27
        }
28
    }
29
    public static function dataIsExcluded()
30
    {
31
        return [
32
            [
33
                'domains' => ['project.tld', 'agency.tld', 'subdomain.domain.tld'],
34
                'excluded' => ['[email protected]', '[email protected]', '[email protected]'],
35
                'not_excluded' => ['[email protected]', '[email protected]', '[email protected]', '[email protected]'],
36
            ],
37
        ];
38
    }
39
}
40