Conditions | 1 |
Paths | 1 |
Total Lines | 22 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
18 | public function testCanUseCryptoKeysFromConfig() |
||
19 | { |
||
20 | $config = m::mock(ConfigHelper::class)->makePartial(); |
||
21 | $config->shouldReceive('get') |
||
|
|||
22 | // ->with('private_key', null) |
||
23 | ->andReturn('-----BEGIN RSA PRIVATE KEY-----\nconfig\n-----END RSA PRIVATE KEY-----'); |
||
24 | |||
25 | $provider = new HelloServiceProvider(); |
||
26 | $provider->setContainer(new Container()); |
||
27 | |||
28 | ConfigHelper::setConfig($config); |
||
29 | |||
30 | // Call protected makeCryptKey method |
||
31 | $cryptKey = (function () { |
||
32 | return $this->makeCryptKey('private'); |
||
33 | })->call($provider); |
||
34 | |||
35 | static::assertSame( |
||
36 | "-----BEGIN RSA PRIVATE KEY-----\nconfig\n-----END RSA PRIVATE KEY-----", |
||
37 | file_get_contents($cryptKey->getKeyPath()) |
||
38 | ); |
||
39 | } |
||
40 | } |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: