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.
23 lines
529 B
PHP
23 lines
529 B
PHP
<?php
|
|
/**
|
|
* Created by PhpStorm.
|
|
* User: junade
|
|
* Date: 19/09/2017
|
|
* Time: 18:41
|
|
*/
|
|
|
|
use Cloudflare\API\Configurations\PageRulesTargets;
|
|
|
|
class PageRulesTargetTest extends TestCase
|
|
{
|
|
public function testGetArray()
|
|
{
|
|
$targets = new PageRulesTargets('junade.com/*');
|
|
$array = $targets->getArray();
|
|
|
|
$this->assertCount(1, $array);
|
|
$this->assertEquals('junade.com/*', $array[0]['constraint']['value']);
|
|
$this->assertEquals('matches', $array[0]['constraint']['operator']);
|
|
}
|
|
}
|