@@ 24-38 (lines=15) @@ | ||
21 | self::assertSame(self::EXPECTED_BKP, $crypto->getBkpCode($pkpCode)); |
|
22 | } |
|
23 | ||
24 | public function testExceptions() |
|
25 | { |
|
26 | $cryptoService = new CryptographyService( |
|
27 | __DIR__ . '/invalid-certificate.pem', |
|
28 | __DIR__ . '/invalid-certificate.pem' |
|
29 | ); |
|
30 | ||
31 | try { |
|
32 | $cryptoService->getPkpCode($this->getReceiptData()); |
|
33 | $this->fail(); |
|
34 | ||
35 | } catch (PrivateKeyFileException $e) { |
|
36 | $this->assertSame(__DIR__ . '/invalid-certificate.pem', $e->getPrivateKeyFile()); |
|
37 | } |
|
38 | } |
|
39 | ||
40 | /** |
|
41 | * @runInSeparateProcess |
|
@@ 43-59 (lines=17) @@ | ||
40 | /** |
|
41 | * @runInSeparateProcess |
|
42 | */ |
|
43 | public function testExceptions2() |
|
44 | { |
|
45 | include __DIR__ . '/OpenSslFunctionsMock.php'; |
|
46 | ||
47 | $cryptoService = new CryptographyService( |
|
48 | __DIR__ . '/../../../cert/EET_CA1_Playground-CZ00000019.key', |
|
49 | __DIR__ . '/../../../cert/EET_CA1_Playground-CZ00000019.pub' |
|
50 | ); |
|
51 | ||
52 | try { |
|
53 | $cryptoService->getPkpCode($this->getReceiptData()); |
|
54 | $this->fail(); |
|
55 | ||
56 | } catch (SigningFailedException $e) { |
|
57 | $this->assertSame(array_values($this->getReceiptData()), $e->getData()); |
|
58 | } |
|
59 | } |
|
60 | ||
61 | private function getReceiptData():array |
|
62 | { |