35 lines
1.0 KiB
PHP
35 lines
1.0 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Created by PhpStorm.
|
|
* User: junade
|
|
* Date: 05/09/2017
|
|
* Time: 13:50
|
|
*/
|
|
class ConfigurationsZoneLockdownTest extends TestCase
|
|
{
|
|
public function testGetArray()
|
|
{
|
|
$configuration = new \Cloudflare\API\Configurations\ZoneLockdown();
|
|
$configuration->addIP('1.2.3.4');
|
|
|
|
$array = $configuration->getArray();
|
|
$this->assertEquals(1, count($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, count($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);
|
|
}
|
|
}
|