|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace ProxyManagerTest\Inflector\Util; |
|
6
|
|
|
|
|
7
|
|
|
use PHPUnit\Framework\TestCase; |
|
8
|
|
|
use ProxyManager\Inflector\Util\ParameterHasher; |
|
9
|
|
|
|
|
10
|
|
|
/** |
|
11
|
|
|
* Tests for {@see \ProxyManager\Inflector\Util\ParameterHasher} |
|
12
|
|
|
* |
|
13
|
|
|
* @group Coverage |
|
14
|
|
|
*/ |
|
15
|
|
|
final class ParameterHasherTest extends TestCase |
|
16
|
|
|
{ |
|
17
|
|
|
/** |
|
18
|
|
|
* @param mixed[] $parameters |
|
19
|
|
|
* |
|
20
|
|
|
* @dataProvider getParameters |
|
21
|
|
|
* @covers \ProxyManager\Inflector\Util\ParameterHasher::hashParameters |
|
22
|
|
|
*/ |
|
23
|
|
|
public function testGeneratesValidClassName(array $parameters, string $expectedHash) : void |
|
24
|
|
|
{ |
|
25
|
|
|
$encoder = new ParameterHasher(); |
|
26
|
|
|
|
|
27
|
|
|
self::assertSame($expectedHash, $encoder->hashParameters($parameters)); |
|
|
|
|
|
|
28
|
|
|
} |
|
29
|
|
|
|
|
30
|
|
|
/** @return mixed[][][]|string[][] */ |
|
31
|
|
|
public static function getParameters() : array |
|
32
|
|
|
{ |
|
33
|
|
|
return [ |
|
34
|
|
|
[[], '40cd750bba9870f18aada2478b24840a'], |
|
35
|
|
|
[['foo' => 'bar'], '49a3696adf0fbfacc12383a2d7400d51'], |
|
36
|
|
|
[['bar' => 'baz'], '6ed41c8a63c1571554ecaeb998198757'], |
|
37
|
|
|
[[null], '38017a839aaeb8ff1a658fce9af6edd3'], |
|
38
|
|
|
[[null, null], '12051f9a58288e5328ad748881cc4e00'], |
|
39
|
|
|
[['bar' => null], '0dbb112e1c4e6e4126232de2daa2d660'], |
|
40
|
|
|
[['bar' => 12345], 'eb6291ea4973741bf9b6571f49b4ffd2'], |
|
41
|
|
|
[['foo' => 'bar', 'bar' => 'baz'], '4447ff857f244d24c31bd84d7a855eda'], |
|
42
|
|
|
]; |
|
43
|
|
|
} |
|
44
|
|
|
} |
|
45
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.