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()); }
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); }
/** * Creates a new keyPair. */ public function createKeyPair() { $this->logger->info('Generating new KeyPair in {storageLocation}', ['storageLocation' => $this->storage->getRootPath()]); $this->storeKeyPair($this->manager->generateKeyPair()); }
/** * Retrieves the stored KeyPair. * * @return KeyPair */ public function load() { return $this->keyPairManager->loadKeyPair($this->getPublicFilePath(), $this->getPrivateFilePath()); }