From 83e1dc8b49345e078cfa21bd4c563dfa99c5ed63 Mon Sep 17 00:00:00 2001 From: Joseph Bielawski Date: Tue, 13 Feb 2024 17:23:54 +0100 Subject: [PATCH] Fix fetching data in `W3CReferenceTest` on AppVeyor --- Tests/Reference/W3CReferenceTest.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Tests/Reference/W3CReferenceTest.php b/Tests/Reference/W3CReferenceTest.php index 9749b85..6cb67c2 100644 --- a/Tests/Reference/W3CReferenceTest.php +++ b/Tests/Reference/W3CReferenceTest.php @@ -36,7 +36,7 @@ public function testElements() sort($referenceElements); $this->assertSame( - json_decode(file_get_contents(self::STANDARD_RESOURCES['elements']), true, 512, \JSON_THROW_ON_ERROR), + $this->getResourceData(self::STANDARD_RESOURCES['elements']), $referenceElements ); } @@ -48,8 +48,18 @@ public function testAttributes() } $this->assertSame( - json_decode(file_get_contents(self::STANDARD_RESOURCES['attributes']), true, 512, \JSON_THROW_ON_ERROR), + $this->getResourceData(self::STANDARD_RESOURCES['attributes']), array_keys(W3CReference::ATTRIBUTES) ); } + + private function getResourceData(string $resource): array + { + return json_decode( + file_get_contents($resource, false, stream_context_create(['ssl' => ['verify_peer' => false, 'verify_peer_name' => false]])), + true, + 512, + \JSON_THROW_ON_ERROR + ); + } }