From cb24d2c77fced76849778d29667d9ae7acb38e97 Mon Sep 17 00:00:00 2001 From: "Benedict E. Pranata" Date: Tue, 23 Jul 2019 13:42:06 +0700 Subject: [PATCH] Add deleteZone test --- tests/Endpoints/ZonesTest.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/Endpoints/ZonesTest.php b/tests/Endpoints/ZonesTest.php index f6b75fc..7db28ea 100644 --- a/tests/Endpoints/ZonesTest.php +++ b/tests/Endpoints/ZonesTest.php @@ -262,4 +262,24 @@ class ZonesTest extends TestCase $this->assertTrue($result); $this->assertEquals('023e105f4ecef8ad9ca31a8372d0c353', $zones->getBody()->result->id); } + + public function testDeleteTest() + { + $response = $this->getPsr7JsonResponseForFixture('Endpoints/deleteTest.json'); + + $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); + $mock->method('delete')->willReturn($response); + + $mock->expects($this->once()) + ->method('delete') + ->with( + $this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353') + ); + + $zones = new \Cloudflare\API\Endpoints\Zones($mock); + $result = $zones->deleteZone('023e105f4ecef8ad9ca31a8372d0c353'); + + $this->assertTrue($result); + $this->assertEquals('9a7806061c88ada191ed06f989cc3dac', $zones->getBody()->result->id); + } }