Add Browser Cache TTL endpoint (#127)

Co-authored-by: bnalonezi <b.alenezi@zid.sa>
This commit is contained in:
bnalonezi
2020-07-07 13:18:40 +03:00
committed by GitHub
parent afd332a747
commit fab493d2d3
4 changed files with 83 additions and 0 deletions

View File

@@ -36,4 +36,34 @@ class ZoneSettingsTest extends TestCase
$this->assertSame('on', $result);
}
public function testGetBrowserCacheTtlSetting()
{
$response = $this->getPsr7JsonResponseForFixture('Endpoints/getBrowserCacheTtlSetting.json');
$mock = $this->getMockBuilder(Adapter::class)->getMock();
$mock->method('get')->willReturn($response);
$mock->expects($this->once())->method('get');
$zones = new ZoneSettings($mock);
$result = $zones->getBrowserCacheTtlSetting('023e105f4ecef8ad9ca31a8372d0c353');
$this->assertSame(14400, $result);
}
public function testUpdateBrowserCacheTtlSetting()
{
$response = $this->getPsr7JsonResponseForFixture('Endpoints/updateBrowserCacheTtlSetting.json');
$mock = $this->getMockBuilder(Adapter::class)->getMock();
$mock->method('patch')->willReturn($response);
$mock->expects($this->once())->method('patch');
$zones = new ZoneSettings($mock);
$result = $zones->updateBrowserCacheTtlSetting('023e105f4ecef8ad9ca31a8372d0c353', 16070400);
$this->assertTrue($result);
}
}