Files
cloudflare-php/tests/Endpoints/ZoneSettingsTest.php

40 lines
1.2 KiB
PHP

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