Add trait to the rest of the endpoints
This commit is contained in:
@@ -8,9 +8,12 @@
|
|||||||
namespace Cloudflare\API\Endpoints;
|
namespace Cloudflare\API\Endpoints;
|
||||||
|
|
||||||
use Cloudflare\API\Adapter\Adapter;
|
use Cloudflare\API\Adapter\Adapter;
|
||||||
|
use Cloudflare\API\Traits\BodyAccessorTrait;
|
||||||
|
|
||||||
class User implements API
|
class User implements API
|
||||||
{
|
{
|
||||||
|
use BodyAccessorTrait;
|
||||||
|
|
||||||
private $adapter;
|
private $adapter;
|
||||||
|
|
||||||
public function __construct(Adapter $adapter)
|
public function __construct(Adapter $adapter)
|
||||||
@@ -21,8 +24,8 @@ class User implements API
|
|||||||
public function getUserDetails(): \stdClass
|
public function getUserDetails(): \stdClass
|
||||||
{
|
{
|
||||||
$user = $this->adapter->get('user');
|
$user = $this->adapter->get('user');
|
||||||
$body = json_decode($user->getBody());
|
$this->body = json_decode($user->getBody());
|
||||||
return $body->result;
|
return $this->body->result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUserID(): string
|
public function getUserID(): string
|
||||||
@@ -38,6 +41,7 @@ class User implements API
|
|||||||
public function updateUserDetails(array $details): \stdClass
|
public function updateUserDetails(array $details): \stdClass
|
||||||
{
|
{
|
||||||
$response = $this->adapter->patch('user', $details);
|
$response = $this->adapter->patch('user', $details);
|
||||||
return json_decode($response->getBody());
|
$this->body = json_decode($response->getBody());
|
||||||
|
return $this->body;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,9 +9,12 @@
|
|||||||
namespace Cloudflare\API\Endpoints;
|
namespace Cloudflare\API\Endpoints;
|
||||||
|
|
||||||
use Cloudflare\API\Adapter\Adapter;
|
use Cloudflare\API\Adapter\Adapter;
|
||||||
|
use Cloudflare\API\Traits\BodyAccessorTrait;
|
||||||
|
|
||||||
class WAF implements API
|
class WAF implements API
|
||||||
{
|
{
|
||||||
|
use BodyAccessorTrait;
|
||||||
|
|
||||||
private $adapter;
|
private $adapter;
|
||||||
|
|
||||||
public function __construct(Adapter $adapter)
|
public function __construct(Adapter $adapter)
|
||||||
@@ -42,9 +45,9 @@ class WAF implements API
|
|||||||
}
|
}
|
||||||
|
|
||||||
$user = $this->adapter->get('zones/' . $zoneID . '/firewall/waf/packages', $query);
|
$user = $this->adapter->get('zones/' . $zoneID . '/firewall/waf/packages', $query);
|
||||||
$body = json_decode($user->getBody());
|
$this->body = json_decode($user->getBody());
|
||||||
|
|
||||||
return (object)['result' => $body->result, 'result_info' => $body->result_info];
|
return (object)['result' => $this->body->result, 'result_info' => $this->body->result_info];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -53,9 +56,9 @@ class WAF implements API
|
|||||||
string $packageID
|
string $packageID
|
||||||
): \stdClass {
|
): \stdClass {
|
||||||
$user = $this->adapter->get('zones/' . $zoneID . '/firewall/waf/packages/' . $packageID);
|
$user = $this->adapter->get('zones/' . $zoneID . '/firewall/waf/packages/' . $packageID);
|
||||||
$body = json_decode($user->getBody());
|
$this->body = json_decode($user->getBody());
|
||||||
|
|
||||||
return $body->result;
|
return $this->body->result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getRules(
|
public function getRules(
|
||||||
@@ -81,9 +84,9 @@ class WAF implements API
|
|||||||
$query['direction'] = $direction;
|
$query['direction'] = $direction;
|
||||||
}
|
}
|
||||||
$user = $this->adapter->get('zones/' . $zoneID . '/firewall/waf/packages/' . $packageID . '/rules', $query);
|
$user = $this->adapter->get('zones/' . $zoneID . '/firewall/waf/packages/' . $packageID . '/rules', $query);
|
||||||
$body = json_decode($user->getBody());
|
$this->body = json_decode($user->getBody());
|
||||||
|
|
||||||
return (object)['result' => $body->result, 'result_info' => $body->result_info];
|
return (object)['result' => $this->body->result, 'result_info' => $this->body->result_info];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getRuleInfo(
|
public function getRuleInfo(
|
||||||
@@ -92,9 +95,9 @@ class WAF implements API
|
|||||||
string $ruleID
|
string $ruleID
|
||||||
): \stdClass {
|
): \stdClass {
|
||||||
$user = $this->adapter->get('zones/' . $zoneID . '/firewall/waf/packages/' . $packageID . '/rules/' . $ruleID);
|
$user = $this->adapter->get('zones/' . $zoneID . '/firewall/waf/packages/' . $packageID . '/rules/' . $ruleID);
|
||||||
$body = json_decode($user->getBody());
|
$this->body = json_decode($user->getBody());
|
||||||
|
|
||||||
return $body->result;
|
return $this->body->result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updateRule(
|
public function updateRule(
|
||||||
@@ -111,9 +114,9 @@ class WAF implements API
|
|||||||
'zones/' . $zoneID . '/firewall/waf/packages/' . $packageID . '/rules/' . $ruleID,
|
'zones/' . $zoneID . '/firewall/waf/packages/' . $packageID . '/rules/' . $ruleID,
|
||||||
$query
|
$query
|
||||||
);
|
);
|
||||||
$body = json_decode($user->getBody());
|
$this->body = json_decode($user->getBody());
|
||||||
|
|
||||||
return $body->result;
|
return $this->body->result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getGroups(
|
public function getGroups(
|
||||||
@@ -143,9 +146,9 @@ class WAF implements API
|
|||||||
'zones/' . $zoneID . '/firewall/waf/packages/' . $packageID . '/groups',
|
'zones/' . $zoneID . '/firewall/waf/packages/' . $packageID . '/groups',
|
||||||
$query
|
$query
|
||||||
);
|
);
|
||||||
$body = json_decode($user->getBody());
|
$this->body = json_decode($user->getBody());
|
||||||
|
|
||||||
return (object)['result' => $body->result, 'result_info' => $body->result_info];
|
return (object)['result' => $this->body->result, 'result_info' => $this->body->result_info];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getGroupInfo(
|
public function getGroupInfo(
|
||||||
@@ -154,9 +157,9 @@ class WAF implements API
|
|||||||
string $groupID
|
string $groupID
|
||||||
): \stdClass {
|
): \stdClass {
|
||||||
$user = $this->adapter->get('zones/' . $zoneID . '/firewall/waf/packages/' . $packageID . '/groups/' . $groupID);
|
$user = $this->adapter->get('zones/' . $zoneID . '/firewall/waf/packages/' . $packageID . '/groups/' . $groupID);
|
||||||
$body = json_decode($user->getBody());
|
$this->body = json_decode($user->getBody());
|
||||||
|
|
||||||
return $body->result;
|
return $this->body->result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updateGroup(
|
public function updateGroup(
|
||||||
@@ -173,8 +176,8 @@ class WAF implements API
|
|||||||
'zones/' . $zoneID . '/firewall/waf/packages/' . $packageID . '/groups/' . $groupID,
|
'zones/' . $zoneID . '/firewall/waf/packages/' . $packageID . '/groups/' . $groupID,
|
||||||
$query
|
$query
|
||||||
);
|
);
|
||||||
$body = json_decode($user->getBody());
|
$this->body = json_decode($user->getBody());
|
||||||
|
|
||||||
return $body->result;
|
return $this->body->result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,9 +9,12 @@
|
|||||||
namespace Cloudflare\API\Endpoints;
|
namespace Cloudflare\API\Endpoints;
|
||||||
|
|
||||||
use Cloudflare\API\Adapter\Adapter;
|
use Cloudflare\API\Adapter\Adapter;
|
||||||
|
use Cloudflare\API\Traits\BodyAccessorTrait;
|
||||||
|
|
||||||
class ZoneLockdown implements API
|
class ZoneLockdown implements API
|
||||||
{
|
{
|
||||||
|
use BodyAccessorTrait;
|
||||||
|
|
||||||
private $adapter;
|
private $adapter;
|
||||||
|
|
||||||
public function __construct(Adapter $adapter)
|
public function __construct(Adapter $adapter)
|
||||||
@@ -30,9 +33,9 @@ class ZoneLockdown implements API
|
|||||||
];
|
];
|
||||||
|
|
||||||
$user = $this->adapter->get('zones/' . $zoneID . '/firewall/lockdowns', $query);
|
$user = $this->adapter->get('zones/' . $zoneID . '/firewall/lockdowns', $query);
|
||||||
$body = json_decode($user->getBody());
|
$this->body = json_decode($user->getBody());
|
||||||
|
|
||||||
return (object)['result' => $body->result, 'result_info' => $body->result_info];
|
return (object)['result' => $this->body->result, 'result_info' => $this->body->result_info];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createLockdown(
|
public function createLockdown(
|
||||||
@@ -57,9 +60,9 @@ class ZoneLockdown implements API
|
|||||||
|
|
||||||
$user = $this->adapter->post('zones/' . $zoneID . '/firewall/lockdowns', $options);
|
$user = $this->adapter->post('zones/' . $zoneID . '/firewall/lockdowns', $options);
|
||||||
|
|
||||||
$body = json_decode($user->getBody());
|
$this->body = json_decode($user->getBody());
|
||||||
|
|
||||||
if (isset($body->result->id)) {
|
if (isset($this->body->result->id)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,8 +72,8 @@ class ZoneLockdown implements API
|
|||||||
public function getLockdownDetails(string $zoneID, string $lockdownID): \stdClass
|
public function getLockdownDetails(string $zoneID, string $lockdownID): \stdClass
|
||||||
{
|
{
|
||||||
$user = $this->adapter->get('zones/' . $zoneID . '/firewall/lockdowns/' . $lockdownID);
|
$user = $this->adapter->get('zones/' . $zoneID . '/firewall/lockdowns/' . $lockdownID);
|
||||||
$body = json_decode($user->getBody());
|
$this->body = json_decode($user->getBody());
|
||||||
return $body->result;
|
return $this->body->result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updateLockdown(
|
public function updateLockdown(
|
||||||
@@ -92,9 +95,9 @@ class ZoneLockdown implements API
|
|||||||
|
|
||||||
$user = $this->adapter->put('zones/' . $zoneID . '/firewall/lockdowns/' . $lockdownID, $options);
|
$user = $this->adapter->put('zones/' . $zoneID . '/firewall/lockdowns/' . $lockdownID, $options);
|
||||||
|
|
||||||
$body = json_decode($user->getBody());
|
$this->body = json_decode($user->getBody());
|
||||||
|
|
||||||
if (isset($body->result->id)) {
|
if (isset($this->body->result->id)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,9 +108,9 @@ class ZoneLockdown implements API
|
|||||||
{
|
{
|
||||||
$user = $this->adapter->delete('zones/' . $zoneID . '/firewall/lockdowns/' . $lockdownID);
|
$user = $this->adapter->delete('zones/' . $zoneID . '/firewall/lockdowns/' . $lockdownID);
|
||||||
|
|
||||||
$body = json_decode($user->getBody());
|
$this->body = json_decode($user->getBody());
|
||||||
|
|
||||||
if (isset($body->result->id)) {
|
if (isset($this->body->result->id)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ class UARulesTest extends TestCase
|
|||||||
|
|
||||||
$this->assertEquals('372e67954025e0ba6aaa6d586b9e0b59', $result->result[0]->id);
|
$this->assertEquals('372e67954025e0ba6aaa6d586b9e0b59', $result->result[0]->id);
|
||||||
$this->assertEquals(1, $result->result_info->page);
|
$this->assertEquals(1, $result->result_info->page);
|
||||||
|
$this->assertEquals('372e67954025e0ba6aaa6d586b9e0b59', $zones->getBody()->result[0]->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCreateRule()
|
public function testCreateRule()
|
||||||
@@ -65,6 +66,7 @@ class UARulesTest extends TestCase
|
|||||||
'372e67954025e0ba6aaa6d586b9e0b59',
|
'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'
|
||||||
);
|
);
|
||||||
|
$this->assertEquals('372e67954025e0ba6aaa6d586b9e0b59', $rules->getBody()->result->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getRuleDetails()
|
public function getRuleDetails()
|
||||||
@@ -84,6 +86,7 @@ class UARulesTest extends TestCase
|
|||||||
$result = $lockdown->getRuleDetails('023e105f4ecef8ad9ca31a8372d0c353', '372e67954025e0ba6aaa6d586b9e0b59');
|
$result = $lockdown->getRuleDetails('023e105f4ecef8ad9ca31a8372d0c353', '372e67954025e0ba6aaa6d586b9e0b59');
|
||||||
|
|
||||||
$this->assertEquals('372e67954025e0ba6aaa6d586b9e0b59', $result->id);
|
$this->assertEquals('372e67954025e0ba6aaa6d586b9e0b59', $result->id);
|
||||||
|
$this->assertEquals('372e67954025e0ba6aaa6d586b9e0b59', $rules->getBody()->result->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testUpdateRule()
|
public function testUpdateRule()
|
||||||
@@ -116,6 +119,7 @@ class UARulesTest extends TestCase
|
|||||||
$config,
|
$config,
|
||||||
'Restrict access to these endpoints to requests from a known IP address'
|
'Restrict access to these endpoints to requests from a known IP address'
|
||||||
);
|
);
|
||||||
|
$this->assertEquals('372e67954025e0ba6aaa6d586b9e0b59', $rules->getBody()->result->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDeleteRule()
|
public function testDeleteRule()
|
||||||
@@ -133,5 +137,6 @@ class UARulesTest extends TestCase
|
|||||||
|
|
||||||
$rules = new \Cloudflare\API\Endpoints\UARules($mock);
|
$rules = new \Cloudflare\API\Endpoints\UARules($mock);
|
||||||
$rules->deleteRule('023e105f4ecef8ad9ca31a8372d0c353', '372e67954025e0ba6aaa6d586b9e0b59');
|
$rules->deleteRule('023e105f4ecef8ad9ca31a8372d0c353', '372e67954025e0ba6aaa6d586b9e0b59');
|
||||||
|
$this->assertEquals('372e67954025e0ba6aaa6d586b9e0b59', $rules->getBody()->result->id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ class UserTest extends TestCase
|
|||||||
$this->assertEquals('7c5dae5552338874e5053f2534d2767a', $details->id);
|
$this->assertEquals('7c5dae5552338874e5053f2534d2767a', $details->id);
|
||||||
$this->assertObjectHasAttribute('email', $details);
|
$this->assertObjectHasAttribute('email', $details);
|
||||||
$this->assertEquals('user@example.com', $details->email);
|
$this->assertEquals('user@example.com', $details->email);
|
||||||
|
$this->assertEquals('7c5dae5552338874e5053f2534d2767a', $user->getBody()->result->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetUserID()
|
public function testGetUserID()
|
||||||
@@ -32,6 +33,7 @@ class UserTest extends TestCase
|
|||||||
|
|
||||||
$user = new \Cloudflare\API\Endpoints\User($mock);
|
$user = new \Cloudflare\API\Endpoints\User($mock);
|
||||||
$this->assertEquals('7c5dae5552338874e5053f2534d2767a', $user->getUserID());
|
$this->assertEquals('7c5dae5552338874e5053f2534d2767a', $user->getUserID());
|
||||||
|
$this->assertEquals('7c5dae5552338874e5053f2534d2767a', $user->getBody()->result->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetUserEmail()
|
public function testGetUserEmail()
|
||||||
@@ -45,6 +47,7 @@ class UserTest extends TestCase
|
|||||||
|
|
||||||
$user = new \Cloudflare\API\Endpoints\User($mock);
|
$user = new \Cloudflare\API\Endpoints\User($mock);
|
||||||
$this->assertEquals('user@example.com', $user->getUserEmail());
|
$this->assertEquals('user@example.com', $user->getUserEmail());
|
||||||
|
$this->assertEquals('user@example.com', $user->getBody()->result->email);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testUpdateUserDetails()
|
public function testUpdateUserDetails()
|
||||||
@@ -60,5 +63,6 @@ class UserTest extends TestCase
|
|||||||
|
|
||||||
$user = new \Cloudflare\API\Endpoints\User($mock);
|
$user = new \Cloudflare\API\Endpoints\User($mock);
|
||||||
$user->updateUserDetails(['email' => 'user2@example.com']);
|
$user->updateUserDetails(['email' => 'user2@example.com']);
|
||||||
|
$this->assertEquals('7c5dae5552338874e5053f2534d2767a', $user->getBody()->result->id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ class WAFTest extends TestCase
|
|||||||
|
|
||||||
$this->assertEquals('a25a9a7e9c00afc1fb2e0245519d725b', $result->result[0]->id);
|
$this->assertEquals('a25a9a7e9c00afc1fb2e0245519d725b', $result->result[0]->id);
|
||||||
$this->assertEquals(1, $result->result_info->page);
|
$this->assertEquals(1, $result->result_info->page);
|
||||||
|
$this->assertEquals('a25a9a7e9c00afc1fb2e0245519d725b', $waf->getBody()->result[0]->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testgetPackageInfo()
|
public function testgetPackageInfo()
|
||||||
@@ -55,6 +56,7 @@ class WAFTest extends TestCase
|
|||||||
$result = $waf->getPackageInfo('023e105f4ecef8ad9ca31a8372d0c353', 'a25a9a7e9c00afc1fb2e0245519d725b');
|
$result = $waf->getPackageInfo('023e105f4ecef8ad9ca31a8372d0c353', 'a25a9a7e9c00afc1fb2e0245519d725b');
|
||||||
|
|
||||||
$this->assertEquals('a25a9a7e9c00afc1fb2e0245519d725b', $result->id);
|
$this->assertEquals('a25a9a7e9c00afc1fb2e0245519d725b', $result->id);
|
||||||
|
$this->assertEquals('a25a9a7e9c00afc1fb2e0245519d725b', $waf->getBody()->result->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testgetRules()
|
public function testgetRules()
|
||||||
@@ -85,6 +87,7 @@ class WAFTest extends TestCase
|
|||||||
|
|
||||||
$this->assertEquals('92f17202ed8bd63d69a66b86a49a8f6b', $result->result[0]->id);
|
$this->assertEquals('92f17202ed8bd63d69a66b86a49a8f6b', $result->result[0]->id);
|
||||||
$this->assertEquals(1, $result->result_info->page);
|
$this->assertEquals(1, $result->result_info->page);
|
||||||
|
$this->assertEquals('92f17202ed8bd63d69a66b86a49a8f6b', $waf->getBody()->result[0]->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testgetRuleInfo()
|
public function testgetRuleInfo()
|
||||||
@@ -104,6 +107,7 @@ class WAFTest extends TestCase
|
|||||||
$result = $waf->getRuleInfo('023e105f4ecef8ad9ca31a8372d0c353', 'a25a9a7e9c00afc1fb2e0245519d725b', 'f939de3be84e66e757adcdcb87908023');
|
$result = $waf->getRuleInfo('023e105f4ecef8ad9ca31a8372d0c353', 'a25a9a7e9c00afc1fb2e0245519d725b', 'f939de3be84e66e757adcdcb87908023');
|
||||||
|
|
||||||
$this->assertEquals('f939de3be84e66e757adcdcb87908023', $result->id);
|
$this->assertEquals('f939de3be84e66e757adcdcb87908023', $result->id);
|
||||||
|
$this->assertEquals('f939de3be84e66e757adcdcb87908023', $waf->getBody()->result->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testupdateRule()
|
public function testupdateRule()
|
||||||
@@ -132,6 +136,7 @@ class WAFTest extends TestCase
|
|||||||
foreach ($details as $property => $value) {
|
foreach ($details as $property => $value) {
|
||||||
$this->assertEquals($result->{ $property }, $value);
|
$this->assertEquals($result->{ $property }, $value);
|
||||||
}
|
}
|
||||||
|
$this->assertEquals('f939de3be84e66e757adcdcb87908023', $waf->getBody()->result->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getGroups()
|
public function getGroups()
|
||||||
@@ -162,6 +167,7 @@ class WAFTest extends TestCase
|
|||||||
|
|
||||||
$this->assertEquals('de677e5818985db1285d0e80225f06e5', $result->result[0]->id);
|
$this->assertEquals('de677e5818985db1285d0e80225f06e5', $result->result[0]->id);
|
||||||
$this->assertEquals(1, $result->result_info->page);
|
$this->assertEquals(1, $result->result_info->page);
|
||||||
|
$this->assertEquals('de677e5818985db1285d0e80225f06e5', $waf->getBody()->result[0]->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testgetGroupInfo()
|
public function testgetGroupInfo()
|
||||||
@@ -181,6 +187,7 @@ class WAFTest extends TestCase
|
|||||||
$result = $waf->getGroupInfo('023e105f4ecef8ad9ca31a8372d0c353', 'a25a9a7e9c00afc1fb2e0245519d725b', 'de677e5818985db1285d0e80225f06e5');
|
$result = $waf->getGroupInfo('023e105f4ecef8ad9ca31a8372d0c353', 'a25a9a7e9c00afc1fb2e0245519d725b', 'de677e5818985db1285d0e80225f06e5');
|
||||||
|
|
||||||
$this->assertEquals('de677e5818985db1285d0e80225f06e5', $result->id);
|
$this->assertEquals('de677e5818985db1285d0e80225f06e5', $result->id);
|
||||||
|
$this->assertEquals('de677e5818985db1285d0e80225f06e5', $waf->getBody()->result->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testupdateGroup()
|
public function testupdateGroup()
|
||||||
@@ -209,5 +216,6 @@ class WAFTest extends TestCase
|
|||||||
foreach ($details as $property => $value) {
|
foreach ($details as $property => $value) {
|
||||||
$this->assertEquals($result->{ $property }, $value);
|
$this->assertEquals($result->{ $property }, $value);
|
||||||
}
|
}
|
||||||
|
$this->assertEquals('de677e5818985db1285d0e80225f06e5', $waf->getBody()->result->id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ class ZoneLockdownTest extends TestCase
|
|||||||
|
|
||||||
$this->assertEquals('372e67954025e0ba6aaa6d586b9e0b59', $result->result[0]->id);
|
$this->assertEquals('372e67954025e0ba6aaa6d586b9e0b59', $result->result[0]->id);
|
||||||
$this->assertEquals(1, $result->result_info->page);
|
$this->assertEquals(1, $result->result_info->page);
|
||||||
|
$this->assertEquals('372e67954025e0ba6aaa6d586b9e0b59', $zones->getBody()->result[0]->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testAddLockdown()
|
public function testAddLockdown()
|
||||||
@@ -65,6 +66,7 @@ class ZoneLockdownTest extends TestCase
|
|||||||
'372e67954025e0ba6aaa6d586b9e0b59',
|
'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'
|
||||||
);
|
);
|
||||||
|
$this->assertEquals('372e67954025e0ba6aaa6d586b9e0b59', $zoneLockdown->getBody()->result->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetRecordDetails()
|
public function testGetRecordDetails()
|
||||||
@@ -84,6 +86,7 @@ class ZoneLockdownTest extends TestCase
|
|||||||
$result = $lockdown->getLockdownDetails('023e105f4ecef8ad9ca31a8372d0c353', '372e67954025e0ba6aaa6d586b9e0b59');
|
$result = $lockdown->getLockdownDetails('023e105f4ecef8ad9ca31a8372d0c353', '372e67954025e0ba6aaa6d586b9e0b59');
|
||||||
|
|
||||||
$this->assertEquals('372e67954025e0ba6aaa6d586b9e0b59', $result->id);
|
$this->assertEquals('372e67954025e0ba6aaa6d586b9e0b59', $result->id);
|
||||||
|
$this->assertEquals('372e67954025e0ba6aaa6d586b9e0b59', $lockdown->getBody()->result->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testUpdateLockdown()
|
public function testUpdateLockdown()
|
||||||
@@ -116,6 +119,7 @@ class ZoneLockdownTest extends TestCase
|
|||||||
$config,
|
$config,
|
||||||
'Restrict access to these endpoints to requests from a known IP address'
|
'Restrict access to these endpoints to requests from a known IP address'
|
||||||
);
|
);
|
||||||
|
$this->assertEquals('372e67954025e0ba6aaa6d586b9e0b59', $zoneLockdown->getBody()->result->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDeleteLockdown()
|
public function testDeleteLockdown()
|
||||||
@@ -136,5 +140,6 @@ class ZoneLockdownTest extends TestCase
|
|||||||
|
|
||||||
$zoneLockdown = new \Cloudflare\API\Endpoints\ZoneLockdown($mock);
|
$zoneLockdown = new \Cloudflare\API\Endpoints\ZoneLockdown($mock);
|
||||||
$zoneLockdown->deleteLockdown('023e105f4ecef8ad9ca31a8372d0c353', '372e67954025e0ba6aaa6d586b9e0b59');
|
$zoneLockdown->deleteLockdown('023e105f4ecef8ad9ca31a8372d0c353', '372e67954025e0ba6aaa6d586b9e0b59');
|
||||||
|
$this->assertEquals('372e67954025e0ba6aaa6d586b9e0b59', $zoneLockdown->getBody()->result->id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user