File tree Expand file tree Collapse file tree 3 files changed +43
-2
lines changed Expand file tree Collapse file tree 3 files changed +43
-2
lines changed Original file line number Diff line number Diff line change 17
17
"text": "infection-log.txt"
18
18
},
19
19
"minMsi": 90,
20
- "minCoveredMsi": 96
20
+ "minCoveredMsi": 95
21
21
}
Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ public function prepareSqlRequest(
83
83
): RequestInterface {
84
84
$ request = $ this ->initRequest ($ requestSettings );
85
85
86
- preg_match_all ('~\{([a-zA-Z\d ]+):([a-zA-Z\d ]+(\(.+\))?)}~ ' , $ sql , $ matches );
86
+ preg_match_all ('~\{([a-zA-Z\d_ ]+):([a-zA-Z\d ]+(\(.+\))?)}~ ' , $ sql , $ matches );
87
87
if ($ matches [0 ] === []) {
88
88
$ body = $ this ->streamFactory ->createStream ($ sql );
89
89
try {
Original file line number Diff line number Diff line change 4
4
5
5
namespace SimPod \ClickHouseClient \Tests \Client \Http ;
6
6
7
+ use DateTimeImmutable ;
7
8
use Generator ;
8
9
use Nyholm \Psr7 \Factory \Psr17Factory ;
9
10
use PHPUnit \Framework \Attributes \CoversClass ;
14
15
use SimPod \ClickHouseClient \Param \ParamValueConverterRegistry ;
15
16
use SimPod \ClickHouseClient \Tests \TestCaseBase ;
16
17
18
+ use function implode ;
19
+
17
20
#[CoversClass(RequestFactory::class)]
18
21
final class RequestFactoryTest extends TestCaseBase
19
22
{
@@ -66,4 +69,42 @@ public static function providerPrepareRequest(): Generator
66
69
'?database=database&max_block_size=1 ' ,
67
70
];
68
71
}
72
+
73
+ public function testParamParsed (): void
74
+ {
75
+ $ requestFactory = new RequestFactory (
76
+ new ParamValueConverterRegistry (),
77
+ new Psr17Factory (),
78
+ new Psr17Factory (),
79
+ );
80
+
81
+ $ request = $ requestFactory ->prepareSqlRequest (
82
+ 'SELECT {p1:String}, {p_2:Date} ' ,
83
+ new RequestSettings (
84
+ [],
85
+ [],
86
+ ),
87
+ new RequestOptions (
88
+ [
89
+ 'p1 ' => 'value1 ' ,
90
+ 'p_2 ' => new DateTimeImmutable (),
91
+ ],
92
+ ),
93
+ );
94
+
95
+ $ body = $ request ->getBody ()->__toString ();
96
+ self ::assertStringContainsString ('param_p1 ' , $ body );
97
+ self ::assertStringContainsString (
98
+ implode (
99
+ "\r\n" ,
100
+ [
101
+ 'Content-Disposition: form-data; name="param_p_2" ' ,
102
+ 'Content-Length: 10 ' ,
103
+ '' ,
104
+ '2025-01-23 ' ,
105
+ ],
106
+ ),
107
+ $ body ,
108
+ );
109
+ }
69
110
}
You can’t perform that action at this time.
0 commit comments