@@ 48-61 (lines=14) @@ | ||
45 | /** |
|
46 | * @expectedException \UnexpectedValueException |
|
47 | */ |
|
48 | public function testLoadKeyThrowsExceptionBecauseKeyIsMissing() |
|
49 | { |
|
50 | $this->tempCryptoFile = __DIR__.'/../invalid_key.crypto'; |
|
51 | ||
52 | $handle = fopen($this->tempCryptoFile, 'w+'); |
|
53 | fwrite($handle, <<<'EOF' |
|
54 | secret=ThisIsASecret |
|
55 | EOF |
|
56 | ); |
|
57 | fclose($handle); |
|
58 | ||
59 | $loader = new CryptoLoader($this->tempCryptoFile); |
|
60 | $loader->loadKey(); |
|
61 | } |
|
62 | ||
63 | /** |
|
64 | * @expectedException \UnexpectedValueException |
|
@@ 66-79 (lines=14) @@ | ||
63 | /** |
|
64 | * @expectedException \UnexpectedValueException |
|
65 | */ |
|
66 | public function testLoadKeyThrowsExceptionBecauseSecretIsMissing() |
|
67 | { |
|
68 | $this->tempCryptoFile = __DIR__.'/../invalid_key.crypto'; |
|
69 | ||
70 | $handle = fopen($this->tempCryptoFile, 'w+'); |
|
71 | fwrite($handle, <<<'EOF' |
|
72 | key=ThisIsAnEncodedKey |
|
73 | EOF |
|
74 | ); |
|
75 | fclose($handle); |
|
76 | ||
77 | $loader = new CryptoLoader($this->tempCryptoFile); |
|
78 | $loader->loadSecret(); |
|
79 | } |
|
80 | ||
81 | public function testLoadSecretLoadsSecret() |
|
82 | { |
|
@@ 101-114 (lines=14) @@ | ||
98 | /** |
|
99 | * @expectedException \RuntimeException |
|
100 | */ |
|
101 | public function test__ConstructFailsBecauseResourceIsBadFormatted() |
|
102 | { |
|
103 | $this->tempCryptoFile = __DIR__.'/../invalid_key.crypto'; |
|
104 | ||
105 | $handle = fopen($this->tempCryptoFile, 'w+'); |
|
106 | fwrite($handle, <<<'EOF' |
|
107 | key:ThisIsAKey |
|
108 | secret:ThisIsASecret |
|
109 | EOF |
|
110 | ); |
|
111 | fclose($handle); |
|
112 | ||
113 | new CryptoLoader($this->tempCryptoFile); |
|
114 | } |
|
115 | ||
116 | protected function setUp() |
|
117 | { |