diff --git a/src/Auth/None.php b/src/Auth/None.php new file mode 100644 index 0000000..aa203e3 --- /dev/null +++ b/src/Auth/None.php @@ -0,0 +1,18 @@ +adapter = $adapter; + } + + public function get(): \stdClass { + $ips = $this->adapter->get('ips', []); + $body = json_decode($ips->getBody()); + + return $body->result; + } + +} \ No newline at end of file diff --git a/tests/Endpoints/PageRules.php b/src/Endpoints/PageRules.php similarity index 100% rename from tests/Endpoints/PageRules.php rename to src/Endpoints/PageRules.php diff --git a/tests/Auth/NoneTest.php b/tests/Auth/NoneTest.php new file mode 100644 index 0000000..7fcc81f --- /dev/null +++ b/tests/Auth/NoneTest.php @@ -0,0 +1,20 @@ +getHeaders(); + + $this->assertEquals([], $headers); + } +} diff --git a/tests/Endpoints/IPsTest.php b/tests/Endpoints/IPsTest.php new file mode 100644 index 0000000..35726f4 --- /dev/null +++ b/tests/Endpoints/IPsTest.php @@ -0,0 +1,42 @@ + 'application/json'], $stream); + $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock->method('get')->willReturn($response); + + $mock->expects($this->once()) + ->method('get') + ->with($this->equalTo('ips'), $this->equalTo([]) + ); + + $ips = new \Cloudflare\API\Endpoints\IPs($mock); + $ips = $ips->get(); + $this->assertObjectHasAttribute("ipv4_cidrs", $ips); + $this->assertObjectHasAttribute("ipv6_cidrs", $ips); + } +}