@@ -42,7 +42,13 @@ public function setUp(): void
42
42
'ssh_port ' => (int ) getenv ('ROS_SSH_PORT ' ),
43
43
];
44
44
45
- $ this ->client = new Client ($ this ->config );
45
+ $ this ->client = new class ($ this ->config ) extends Client {
46
+ // Convert protected method to public
47
+ public function pregResponse (string $ value , ?array &$ matches ): void
48
+ {
49
+ parent ::pregResponse ($ value , $ matches );
50
+ }
51
+ };
46
52
47
53
$ this ->port_modern = (int ) getenv ('ROS_PORT_MODERN ' );
48
54
$ this ->port_legacy = (int ) getenv ('ROS_PORT_LEGACY ' );
@@ -176,6 +182,30 @@ public function testConstructWrongNet(): void
176
182
]);
177
183
}
178
184
185
+ public function pregResponseDataProvider (): array
186
+ {
187
+ return [
188
+ ['line ' => '=.id=1 ' , 'result ' => [['=.id=1 ' ], ['.id ' ], [1 ]]],
189
+ ['line ' => '=name=kjhasdrlkh=5468=3456kh3l45 ' , 'result ' => [['=name=kjhasdrlkh=5468=3456kh3l45 ' ], ['name ' ], ['kjhasdrlkh=5468=3456kh3l45 ' ]]],
190
+ ['line ' => '=name==d===efault=a===123sadf=3=3=== ' , 'result ' => [['=name==d===efault=a===123sadf=3=3=== ' ], ['name ' ], ['=d===efault=a===123sadf=3=3=== ' ]]],
191
+ ['line ' => '=name============ ' , 'result ' => [['=name============ ' ], ['name ' ], ['=========== ' ]]],
192
+ ['line ' => '=on-login={:liahdf =aasdf(zz)a;ldfj} ' , 'result ' => [['=on-login={:liahdf =aasdf(zz)a;ldfj} ' ], ['on-login ' ], ['{:liahdf =aasdf(zz)a;ldfj} ' ]]],
193
+ ];
194
+ }
195
+
196
+ /**
197
+ * @dataProvider pregResponseDataProvider
198
+ *
199
+ * @param string $line
200
+ * @param array $result
201
+ */
202
+ public function testPregResponse (string $ line , array $ result ): void
203
+ {
204
+ $ matches = [];
205
+ $ this ->client ->pregResponse ($ line , $ matches );
206
+ $ this ->assertEquals ($ matches , $ result );
207
+ }
208
+
179
209
public function testQueryRead (): void
180
210
{
181
211
/*
0 commit comments