Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2a3929824e | ||
|
|
121209e4ca | ||
|
|
1baeeee882 |
@@ -71,7 +71,7 @@ class Guzzle implements Adapter
|
|||||||
|
|
||||||
$response = $this->client->put($uri, [
|
$response = $this->client->put($uri, [
|
||||||
'headers' => $headers,
|
'headers' => $headers,
|
||||||
'body' => $jsonBody
|
'json' => $jsonBody
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -88,7 +88,7 @@ class Guzzle implements Adapter
|
|||||||
|
|
||||||
$response = $this->client->patch($uri, [
|
$response = $this->client->patch($uri, [
|
||||||
'headers' => $headers,
|
'headers' => $headers,
|
||||||
'body' => $jsonBody
|
'json' => $jsonBody
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -103,7 +103,7 @@ class Guzzle implements Adapter
|
|||||||
{
|
{
|
||||||
$response = $this->client->delete($uri, [
|
$response = $this->client->delete($uri, [
|
||||||
'headers' => $headers,
|
'headers' => $headers,
|
||||||
'form_params' => $body
|
'json' => $body
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ class Zones implements API
|
|||||||
* @param string $zoneID
|
* @param string $zoneID
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function purgeAll(string $zoneID): bool
|
public function cachePurgeEverything(string $zoneID): bool
|
||||||
{
|
{
|
||||||
$user = $this->adapter->delete('zones/' . $zoneID . '/purge_cache', [], ["purge_everything" => true]);
|
$user = $this->adapter->delete('zones/' . $zoneID . '/purge_cache', [], ["purge_everything" => true]);
|
||||||
|
|
||||||
@@ -121,7 +121,7 @@ class Zones implements API
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function purge(string $zoneID, array $files = [], array $tags = []): bool
|
public function cachePurge(string $zoneID, array $files = [], array $tags = []): bool
|
||||||
{
|
{
|
||||||
if (empty($files) && empty($tags)) {
|
if (empty($files) && empty($tags)) {
|
||||||
throw new EndpointException("No files or tags to purge.");
|
throw new EndpointException("No files or tags to purge.");
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ class GuzzleTest extends PHPUnit_Framework_TestCase
|
|||||||
$this->assertEquals("application/json", $headers["Content-Type"][0]);
|
$this->assertEquals("application/json", $headers["Content-Type"][0]);
|
||||||
|
|
||||||
$body = json_decode($response->getBody());
|
$body = json_decode($response->getBody());
|
||||||
$this->assertEquals("Testing a PUT request.", $body->json->{"X-Put-Test"});
|
$this->assertEquals("Testing a PUT request.", json_decode($body->json)->{"X-Put-Test"});
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testPatch()
|
public function testPatch()
|
||||||
@@ -70,7 +70,7 @@ class GuzzleTest extends PHPUnit_Framework_TestCase
|
|||||||
$this->assertEquals("application/json", $headers["Content-Type"][0]);
|
$this->assertEquals("application/json", $headers["Content-Type"][0]);
|
||||||
|
|
||||||
$body = json_decode($response->getBody());
|
$body = json_decode($response->getBody());
|
||||||
$this->assertEquals("Testing a PATCH request.", $body->json->{"X-Patch-Test"});
|
$this->assertEquals("Testing a PATCH request.", json_decode($body->json)->{"X-Patch-Test"});
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDelete()
|
public function testDelete()
|
||||||
@@ -82,7 +82,7 @@ class GuzzleTest extends PHPUnit_Framework_TestCase
|
|||||||
$this->assertEquals("application/json", $headers["Content-Type"][0]);
|
$this->assertEquals("application/json", $headers["Content-Type"][0]);
|
||||||
|
|
||||||
$body = json_decode($response->getBody());
|
$body = json_decode($response->getBody());
|
||||||
$this->assertEquals("Testing a DELETE request.", $body->form->{"X-Delete-Test"});
|
$this->assertEquals("Testing a DELETE request.", $body->json->{"X-Delete-Test"});
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testErrors()
|
public function testErrors()
|
||||||
|
|||||||
@@ -290,7 +290,7 @@ class ZonesTest extends PHPUnit_Framework_TestCase
|
|||||||
$this->assertEquals("023e105f4ecef8ad9ca31a8372d0c353", $result);
|
$this->assertEquals("023e105f4ecef8ad9ca31a8372d0c353", $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testPurgeAll()
|
public function testCachePurgeEverything()
|
||||||
{
|
{
|
||||||
$stream = GuzzleHttp\Psr7\stream_for('{
|
$stream = GuzzleHttp\Psr7\stream_for('{
|
||||||
"success": true,
|
"success": true,
|
||||||
@@ -312,7 +312,7 @@ class ZonesTest extends PHPUnit_Framework_TestCase
|
|||||||
);
|
);
|
||||||
|
|
||||||
$zones = new \Cloudflare\API\Endpoints\Zones($mock);
|
$zones = new \Cloudflare\API\Endpoints\Zones($mock);
|
||||||
$result = $zones->purgeAll("c2547eb745079dac9320b638f5e225cf483cc5cfdda41");
|
$result = $zones->cachePurgeEverything("c2547eb745079dac9320b638f5e225cf483cc5cfdda41");
|
||||||
|
|
||||||
$this->assertTrue($result);
|
$this->assertTrue($result);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user