GetTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A testGetChallengeError() 0 15 1
1
<?php
2
namespace LE_ACME2Tests\Response\Authorization;
3
4
use LE_ACME2Tests\Connector;
5
use LE_ACME2Tests\EnhancedTestCase;
6
use PHPUnit\Framework\TestCase;
7
8
class GetTest extends EnhancedTestCase {
9
10
    /**
11
     * @covers \LE_ACME2\Response\Authorization\Get::getChallenges
12
     */
13
    public function testGetChallengeError() {
14
15
        $rawResponse = Connector\RawResponse::createDummyFrom(
16
            Connector\RawResponse::HEADER_200,
17
            file_get_contents(dirname(__FILE__, 2) . DIRECTORY_SEPARATOR . '_JSONSamples' . DIRECTORY_SEPARATOR . 'ChallengeError.json')
18
        );
19
20
        $response = new \LE_ACME2\Response\Authorization\Get($rawResponse);
21
        $challenge = $response->getChallenge('http-01');
22
23
        $error = $challenge->error;
24
        $this->assertTrue(is_object($error) === true);
25
        $this->assertTrue($error->type === 'urn:ietf:params:acme:error:dns');
26
        $this->assertTrue($error->detail === "DNS problem: SERVFAIL looking up CAA for domain1.tld - the domain's nameservers may be malfunctioning");
27
        $this->assertTrue($error->status === 400);
28
    }
29
}