diff --git a/src/Endpoints/TLS.php b/src/Endpoints/TLS.php index eee0ae6..ca29420 100644 --- a/src/Endpoints/TLS.php +++ b/src/Endpoints/TLS.php @@ -44,6 +44,10 @@ class TLS implements API ); $body = json_decode($return->getBody()); - return $body->result; + if ($body->success) { + return true; + } + + return false; } } diff --git a/tests/Endpoints/TLSTest.php b/tests/Endpoints/TLSTest.php index b8c9229..f7d0360 100644 --- a/tests/Endpoints/TLSTest.php +++ b/tests/Endpoints/TLSTest.php @@ -28,4 +28,24 @@ class TLSTest extends TestCase $this->assertTrue($result); } + + public function testChangeMinimimTLSVersion() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/changeMinimumTLSVersion.json'); + + $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock->method('patch')->willReturn($response); + + $mock->expects($this->once()) + ->method('patch') + ->with( + $this->equalTo('zones/c2547eb745079dac9320b638f5e225cf483cc5cfdda41/settings/min_tls_version'), + $this->equalTo(['value' => '1.1']) + ); + + $ZoneTLSSettings = new \Cloudflare\API\Endpoints\TLS($mock); + $result = $ZoneTLSSettings->changeMinimumTLSVersion('c2547eb745079dac9320b638f5e225cf483cc5cfdda41', '1.1'); + + $this->assertTrue($result); + } } diff --git a/tests/Fixtures/Endpoints/changeMinimumTLSVersion.json b/tests/Fixtures/Endpoints/changeMinimumTLSVersion.json index 859cf87..f136586 100644 --- a/tests/Fixtures/Endpoints/changeMinimumTLSVersion.json +++ b/tests/Fixtures/Endpoints/changeMinimumTLSVersion.json @@ -2,5 +2,5 @@ "success": true, "errors": [], "messages": [], - "result": "1.0" + "result": "1.1" }