COM-40 :: Add ZoneLockdown and UA Rules
This commit is contained in:
34
tests/Configurations/ZoneLockdownTest.php
Normal file
34
tests/Configurations/ZoneLockdownTest.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: junade
|
||||
* Date: 05/09/2017
|
||||
* Time: 13:50
|
||||
*/
|
||||
class ConfigurationZoneLockdownTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testGetArray()
|
||||
{
|
||||
$configuration = new \Cloudflare\API\Configurations\ZoneLockdown();
|
||||
$configuration->addIP('1.2.3.4');
|
||||
|
||||
$array = $configuration->getArray();
|
||||
$this->assertEquals(1, sizeof($array));
|
||||
|
||||
$this->assertObjectHasAttribute('target', $array[0]);
|
||||
$this->assertEquals('ip', $array[0]->target);
|
||||
$this->assertObjectHasAttribute('value', $array[0]);
|
||||
$this->assertEquals('1.2.3.4', $array[0]->value);
|
||||
|
||||
$configuration->addIPRange('1.2.3.4/24');
|
||||
|
||||
$array = $configuration->getArray();
|
||||
$this->assertEquals(2, sizeof($array));
|
||||
|
||||
$this->assertObjectHasAttribute('target', $array[1]);
|
||||
$this->assertEquals('ip_range', $array[1]->target);
|
||||
$this->assertObjectHasAttribute('value', $array[1]);
|
||||
$this->assertEquals('1.2.3.4/24', $array[1]->value);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user