Files
cloudflare-php/tests/Endpoints/IPsTest.php
Darin Randal cca073c809 Code cleanup / Quality of Life updates
Adapter::get, post, put, patch and delete all had non-optional parameters for $headers and $query or $body. These have been made optional. I also re-ordered the parameters as $headers was never used while $query/$body were heavily used. I also condensed and removed some duplicate calls so that every call to Adapter::get/post sends that call to Adapter::request. It could use a magic method to do this but it might make it more difficult to test.
2018-04-12 23:11:04 -04:00

30 lines
751 B
PHP

<?php
/**
* Created by PhpStorm.
* User: junade
* Date: 04/09/2017
* Time: 20:16
*/
class IPsTest extends TestCase
{
public function testListIPs()
{
$response = $this->getPsr7JsonResponseForFixture('Endpoints/listIPs.json');
$mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock();
$mock->method('get')->willReturn($response);
$mock->expects($this->once())
->method('get')
->with(
$this->equalTo('ips')
);
$ips = new \Cloudflare\API\Endpoints\IPs($mock);
$ips = $ips->listIPs();
$this->assertObjectHasAttribute('ipv4_cidrs', $ips);
$this->assertObjectHasAttribute('ipv6_cidrs', $ips);
}
}