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,
24 lines
652 B
PHP
24 lines
652 B
PHP
<?php
|
|
|
|
/**
|
|
* User: junade
|
|
* Date: 13/01/2017
|
|
* Time: 17:15
|
|
*/
|
|
class APIKeyTest extends TestCase
|
|
{
|
|
public function testGetHeaders()
|
|
{
|
|
$auth = new \Cloudflare\API\Auth\APIKey('example@example.com', '1234567893feefc5f0q5000bfo0c38d90bbeb');
|
|
$headers = $auth->getHeaders();
|
|
|
|
$this->assertArrayHasKey('X-Auth-Key', $headers);
|
|
$this->assertArrayHasKey('X-Auth-Email', $headers);
|
|
|
|
$this->assertEquals('example@example.com', $headers['X-Auth-Email']);
|
|
$this->assertEquals('1234567893feefc5f0q5000bfo0c38d90bbeb', $headers['X-Auth-Key']);
|
|
|
|
$this->assertEquals(2, sizeof($headers));
|
|
}
|
|
}
|