-
Notifications
You must be signed in to change notification settings - Fork 229
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #102 from umbrellio/add_endpoints_zones_settings
add endpoint for server-side exclude setting
- Loading branch information
Showing
4 changed files
with
95 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} | ||
} |