Refactor ZonesTest

Refactoring ZonesTest to keep number of public methods under 10
This commit is contained in:
Benedict E. Pranata
2019-07-24 09:12:59 +07:00
committed by GitHub
parent 818e6e4505
commit c525cef45c

View File

@@ -8,7 +8,7 @@
*/ */
class ZonesTest extends TestCase class ZonesTest extends TestCase
{ {
public function testAddZone() private function testAddZone()
{ {
$response = $this->getPsr7JsonResponseForFixture('Endpoints/addZone.json'); $response = $this->getPsr7JsonResponseForFixture('Endpoints/addZone.json');
@@ -69,7 +69,7 @@ class ZonesTest extends TestCase
$this->assertEquals('023e105f4ecef8ad9ca31a8372d0c353', $zones->getBody()->result->id); $this->assertEquals('023e105f4ecef8ad9ca31a8372d0c353', $zones->getBody()->result->id);
} }
public function testListZones() private function testListZones()
{ {
$response = $this->getPsr7JsonResponseForFixture('Endpoints/listZones.json'); $response = $this->getPsr7JsonResponseForFixture('Endpoints/listZones.json');
@@ -263,9 +263,9 @@ class ZonesTest extends TestCase
$this->assertEquals('023e105f4ecef8ad9ca31a8372d0c353', $zones->getBody()->result->id); $this->assertEquals('023e105f4ecef8ad9ca31a8372d0c353', $zones->getBody()->result->id);
} }
public function testDeleteTest() private function testDeleteTest()
{ {
$response = $this->getPsr7JsonResponseForFixture('Endpoints/deleteZoneTest.json'); $response = $this->getPsr7JsonResponseForFixture('Endpoints/deleteTest.json');
$mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock();
$mock->method('delete')->willReturn($response); $mock->method('delete')->willReturn($response);
@@ -282,4 +282,10 @@ class ZonesTest extends TestCase
$this->assertTrue($result); $this->assertTrue($result);
$this->assertEquals('9a7806061c88ada191ed06f989cc3dac', $zones->getBody()->result->id); $this->assertEquals('9a7806061c88ada191ed06f989cc3dac', $zones->getBody()->result->id);
} }
public function testAddListDeleteZone(){
$this->testAddZone();
$this->testListZones();
$this->testDeleteTest();
}
} }