CertificateTest.php 768 B

1234567891011121314151617181920212223
  1. <?php
  2. use PHPUnit\Framework\TestCase;
  3. use Cloudflare\API\Configurations\Certificate;
  4. class CertificateTest extends TestCase
  5. {
  6. public function testGetArray()
  7. {
  8. $certificate = new Certificate();
  9. $certificate->setHostnames(['foo.com', '*.bar.com']);
  10. $certificate->setRequestType(Certificate::ORIGIN_ECC);
  11. $certificate->setRequestedValidity(365);
  12. $certificate->setCsr('some-csr-encoded-text');
  13. $array = $certificate->getArray();
  14. $this->assertEquals(['foo.com', '*.bar.com'], $array['hostnames']);
  15. $this->assertEquals('origin-ecc', $array['request_type']);
  16. $this->assertEquals(365, $array['requested_validity']);
  17. $this->assertEquals('some-csr-encoded-text', $array['csr']);
  18. }
  19. }