public function test createAcmeClient use CA configuration() { $keyPair = $this->prophesize(KeyPair::class)->reveal(); $this->mockCA->getBaseUri()->shouldBeCalled(); $this->mockCA->getAgreement()->shouldBeCalled(); $client = $this->service->createAcmeClient($keyPair); $this->assertInstanceOf(AcmeClient::class, $client); }
public function test format returns the formatted certificate() { $dummyChainPem1 = uniqid(); $dummyChainPem2 = uniqid(); $dummyCertificate = $this->prophesize(Certificate::class)->reveal(); $dummyKeyPair = $this->prophesize(KeyPair::class)->reveal(); $this->mockCertificateAuthorityConfiguration->getCertificatesChain()->willReturn([$dummyChainPem1, $dummyChainPem2]); $this->assertSame($dummyChainPem1 . $dummyChainPem2, $this->service->format($dummyCertificate, $dummyKeyPair)); }
public function test format returns the formatted certificate() { $dummyCertificatePem = uniqid(); $dummyPrivatePem = uniqid(); $dummyChainPem1 = uniqid(); $dummyChainPem2 = uniqid(); $mockCertificate = $this->prophesize(Certificate::class); $mockKeyPair = $this->prophesize(KeyPair::class); $mockCertificate->getPem()->willReturn($dummyCertificatePem); $mockKeyPair->getPrivateKeyAsPEM()->willReturn($dummyPrivatePem); $this->mockCertificateAuthorityConfiguration->getCertificatesChain()->willReturn([$dummyChainPem1, $dummyChainPem2]); $this->assertSame($dummyCertificatePem . $dummyChainPem1 . $dummyChainPem2 . $dummyPrivatePem, $this->service->format($mockCertificate->reveal(), $mockKeyPair->reveal())); }
/** * {@inheritdoc} */ public function format(Certificate $certificate, KeyPair $domainKeyPair) { return implode('', $this->certificateAuthorityConfiguration->getCertificatesChain()); }
/** * Create a new instance of AcmeClient for the given account KeyPair. * * @param KeyPair $keyPair * * @return AcmeClient */ public function createAcmeClient(KeyPair $keyPair) { return new AcmeClient($this->certificateAuthority->getBaseUri(), $this->certificateAuthority->getAgreement(), $keyPair, $this->logger); }
/** * {@inheritdoc} */ public function format(Certificate $certificate, KeyPair $domainKeyPair) { return $certificate->getPem() . implode('', $this->certificateAuthorityConfiguration->getCertificatesChain()) . $domainKeyPair->getPrivateKeyAsPEM(); }