ConfigurationsZoneLockdownTest.php 995 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: junade
  5. * Date: 05/09/2017
  6. * Time: 13:50
  7. */
  8. class ConfigurationsZoneLockdownTest extends TestCase
  9. {
  10. public function testGetArray()
  11. {
  12. $configuration = new \Cloudflare\API\Configurations\ZoneLockdown();
  13. $configuration->addIP('1.2.3.4');
  14. $array = $configuration->getArray();
  15. $this->assertCount(1, $array);
  16. $this->assertArrayHasKey('target', $array[0]);
  17. $this->assertEquals('ip', $array[0]['target']);
  18. $this->assertArrayHasKey('value', $array[0]);
  19. $this->assertEquals('1.2.3.4', $array[0]['value']);
  20. $configuration->addIPRange('1.2.3.4/24');
  21. $array = $configuration->getArray();
  22. $this->assertCount(2, $array);
  23. $this->assertArrayHasKey('target', $array[1]);
  24. $this->assertEquals('ip_range', $array[1]['target']);
  25. $this->assertArrayHasKey('value', $array[1]);
  26. $this->assertEquals('1.2.3.4/24', $array[1]['value']);
  27. }
  28. }