public function test exists asserts every file exists() { $dummySuccess = rand(0, 1) === 1; $this->mockFilesystem->exists([$this->dummyStoragePath . '/public.pem', $this->dummyStoragePath . '/private.pem'])->willReturn($dummySuccess); $result = $this->service->exists(); $this->assertSame($dummySuccess, $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(); }
/** * Returns whether or not a keyPair exists. * * @return bool */ public function hasKeyPair() { return $this->storage->exists(); }