ParameterEncoderTest::getParameters()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 13
rs 9.8333
c 0
b 0
f 0
cc 1
nc 1
nop 0
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\ParameterEncoder;
9
10
/**
11
 * Tests for {@see \ProxyManager\Inflector\Util\ParameterEncoder}
12
 *
13
 * @group Coverage
14
 */
15
final class ParameterEncoderTest extends TestCase
16
{
17
    /**
18
     * @param mixed[] $parameters
19
     *
20
     * @dataProvider getParameters
21
     * @covers \ProxyManager\Inflector\Util\ParameterEncoder::encodeParameters
22
     */
23
    public function testGeneratesValidClassName(array $parameters) : void
24
    {
25
        $encoder = new ParameterEncoder();
26
27
        self::assertRegExp(
0 ignored issues
show
Bug introduced by
The method assertRegExp() does not seem to exist on object<ProxyManagerTest\...l\ParameterEncoderTest>.

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.

Loading history...
28
            '/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]+/',
29
            $encoder->encodeParameters($parameters),
30
            'Encoded string is a valid class identifier'
31
        );
32
    }
33
34
    /** @return mixed[][] */
35
    public static function getParameters() : array
36
    {
37
        return [
38
            [[]],
39
            [['foo' => 'bar']],
40
            [['bar' => 'baz']],
41
            [[null]],
42
            [[null, null]],
43
            [['bar' => null]],
44
            [['bar' => 12345]],
45
            [['foo' => 'bar', 'bar' => 'baz']],
46
        ];
47
    }
48
}
49