Add changing TLS Zone Settings capability

This commit is contained in:
Marlin-Ops.com - Jurgen Coetsiers
2018-10-21 11:27:07 +02:00
parent 8bb2e8a110
commit 67a24c5784
3 changed files with 26 additions and 2 deletions

View File

@@ -44,6 +44,10 @@ class TLS implements API
); );
$body = json_decode($return->getBody()); $body = json_decode($return->getBody());
return $body->result; if ($body->success) {
return true;
}
return false;
} }
} }

View File

@@ -28,4 +28,24 @@ class TLSTest extends TestCase
$this->assertTrue($result); $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);
}
} }

View File

@@ -2,5 +2,5 @@
"success": true, "success": true,
"errors": [], "errors": [],
"messages": [], "messages": [],
"result": "1.0" "result": "1.1"
} }