Skip to content

Commit 9a51925

Browse files
Merge pull request #42 from utopia-php/feat-equal-symbol-test
Fix: Equals symbol in param value
2 parents 70877c9 + 0d6e4c6 commit 9a51925

2 files changed

Lines changed: 23 additions & 1 deletion

File tree

src/CLI/CLI.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ public function parse(array $args): array
245245
unset($arg);
246246

247247
foreach ($args as $arg) {
248-
$pair = explode('=', $arg);
248+
$pair = explode('=', $arg, 2);
249249
$key = $pair[0];
250250
$value = $pair[1];
251251
$output[$key][] = $value;

tests/CLI/CLITest.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,4 +258,26 @@ public function testMatch()
258258

259259
$this->assertEquals(null, $cli->match());
260260
}
261+
262+
public function testEscaping()
263+
{
264+
ob_start();
265+
266+
$database = 'appwrite://database_db_fra1_self_hosted_0_0?database=appwrite&namespace=_1';
267+
268+
$cli = new CLI(new Generic(), ['test.php', 'connect', '--database='.$database]);
269+
270+
$cli
271+
->task('connect')
272+
->param('database', null, new Text(2048), 'Database DSN')
273+
->action(function ($database) {
274+
echo $database;
275+
});
276+
277+
$cli->run();
278+
279+
$result = ob_get_clean();
280+
281+
$this->assertEquals($database, $result);
282+
}
261283
}

0 commit comments

Comments
 (0)