Create ZoneDeleteTest.php

This commit is contained in:
Benedict E. Pranata
2019-07-24 09:22:27 +07:00
committed by GitHub
parent 4cb9eb228e
commit 274517553c

View File

@@ -0,0 +1,19 @@
<?php
class ZoneDeleteTest extends TestCase
{
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);
}
}