Passed
Pull Request — master (#6881)
by
unknown
13:29
created

testParameterNameStartingOrEndingWithAColon()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
1
<?php
0 ignored issues
show
introduced by
Missing declare(strict_types = 1).
Loading history...
2
3
namespace Doctrine\Tests\ORM\Query;
4
5
use Doctrine\ORM\Query\Parameter;
6
use PHPUnit\Framework\TestCase;
7
8
class ParameterTest extends TestCase
9
{
10
    /**
11
     * @dataProvider getParameterNamesStartingOrEndingWithAColon
12
     */
13
    public function testParameterNameStartingOrEndingWithAColon(string $name): void
0 ignored issues
show
introduced by
There must be exactly 1 whitespace between closing parenthesis and return type colon.
Loading history...
14
    {
15
        $this->expectException(\InvalidArgumentException::class);
16
        $this->expectExceptionMessage('A parameter name cannot start or end with ":".');
17
18
        new Parameter($name, 'value');
19
    }
20
21
    /**
22
     * @return array
23
     */
24
    public function getParameterNamesStartingOrEndingWithAColon(): array
0 ignored issues
show
introduced by
There must be exactly 1 whitespace between closing parenthesis and return type colon.
Loading history...
25
    {
26
        return array(
0 ignored issues
show
Coding Style introduced by
Short array syntax must be used to define arrays
Loading history...
27
            array(':name'),
0 ignored issues
show
Coding Style introduced by
Short array syntax must be used to define arrays
Loading history...
28
            array('::name'),
0 ignored issues
show
Coding Style introduced by
Short array syntax must be used to define arrays
Loading history...
29
            array('name:'),
0 ignored issues
show
Coding Style introduced by
Short array syntax must be used to define arrays
Loading history...
30
            array('name::'),
0 ignored issues
show
Coding Style introduced by
Short array syntax must be used to define arrays
Loading history...
31
            array(':name:'),
0 ignored issues
show
Coding Style introduced by
Short array syntax must be used to define arrays
Loading history...
32
            array('::name::')
0 ignored issues
show
Coding Style introduced by
Short array syntax must be used to define arrays
Loading history...
33
        );
34
    }
35
}
36