add endpoint for server-side exclude setting
This commit is contained in:
823
composer.lock
generated
823
composer.lock
generated
File diff suppressed because it is too large
Load Diff
39
tests/Endpoints/ZoneSettingsTest.php
Normal file
39
tests/Endpoints/ZoneSettingsTest.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Cloudflare\API\Adapter\Adapter;
|
||||
use Cloudflare\API\Endpoints\ZoneSettings;
|
||||
|
||||
class ZoneSettingsTest extends TestCase
|
||||
{
|
||||
public function testGetServerSideExcludeSetting()
|
||||
{
|
||||
$response = $this->getPsr7JsonResponseForFixture('Endpoints/getServerSideExclude.json');
|
||||
|
||||
$mock = $this->getMockBuilder(Adapter::class)->getMock();
|
||||
$mock->method('get')->willReturn($response);
|
||||
|
||||
$mock->expects($this->once())->method('get');
|
||||
|
||||
$zones = new ZoneSettings($mock);
|
||||
$result = $zones->getServerSideExcludeSetting('023e105f4ecef8ad9ca31a8372d0c353');
|
||||
|
||||
$this->assertSame('on', $result);
|
||||
}
|
||||
|
||||
public function testUpdateServerSideExcludeSetting()
|
||||
{
|
||||
$response = $this->getPsr7JsonResponseForFixture('Endpoints/updateServerSideExclude.json');
|
||||
|
||||
$mock = $this->getMockBuilder(Adapter::class)->getMock();
|
||||
$mock->method('patch')->willReturn($response);
|
||||
|
||||
$mock->expects($this->once())->method('patch');
|
||||
|
||||
$zones = new ZoneSettings($mock);
|
||||
$result = $zones->updateServerSideExcludeSetting('023e105f4ecef8ad9ca31a8372d0c353', 'on');
|
||||
|
||||
$this->assertSame('on', $result);
|
||||
}
|
||||
}
|
||||
11
tests/Fixtures/Endpoints/getServerSideExclude.json
Normal file
11
tests/Fixtures/Endpoints/getServerSideExclude.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"success": true,
|
||||
"errors": [],
|
||||
"messages": [],
|
||||
"result": {
|
||||
"id": "server_side_exclude",
|
||||
"value": "on",
|
||||
"editable": true,
|
||||
"modified_on": "2014-01-01T05:20:00.12345Z"
|
||||
}
|
||||
}
|
||||
11
tests/Fixtures/Endpoints/updateServerSideExclude.json
Normal file
11
tests/Fixtures/Endpoints/updateServerSideExclude.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"success": true,
|
||||
"errors": [],
|
||||
"messages": [],
|
||||
"result": {
|
||||
"id": "server_side_exclude",
|
||||
"value": "on",
|
||||
"editable": true,
|
||||
"modified_on": "2014-01-01T05:20:00.12345Z"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user