add endpoint for server-side exclude setting

This commit is contained in:
dave
2019-08-12 15:00:34 +03:00
parent d895b50e47
commit c49409b978
4 changed files with 570 additions and 314 deletions

View 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);
}
}