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 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(); }
/** * Gets the existing keyPair. * * @return KeyPair */ public function getKeyPair() { return $this->storage->load(); }