public function test format returns the formatted certificate()
 {
     $dummyPem = uniqid();
     $mockCertificate = $this->prophesize(Certificate::class);
     $dummyKeyPair = $this->prophesize(KeyPair::class)->reveal();
     $mockCertificate->getPem()->willReturn($dummyPem);
     $this->assertSame($dummyPem, $this->service->format($mockCertificate->reveal(), $dummyKeyPair));
 }
 public function test hasCertificate checks if files exists()
 {
     $dummyDomain = uniqid();
     $dummyCsr = $this->prophesize(CSR::class)->reveal();
     $dummyCertificateFileName = uniqid();
     $dummyExtraFileName = uniqid();
     $configuration = new DomainConfiguration($dummyDomain, $dummyCsr);
     $mockStorage = $this->prophesize(CertificateStorage::class);
     $this->mockStorageFactory->createCertificateStorage($dummyDomain)->willReturn($mockStorage->reveal());
     $this->mockCertificateFormatter->getName()->willReturn($dummyCertificateFileName);
     $this->mockCertificateFormatter->format()->shouldNotBeCalled();
     $this->mockExtraFormatter->getName()->willReturn($dummyExtraFileName);
     $this->mockExtraFormatter->format()->shouldNotBeCalled();
     $mockStorage->hasCertificateFile($dummyCertificateFileName)->shouldBeCalled()->willReturn(true);
     $mockStorage->hasCertificateFile($dummyExtraFileName)->shouldBeCalled()->willReturn(true);
     $result = $this->service->hasCertificate($configuration);
     $this->assertTrue($result);
 }