BrokenExternalLinkTest::httpCodeProvider()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

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