@@ 10-18 (lines=9) @@ | ||
7 | ||
8 | class DoctrineExtensionTest extends TestCase |
|
9 | { |
|
10 | public function testReplaceQueryParametersWithPostgresCasting() : void |
|
11 | { |
|
12 | $extension = new DoctrineExtension(); |
|
13 | $query = 'a=? OR (1)::string OR b=?'; |
|
14 | $parameters = [1, 2]; |
|
15 | ||
16 | $result = $extension->replaceQueryParameters($query, $parameters); |
|
17 | $this->assertEquals('a=1 OR (1)::string OR b=2', $result); |
|
18 | } |
|
19 | ||
20 | public function testReplaceQueryParametersWithStartingIndexAtOne() : void |
|
21 | { |
|
@@ 20-31 (lines=12) @@ | ||
17 | $this->assertEquals('a=1 OR (1)::string OR b=2', $result); |
|
18 | } |
|
19 | ||
20 | public function testReplaceQueryParametersWithStartingIndexAtOne() : void |
|
21 | { |
|
22 | $extension = new DoctrineExtension(); |
|
23 | $query = 'a=? OR b=?'; |
|
24 | $parameters = [ |
|
25 | 1 => 1, |
|
26 | 2 => 2, |
|
27 | ]; |
|
28 | ||
29 | $result = $extension->replaceQueryParameters($query, $parameters); |
|
30 | $this->assertEquals('a=1 OR b=2', $result); |
|
31 | } |
|
32 | ||
33 | public function testReplaceQueryParameters() : void |
|
34 | { |
|
@@ 33-44 (lines=12) @@ | ||
30 | $this->assertEquals('a=1 OR b=2', $result); |
|
31 | } |
|
32 | ||
33 | public function testReplaceQueryParameters() : void |
|
34 | { |
|
35 | $extension = new DoctrineExtension(); |
|
36 | $query = 'a=? OR b=?'; |
|
37 | $parameters = [ |
|
38 | 1, |
|
39 | 2, |
|
40 | ]; |
|
41 | ||
42 | $result = $extension->replaceQueryParameters($query, $parameters); |
|
43 | $this->assertEquals('a=1 OR b=2', $result); |
|
44 | } |
|
45 | ||
46 | public function testReplaceQueryParametersWithNamedIndex() : void |
|
47 | { |
|
@@ 59-69 (lines=11) @@ | ||
56 | $this->assertEquals('a=1 OR b=2', $result); |
|
57 | } |
|
58 | ||
59 | public function testReplaceQueryParametersWithEmptyArray() : void |
|
60 | { |
|
61 | $extension = new DoctrineExtension(); |
|
62 | $query = 'IN (?)'; |
|
63 | $parameters = [ |
|
64 | [], |
|
65 | ]; |
|
66 | ||
67 | $result = $extension->replaceQueryParameters($query, $parameters); |
|
68 | $this->assertEquals('IN (NULL)', $result); |
|
69 | } |
|
70 | ||
71 | public function testEscapeBinaryParameter() : void |
|
72 | { |