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

ExcludedEmailDomainsTest::dataIsExcluded()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 0
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