GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( caac67...e703d4 )
by Christian
06:26
created

StringTwigExtensionTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 75
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 75
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A testAntispam() 0 6 1
A testAntispamText() 0 6 1
B getMailHtml() 0 26 1
A getMailText() 0 13 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * (c) Christian Gripp <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Core23\AntiSpamBundle\Tests\Twig\Extension;
13
14
use Core23\AntiSpamBundle\Twig\Extension\StringTwigExtension;
15
use PHPUnit\Framework\TestCase;
16
17
final class StringTwigExtensionTest extends TestCase
18
{
19
    /**
20
     * @dataProvider getMailHtml
21
     *
22
     * @param string $input
23
     * @param string $output
24
     */
25
    public function testAntispam(string $input, string $output): void
26
    {
27
        $extension = new StringTwigExtension('spam', ['[AT]'], ['[DOT]']);
28
29
        $this->assertSame($output, $extension->antispam($input));
30
    }
31
32
    /**
33
     * @dataProvider getMailText
34
     *
35
     * @param string $input
36
     * @param string $output
37
     */
38
    public function testAntispamText(string $input, string $output): void
39
    {
40
        $extension = new StringTwigExtension('spam', ['[AT]'], ['[DOT]']);
41
42
        $this->assertSame($output, $extension->antispam($input, false));
43
    }
44
45
    /**
46
     * @return array
47
     */
48
    public function getMailHtml()
49
    {
50
        return [
51
            [
52
                'Lorem Ipsum <script>var link = "[email protected]"; </script> Sit Amet',
53
                'Lorem Ipsum <script>var link = "[email protected]"; </script> Sit Amet',
54
            ],
55
            // TODO: Replace plain mails text in html
56
//            [
57
//                'Lorem Ipsum [email protected] Sit Amet',
58
//                'Lorem Ipsum <span class="spam"><span>foo[DOT]sub</span>[AT]<span>bar[DOT]baz[DOT]tld</span></span> Sit Amet',
59
//            ],
60
            [
61
                'Lorem Ipsum <a href="mailto:[email protected]">John Smith</a> Sit Amet',
62
                'Lorem Ipsum <span class="spam"><span>john</span>[AT]<span>smith[DOT]cool</span> (<span>John Smith</span>)</span> Sit Amet',
63
            ],
64
            [
65
                'Lorem Ipsum <a href="mailto:[email protected]">[email protected]</a> Sit Amet',
66
                'Lorem Ipsum <span class="spam"><span>foo[DOT]sub</span>[AT]<span>bar[DOT]baz[DOT]tld</span></span> Sit Amet',
67
            ],
68
            [
69
                'Lorem Ipsum <span class="spam"><span>foo[DOT]sub</span>[AT]<span>bar[DOT]baz[DOT]tld</span></span> Sit Amet',
70
                'Lorem Ipsum <span class="spam"><span>foo[DOT]sub</span>[AT]<span>bar[DOT]baz[DOT]tld</span></span> Sit Amet',
71
            ],
72
        ];
73
    }
74
75
    /**
76
     * @return array
77
     */
78
    public function getMailText()
79
    {
80
        return [
81
            [
82
                'Lorem Ipsum [email protected] Sit Amet',
83
                'Lorem Ipsum foo[DOT]sub[AT]bar[DOT]baz[DOT]tld Sit Amet',
84
            ],
85
            [
86
                'Lorem Ipsum foo[DOT]sub[AT]bar[DOT]baz[DOT]tld Sit Amet',
87
                'Lorem Ipsum foo[DOT]sub[AT]bar[DOT]baz[DOT]tld Sit Amet',
88
            ],
89
        ];
90
    }
91
}
92