* Added Certificate endpoint * Implement all calls in /certificates endpoint * Added to travis more php versions * Fix package compatibility * Added CertificateTest * Added test for Certificate endpoint * Added more tests * Updated README Co-authored-by: haphan <thanhha.phan@myrepublic.net>
23 lines
768 B
PHP
23 lines
768 B
PHP
<?php
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
use Cloudflare\API\Configurations\Certificate;
|
|
|
|
class CertificateTest extends TestCase
|
|
{
|
|
public function testGetArray()
|
|
{
|
|
$certificate = new Certificate();
|
|
$certificate->setHostnames(['foo.com', '*.bar.com']);
|
|
$certificate->setRequestType(Certificate::ORIGIN_ECC);
|
|
$certificate->setRequestedValidity(365);
|
|
$certificate->setCsr('some-csr-encoded-text');
|
|
|
|
$array = $certificate->getArray();
|
|
$this->assertEquals(['foo.com', '*.bar.com'], $array['hostnames']);
|
|
$this->assertEquals('origin-ecc', $array['request_type']);
|
|
$this->assertEquals(365, $array['requested_validity']);
|
|
$this->assertEquals('some-csr-encoded-text', $array['csr']);
|
|
}
|
|
}
|