public function setUp()
 {
     parent::setUp();
     $this->mockManager = $this->prophesize(KeyPairManager::class);
     $this->mockStorageFactory = $this->prophesize(DomainKeyPairStorageFactory::class);
     $this->service = new DomainKeyPairProviderFactory($this->mockManager->reveal(), $this->mockStorageFactory->reveal());
 }
Exemplo n.º 2
0
 public function test load use the KeyPairManager to load the stored certificates()
 {
     $dummyKeyPair = uniqid();
     $this->mockKeyPairManager->loadKeyPair($this->dummyStoragePath . '/public.pem', $this->dummyStoragePath . '/private.pem')->shouldBeCalled()->willReturn($dummyKeyPair);
     $result = $this->service->load();
     $this->assertSame($dummyKeyPair, $result);
 }
 public function setUp()
 {
     parent::setUp();
     $this->mockFilesystem = $this->prophesize(Filesystem::class);
     $this->mockKeyPairManager = $this->prophesize(KeyPairManager::class);
     $this->dummyStoragePath = uniqid();
     $this->service = new DomainKeyPairStorageFactory($this->mockFilesystem->reveal(), $this->mockKeyPairManager->reveal(), $this->dummyStoragePath);
 }
 public function test getOrCreateKeyPair does not creates a KeyPair when it exists()
 {
     $dummyKeyPair = $this->prophesize(KeyPair::class)->reveal();
     $this->mockStorage->exists()->willReturn(true);
     $this->mockManager->generateKeyPair()->shouldNotBeCalled();
     $this->mockStorage->load()->shouldBeCalled()->willReturn($dummyKeyPair);
     $this->service->getOrCreateKeyPair();
 }
 public function setUp()
 {
     parent::setUp();
     $this->mockManager = $this->prophesize(KeyPairManager::class);
     $this->mockStorage = $this->prophesize(KeyPairStorage::class);
     $this->mockClientFactory = $this->prophesize(ClientFactory::class);
     $this->dummyContactEmail = sprintf('*****@*****.**', uniqid());
     $this->service = new AccountKeyPairProvider($this->mockManager->reveal(), $this->mockStorage->reveal(), $this->mockClientFactory->reveal(), $this->dummyContactEmail);
 }
Exemplo n.º 6
0
 /**
  * Creates a new keyPair.
  */
 public function createKeyPair()
 {
     $this->logger->info('Generating new KeyPair in {storageLocation}', ['storageLocation' => $this->storage->getRootPath()]);
     $this->storeKeyPair($this->manager->generateKeyPair());
 }
Exemplo n.º 7
0
 /**
  * Retrieves the stored KeyPair.
  *
  * @return KeyPair
  */
 public function load()
 {
     return $this->keyPairManager->loadKeyPair($this->getPublicFilePath(), $this->getPrivateFilePath());
 }