| Conditions | 1 |
| Paths | 1 |
| Total Lines | 20 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 3 | ||
| Bugs | 2 | Features | 1 |
| 1 | <?php |
||
| 17 | public function testCanUseCryptoKeysFromConfig() |
||
| 18 | { |
||
| 19 | $config = m::mock(ConfigHelper::class)->makePartial(); |
||
| 20 | $config->shouldReceive('get') |
||
| 21 | // ->with('private_key', null) |
||
| 22 | ->andReturn('-----BEGIN RSA PRIVATE KEY-----\nconfig\n-----END RSA PRIVATE KEY-----'); |
||
| 23 | |||
| 24 | $provider = new HelloServiceProvider(); |
||
| 25 | $provider->setContainer(new Container()); |
||
| 26 | |||
| 27 | ConfigHelper::setConfig($config); |
||
|
|
|||
| 28 | |||
| 29 | // Call protected makeCryptKey method |
||
| 30 | $cryptKey = (function () { |
||
| 31 | return $this->makeCryptKey('private'); |
||
| 32 | })->call($provider); |
||
| 33 | |||
| 34 | static::assertSame( |
||
| 35 | "-----BEGIN RSA PRIVATE KEY-----\nconfig\n-----END RSA PRIVATE KEY-----", |
||
| 36 | file_get_contents($cryptKey->getKeyPath()) |
||
| 37 | ); |
||
| 40 |