BrokenExternalLinkTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 25
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A httpCodeProvider() 0 8 1
A testGetHTTPCodeDescription() 0 5 1
1
<?php
2
3
namespace SilverStripe\ExternalLinks\Tests\Model;
4
5
use SilverStripe\Dev\SapphireTest;
6
use SilverStripe\ExternalLinks\Model\BrokenExternalLink;
7
8
class BrokenExternalLinkTest extends SapphireTest
9
{
10
    /**
11
     * @param int $httpCode
12
     * @param string $expected
13
     * @dataProvider httpCodeProvider
14
     */
15
    public function testGetHTTPCodeDescription($httpCode, $expected)
16
    {
17
        $link = new BrokenExternalLink();
18
        $link->HTTPCode = $httpCode;
19
        $this->assertSame($expected, $link->getHTTPCodeDescription());
20
    }
21
22
    /**
23
     * @return array[]
24
     */
25
    public function httpCodeProvider()
26
    {
27
        return [
28
            [200, '200 (OK)'],
29
            [302, '302 (Found)'],
30
            [404, '404 (Not Found)'],
31
            [500, '500 (Internal Server Error)'],
32
            [789, '789 (Unknown Response Code)'],
33
        ];
34
    }
35
}
36