GetTest::testGetChallengeError()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

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