Applied PSR2 formatting to existing files
This commit is contained in:
@@ -7,7 +7,6 @@
|
||||
|
||||
namespace Cloudflare\API\Adapter;
|
||||
|
||||
|
||||
use Cloudflare\API\Auth\Auth;
|
||||
use GuzzleHttp\Client;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
@@ -44,7 +43,6 @@ class Guzzle implements Adapter
|
||||
|
||||
$this->checkError($response);
|
||||
return $response;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -52,7 +50,9 @@ class Guzzle implements Adapter
|
||||
*/
|
||||
public function post(String $uri, array $headers = array(), array $body = array()): ResponseInterface
|
||||
{
|
||||
$response = $this->client->post($uri, [
|
||||
$response = $this->client->post(
|
||||
$uri,
|
||||
[
|
||||
'headers' => $headers,
|
||||
'json' => $body
|
||||
]
|
||||
@@ -69,7 +69,9 @@ class Guzzle implements Adapter
|
||||
{
|
||||
$jsonBody = json_encode($body);
|
||||
|
||||
$response = $this->client->put($uri, [
|
||||
$response = $this->client->put(
|
||||
$uri,
|
||||
[
|
||||
'headers' => $headers,
|
||||
'json' => $jsonBody
|
||||
]
|
||||
@@ -86,7 +88,9 @@ class Guzzle implements Adapter
|
||||
{
|
||||
$jsonBody = json_encode($body);
|
||||
|
||||
$response = $this->client->patch($uri, [
|
||||
$response = $this->client->patch(
|
||||
$uri,
|
||||
[
|
||||
'headers' => $headers,
|
||||
'json' => $jsonBody
|
||||
]
|
||||
@@ -101,7 +105,9 @@ class Guzzle implements Adapter
|
||||
*/
|
||||
public function delete(String $uri, array $headers = array(), array $body = array()): ResponseInterface
|
||||
{
|
||||
$response = $this->client->delete($uri, [
|
||||
$response = $this->client->delete(
|
||||
$uri,
|
||||
[
|
||||
'headers' => $headers,
|
||||
'json' => $body
|
||||
]
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
|
||||
namespace Cloudflare\API\Adapter;
|
||||
|
||||
|
||||
class JSONException extends \Exception
|
||||
{
|
||||
|
||||
}
|
||||
@@ -8,8 +8,6 @@
|
||||
|
||||
namespace Cloudflare\API\Adapter;
|
||||
|
||||
|
||||
class ResponseException extends \Exception
|
||||
{
|
||||
|
||||
}
|
||||
@@ -7,7 +7,6 @@
|
||||
|
||||
namespace Cloudflare\API\Auth;
|
||||
|
||||
|
||||
class APIKey implements Auth
|
||||
{
|
||||
private $email;
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
|
||||
namespace Cloudflare\API\Auth;
|
||||
|
||||
|
||||
interface Auth
|
||||
{
|
||||
public function getHeaders(): array;
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
namespace Cloudflare\API\Auth;
|
||||
|
||||
|
||||
class None implements Auth
|
||||
{
|
||||
public function getHeaders(): array
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
|
||||
namespace Cloudflare\API\Auth;
|
||||
|
||||
|
||||
class UserServiceKey implements Auth
|
||||
{
|
||||
private $userServiceKey;
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
namespace Cloudflare\API\Configurations;
|
||||
|
||||
|
||||
interface Configurations
|
||||
{
|
||||
public function getArray(): array;
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
|
||||
namespace Cloudflare\API\Configurations;
|
||||
|
||||
|
||||
class ConfigurationsException extends \Exception
|
||||
{
|
||||
|
||||
}
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
namespace Cloudflare\API\Configurations;
|
||||
|
||||
|
||||
class PageRulesTargets implements Configurations
|
||||
{
|
||||
private $targets;
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
namespace Cloudflare\API\Configurations;
|
||||
|
||||
|
||||
class UARules implements Configurations
|
||||
{
|
||||
private $configs = array();
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
namespace Cloudflare\API\Configurations;
|
||||
|
||||
|
||||
class ZoneLockdown implements Configurations
|
||||
{
|
||||
private $configs = array();
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
|
||||
namespace Cloudflare\API\Endpoints;
|
||||
|
||||
|
||||
use Cloudflare\API\Adapter\Adapter;
|
||||
|
||||
interface API
|
||||
|
||||
@@ -121,5 +121,4 @@ class DNS implements API
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,8 +8,6 @@
|
||||
|
||||
namespace Cloudflare\API\Endpoints;
|
||||
|
||||
|
||||
class EndpointException extends \Exception
|
||||
{
|
||||
|
||||
}
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
namespace Cloudflare\API\Endpoints;
|
||||
|
||||
|
||||
use Cloudflare\API\Adapter\Adapter;
|
||||
|
||||
class IPs implements API
|
||||
@@ -20,7 +19,8 @@ class IPs implements API
|
||||
$this->adapter = $adapter;
|
||||
}
|
||||
|
||||
public function listIPs(): \stdClass {
|
||||
public function listIPs(): \stdClass
|
||||
{
|
||||
$ips = $this->adapter->get('ips', [], []);
|
||||
$body = json_decode($ips->getBody());
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
namespace Cloudflare\API\Endpoints;
|
||||
|
||||
|
||||
use Cloudflare\API\Adapter\Adapter;
|
||||
use Cloudflare\API\Configurations\PageRulesActions;
|
||||
use Cloudflare\API\Configurations\PageRulesTargets;
|
||||
|
||||
@@ -46,7 +46,6 @@ class UARules implements API
|
||||
string $id = null,
|
||||
string $description = null
|
||||
): bool {
|
||||
|
||||
$options = [
|
||||
'mode' => $mode,
|
||||
'configurations' => $configuration->getArray()
|
||||
@@ -85,7 +84,6 @@ class UARules implements API
|
||||
\Cloudflare\API\Configurations\UARules $configuration,
|
||||
string $description = null
|
||||
): bool {
|
||||
|
||||
$options = [
|
||||
'mode' => $mode,
|
||||
'id' => $ruleID,
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
|
||||
namespace Cloudflare\API\Endpoints;
|
||||
|
||||
|
||||
use Cloudflare\API\Adapter\Adapter;
|
||||
|
||||
class User implements API
|
||||
|
||||
@@ -46,7 +46,6 @@ class ZoneLockdown implements API
|
||||
string $id = null,
|
||||
string $description = null
|
||||
): bool {
|
||||
|
||||
$options = [
|
||||
'urls' => $urls,
|
||||
'configurations' => $configuration->getArray()
|
||||
@@ -85,7 +84,6 @@ class ZoneLockdown implements API
|
||||
\Cloudflare\API\Configurations\ZoneLockdown $configuration,
|
||||
string $description = null
|
||||
): bool {
|
||||
|
||||
$options = [
|
||||
'urls' => $urls,
|
||||
'id' => $lockdownID,
|
||||
|
||||
@@ -63,8 +63,11 @@ class GuzzleTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
public function testPatch()
|
||||
{
|
||||
$response = $this->client->patch('https://httpbin.org/patch', [],
|
||||
['X-Patch-Test' => 'Testing a PATCH request.']);
|
||||
$response = $this->client->patch(
|
||||
'https://httpbin.org/patch',
|
||||
[],
|
||||
['X-Patch-Test' => 'Testing a PATCH request.']
|
||||
);
|
||||
|
||||
$headers = $response->getHeaders();
|
||||
$this->assertEquals("application/json", $headers["Content-Type"][0]);
|
||||
@@ -75,8 +78,11 @@ class GuzzleTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
public function testDelete()
|
||||
{
|
||||
$response = $this->client->delete('https://httpbin.org/delete', [],
|
||||
['X-Delete-Test' => 'Testing a DELETE request.']);
|
||||
$response = $this->client->delete(
|
||||
'https://httpbin.org/delete',
|
||||
[],
|
||||
['X-Delete-Test' => 'Testing a DELETE request.']
|
||||
);
|
||||
|
||||
$headers = $response->getHeaders();
|
||||
$this->assertEquals("application/json", $headers["Content-Type"][0]);
|
||||
@@ -124,9 +130,9 @@ class GuzzleTest extends PHPUnit_Framework_TestCase
|
||||
$method->invokeArgs($this->client, [$response]);
|
||||
}
|
||||
|
||||
public function testNotFound() {
|
||||
public function testNotFound()
|
||||
{
|
||||
$this->expectException(\GuzzleHttp\Exception\RequestException::class);
|
||||
$response = $this->client->get('https://httpbin.org/status/404');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,5 @@ class APIKeyTest extends PHPUnit_Framework_TestCase
|
||||
$this->assertEquals('1234567893feefc5f0q5000bfo0c38d90bbeb', $headers['X-Auth-Key']);
|
||||
|
||||
$this->assertEquals(2, sizeof($headers));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,10 +14,11 @@ class UserServiceKeyTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
$this->assertArrayHasKey('X-Auth-User-Service-Key', $headers);
|
||||
|
||||
$this->assertEquals('v1.0-e24fd090c02efcfecb4de8f4ff246fd5c75b48946fdf0ce26c59f91d0d90797b-cfa33fe60e8e34073c149323454383fc9005d25c9b4c502c2f063457ef65322eade065975001a0b4b4c591c5e1bd36a6e8f7e2d4fa8a9ec01c64c041e99530c2-07b9efe0acd78c82c8d9c690aacb8656d81c369246d7f996a205fe3c18e9254a',
|
||||
$headers['X-Auth-User-Service-Key']);
|
||||
$this->assertEquals(
|
||||
'v1.0-e24fd090c02efcfecb4de8f4ff246fd5c75b48946fdf0ce26c59f91d0d90797b-cfa33fe60e8e34073c149323454383fc9005d25c9b4c502c2f063457ef65322eade065975001a0b4b4c591c5e1bd36a6e8f7e2d4fa8a9ec01c64c041e99530c2-07b9efe0acd78c82c8d9c690aacb8656d81c369246d7f996a205fe3c18e9254a',
|
||||
$headers['X-Auth-User-Service-Key']
|
||||
);
|
||||
|
||||
$this->assertEquals(1, sizeof($headers));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,9 @@ class ConfigurationsUARulesTest extends PHPUnit_Framework_TestCase
|
||||
$this->assertObjectHasAttribute('target', $array[0]);
|
||||
$this->assertEquals('ua', $array[0]->target);
|
||||
$this->assertObjectHasAttribute('value', $array[0]);
|
||||
$this->assertEquals('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/603.2.4 (KHTML, like Gecko) Version/10.1.1 Safari/603.2.4',
|
||||
$array[0]->value);
|
||||
$this->assertEquals(
|
||||
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/603.2.4 (KHTML, like Gecko) Version/10.1.1 Safari/603.2.4',
|
||||
$array[0]->value
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,8 @@ use Cloudflare\API\Configurations\PageRulesTargets;
|
||||
|
||||
class PageRulesTargetTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testGetArray() {
|
||||
public function testGetArray()
|
||||
{
|
||||
$targets = new PageRulesTargets('junade.com/*');
|
||||
$array = $targets->getArray();
|
||||
|
||||
|
||||
@@ -37,7 +37,9 @@ class DNSTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('post')
|
||||
->with($this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/dns_records'), $this->equalTo([]),
|
||||
->with(
|
||||
$this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/dns_records'),
|
||||
$this->equalTo([]),
|
||||
$this->equalTo([
|
||||
'type' => 'A',
|
||||
'name' => 'example.com',
|
||||
@@ -88,7 +90,8 @@ class DNSTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('get')
|
||||
->with($this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/dns_records'),
|
||||
->with(
|
||||
$this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/dns_records'),
|
||||
$this->equalTo([
|
||||
'page' => 1,
|
||||
'per_page' => 20,
|
||||
@@ -102,7 +105,7 @@ class DNSTest extends PHPUnit_Framework_TestCase
|
||||
);
|
||||
|
||||
$zones = new \Cloudflare\API\Endpoints\DNS($mock);
|
||||
$result = $zones->listRecords("023e105f4ecef8ad9ca31a8372d0c353","A", "example.com", "127.0.0.1", 1, 20, "type", "desc", "all");
|
||||
$result = $zones->listRecords("023e105f4ecef8ad9ca31a8372d0c353", "A", "example.com", "127.0.0.1", 1, 20, "type", "desc", "all");
|
||||
|
||||
$this->assertObjectHasAttribute('result', $result);
|
||||
$this->assertObjectHasAttribute('result_info', $result);
|
||||
@@ -140,7 +143,8 @@ class DNSTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('get')
|
||||
->with($this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/dns_records/372e67954025e0ba6aaa6d586b9e0b59'),
|
||||
->with(
|
||||
$this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/dns_records/372e67954025e0ba6aaa6d586b9e0b59'),
|
||||
$this->equalTo([])
|
||||
);
|
||||
|
||||
|
||||
@@ -10,7 +10,8 @@ use Cloudflare\API\Endpoints\IPs;
|
||||
|
||||
class IPsTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testListIPs() {
|
||||
public function testListIPs()
|
||||
{
|
||||
$stream = GuzzleHttp\Psr7\stream_for('
|
||||
{
|
||||
"success": true,
|
||||
@@ -31,7 +32,9 @@ class IPsTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('get')
|
||||
->with($this->equalTo('ips'), $this->equalTo([])
|
||||
->with(
|
||||
$this->equalTo('ips'),
|
||||
$this->equalTo([])
|
||||
);
|
||||
|
||||
$ips = new \Cloudflare\API\Endpoints\IPs($mock);
|
||||
|
||||
@@ -53,7 +53,9 @@ class PageRulesTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('post')
|
||||
->with($this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/pagerules'), $this->equalTo([]),
|
||||
->with(
|
||||
$this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/pagerules'),
|
||||
$this->equalTo([]),
|
||||
$this->equalTo([
|
||||
'targets' => $target->getArray(),
|
||||
'actions' => $action->getArray(),
|
||||
@@ -116,7 +118,8 @@ class PageRulesTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('get')
|
||||
->with($this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/pagerules'),
|
||||
->with(
|
||||
$this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/pagerules'),
|
||||
$this->equalTo([
|
||||
'status' => 'active',
|
||||
'order' => 'status',
|
||||
@@ -170,7 +173,9 @@ class PageRulesTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('get')
|
||||
->with($this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/pagerules/9a7806061c88ada191ed06f989cc3dac'), $this->equalTo([])
|
||||
->with(
|
||||
$this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/pagerules/9a7806061c88ada191ed06f989cc3dac'),
|
||||
$this->equalTo([])
|
||||
);
|
||||
|
||||
$pr = new \Cloudflare\API\Endpoints\PageRules($mock);
|
||||
@@ -220,7 +225,9 @@ class PageRulesTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('patch')
|
||||
->with($this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/pagerules'), $this->equalTo([]),
|
||||
->with(
|
||||
$this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/pagerules'),
|
||||
$this->equalTo([]),
|
||||
$this->equalTo([
|
||||
'targets' => $target->getArray(),
|
||||
'actions' => $action->getArray(),
|
||||
@@ -256,7 +263,9 @@ class PageRulesTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('delete')
|
||||
->with($this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/pagerules/9a7806061c88ada191ed06f989cc3dac'), $this->equalTo([]),
|
||||
->with(
|
||||
$this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/pagerules/9a7806061c88ada191ed06f989cc3dac'),
|
||||
$this->equalTo([]),
|
||||
$this->equalTo([])
|
||||
);
|
||||
|
||||
|
||||
@@ -45,7 +45,8 @@ class UARulesTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('get')
|
||||
->with($this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/firewall/ua_rules'),
|
||||
->with(
|
||||
$this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/firewall/ua_rules'),
|
||||
$this->equalTo([
|
||||
'page' => 1,
|
||||
'per_page' => 20
|
||||
@@ -93,7 +94,9 @@ class UARulesTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('post')
|
||||
->with($this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/firewall/ua_rules'), $this->equalTo([]),
|
||||
->with(
|
||||
$this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/firewall/ua_rules'),
|
||||
$this->equalTo([]),
|
||||
$this->equalTo([
|
||||
'mode' => 'js_challenge',
|
||||
'id' => '372e67954025e0ba6aaa6d586b9e0b59',
|
||||
@@ -103,9 +106,13 @@ class UARulesTest extends PHPUnit_Framework_TestCase
|
||||
);
|
||||
|
||||
$ld = new \Cloudflare\API\Endpoints\UARules($mock);
|
||||
$ld->createRule('023e105f4ecef8ad9ca31a8372d0c353', 'js_challenge', $config,
|
||||
$ld->createRule(
|
||||
'023e105f4ecef8ad9ca31a8372d0c353',
|
||||
'js_challenge',
|
||||
$config,
|
||||
'372e67954025e0ba6aaa6d586b9e0b59',
|
||||
'Prevent access from abusive clients identified by this UserAgent to mitigate DDoS attack');
|
||||
'Prevent access from abusive clients identified by this UserAgent to mitigate DDoS attack'
|
||||
);
|
||||
}
|
||||
|
||||
public function getRuleDetails()
|
||||
@@ -135,7 +142,8 @@ class UARulesTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('get')
|
||||
->with($this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/firewall/ua_rules/372e67954025e0ba6aaa6d586b9e0b59'),
|
||||
->with(
|
||||
$this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/firewall/ua_rules/372e67954025e0ba6aaa6d586b9e0b59'),
|
||||
$this->equalTo([])
|
||||
);
|
||||
|
||||
@@ -175,7 +183,8 @@ class UARulesTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('put')
|
||||
->with($this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/firewall/ua_rules/372e67954025e0ba6aaa6d586b9e0b59'),
|
||||
->with(
|
||||
$this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/firewall/ua_rules/372e67954025e0ba6aaa6d586b9e0b59'),
|
||||
$this->equalTo([]),
|
||||
$this->equalTo([
|
||||
'mode' => 'js_challenge',
|
||||
@@ -186,9 +195,13 @@ class UARulesTest extends PHPUnit_Framework_TestCase
|
||||
);
|
||||
|
||||
$ld = new \Cloudflare\API\Endpoints\UARules($mock);
|
||||
$ld->updateRule('023e105f4ecef8ad9ca31a8372d0c353', '372e67954025e0ba6aaa6d586b9e0b59',
|
||||
'js_challenge', $config,
|
||||
'Restrict access to these endpoints to requests from a known IP address');
|
||||
$ld->updateRule(
|
||||
'023e105f4ecef8ad9ca31a8372d0c353',
|
||||
'372e67954025e0ba6aaa6d586b9e0b59',
|
||||
'js_challenge',
|
||||
$config,
|
||||
'Restrict access to these endpoints to requests from a known IP address'
|
||||
);
|
||||
}
|
||||
|
||||
public function testDeleteRule()
|
||||
@@ -211,7 +224,8 @@ class UARulesTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('delete')
|
||||
->with($this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/firewall/ua_rules/372e67954025e0ba6aaa6d586b9e0b59'),
|
||||
->with(
|
||||
$this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/firewall/ua_rules/372e67954025e0ba6aaa6d586b9e0b59'),
|
||||
$this->equalTo([]),
|
||||
$this->equalTo([])
|
||||
);
|
||||
|
||||
@@ -43,7 +43,8 @@ class ZoneLockdownTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('get')
|
||||
->with($this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/firewall/lockdowns'),
|
||||
->with(
|
||||
$this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/firewall/lockdowns'),
|
||||
$this->equalTo([
|
||||
'page' => 1,
|
||||
'per_page' => 20,
|
||||
@@ -91,7 +92,9 @@ class ZoneLockdownTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('post')
|
||||
->with($this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/firewall/lockdowns'), $this->equalTo([]),
|
||||
->with(
|
||||
$this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/firewall/lockdowns'),
|
||||
$this->equalTo([]),
|
||||
$this->equalTo([
|
||||
'urls' => ["api.mysite.com/some/endpoint*"],
|
||||
'id' => '372e67954025e0ba6aaa6d586b9e0b59',
|
||||
@@ -101,9 +104,13 @@ class ZoneLockdownTest extends PHPUnit_Framework_TestCase
|
||||
);
|
||||
|
||||
$ld = new \Cloudflare\API\Endpoints\ZoneLockdown($mock);
|
||||
$ld->createLockdown('023e105f4ecef8ad9ca31a8372d0c353', ["api.mysite.com/some/endpoint*"], $config,
|
||||
$ld->createLockdown(
|
||||
'023e105f4ecef8ad9ca31a8372d0c353',
|
||||
["api.mysite.com/some/endpoint*"],
|
||||
$config,
|
||||
'372e67954025e0ba6aaa6d586b9e0b59',
|
||||
'Restrict access to these endpoints to requests from a known IP address');
|
||||
'Restrict access to these endpoints to requests from a known IP address'
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetRecordDetails()
|
||||
@@ -137,7 +144,8 @@ class ZoneLockdownTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('get')
|
||||
->with($this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/firewall/lockdowns/372e67954025e0ba6aaa6d586b9e0b59'),
|
||||
->with(
|
||||
$this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/firewall/lockdowns/372e67954025e0ba6aaa6d586b9e0b59'),
|
||||
$this->equalTo([])
|
||||
);
|
||||
|
||||
@@ -181,7 +189,8 @@ class ZoneLockdownTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('put')
|
||||
->with($this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/firewall/lockdowns/372e67954025e0ba6aaa6d586b9e0b59'),
|
||||
->with(
|
||||
$this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/firewall/lockdowns/372e67954025e0ba6aaa6d586b9e0b59'),
|
||||
$this->equalTo([]),
|
||||
$this->equalTo([
|
||||
'urls' => ["api.mysite.com/some/endpoint*"],
|
||||
@@ -192,9 +201,13 @@ class ZoneLockdownTest extends PHPUnit_Framework_TestCase
|
||||
);
|
||||
|
||||
$ld = new \Cloudflare\API\Endpoints\ZoneLockdown($mock);
|
||||
$ld->updateLockdown('023e105f4ecef8ad9ca31a8372d0c353', '372e67954025e0ba6aaa6d586b9e0b59',
|
||||
["api.mysite.com/some/endpoint*"], $config,
|
||||
'Restrict access to these endpoints to requests from a known IP address');
|
||||
$ld->updateLockdown(
|
||||
'023e105f4ecef8ad9ca31a8372d0c353',
|
||||
'372e67954025e0ba6aaa6d586b9e0b59',
|
||||
["api.mysite.com/some/endpoint*"],
|
||||
$config,
|
||||
'Restrict access to these endpoints to requests from a known IP address'
|
||||
);
|
||||
}
|
||||
|
||||
public function testDeleteLockdown()
|
||||
@@ -221,7 +234,8 @@ class ZoneLockdownTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('delete')
|
||||
->with($this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/firewall/lockdowns/372e67954025e0ba6aaa6d586b9e0b59'),
|
||||
->with(
|
||||
$this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/firewall/lockdowns/372e67954025e0ba6aaa6d586b9e0b59'),
|
||||
$this->equalTo([]),
|
||||
$this->equalTo([])
|
||||
);
|
||||
|
||||
@@ -70,7 +70,8 @@ class ZonesTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('post')
|
||||
->with($this->equalTo('zones'),
|
||||
->with(
|
||||
$this->equalTo('zones'),
|
||||
$this->equalTo([]),
|
||||
$this->equalTo(['name' => 'example.com', 'jumpstart' => false])
|
||||
);
|
||||
@@ -90,7 +91,8 @@ class ZonesTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('post')
|
||||
->with($this->equalTo('zones'),
|
||||
->with(
|
||||
$this->equalTo('zones'),
|
||||
$this->equalTo([]),
|
||||
$this->equalTo(['name' => 'example.com', 'jumpstart' => true, 'organization' => $org])
|
||||
);
|
||||
@@ -115,7 +117,8 @@ class ZonesTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('put')
|
||||
->with($this->equalTo('zones/c2547eb745079dac9320b638f5e225cf483cc5cfdda41/activation_check'),
|
||||
->with(
|
||||
$this->equalTo('zones/c2547eb745079dac9320b638f5e225cf483cc5cfdda41/activation_check'),
|
||||
$this->equalTo([]),
|
||||
$this->equalTo([])
|
||||
);
|
||||
@@ -196,7 +199,8 @@ class ZonesTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('get')
|
||||
->with($this->equalTo('zones'),
|
||||
->with(
|
||||
$this->equalTo('zones'),
|
||||
$this->equalTo([
|
||||
'page' => 1,
|
||||
'per_page' => 20,
|
||||
@@ -289,7 +293,8 @@ class ZonesTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('get')
|
||||
->with($this->equalTo('zones'),
|
||||
->with(
|
||||
$this->equalTo('zones'),
|
||||
$this->equalTo([
|
||||
'page' => 1,
|
||||
'per_page' => 20,
|
||||
@@ -321,7 +326,8 @@ class ZonesTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('delete')
|
||||
->with($this->equalTo('zones/c2547eb745079dac9320b638f5e225cf483cc5cfdda41/purge_cache'),
|
||||
->with(
|
||||
$this->equalTo('zones/c2547eb745079dac9320b638f5e225cf483cc5cfdda41/purge_cache'),
|
||||
$this->equalTo([]),
|
||||
$this->equalTo(["purge_everything" => true])
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user