This PR moves the JSON API responses used in the tests to fixture files within the tests folder. This allows reuse and the ability to lint/validate these fixtures if required - although not covered in this PR. I've added TestCase::getPsr7StreamForFixture and TestCase::getPsr7JsonResponseForFixture to reduce code duplication and enable some assertions around the expected fixures/responses. Thanks,
23 lines
530 B
PHP
23 lines
530 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->assertEquals(1, sizeof($array));
|
|
$this->assertEquals("junade.com/*", $array[0]->constraint->value);
|
|
$this->assertEquals("matches", $array[0]->constraint->operator);
|
|
}
|
|
}
|