Skip to content

Commit

Permalink
Apply fix for equals in values
Browse files Browse the repository at this point in the history
  • Loading branch information
Meldiron committed Oct 4, 2024
1 parent ccb7c81 commit 0ff8b37
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/CLI/CLI.php
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ public function parse(array $args): array
unset($arg);

foreach ($args as $arg) {
$pair = explode('=', $arg);
$pair = explode('=', $arg, 2);
$key = $pair[0];
$value = $pair[1];
$output[$key][] = $value;
Expand Down
22 changes: 22 additions & 0 deletions tests/CLI/CLITest.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,4 +247,26 @@ public function testMatch()

$this->assertEquals(null, $cli->match());
}

public function testEscaping()
{
ob_start();

$database = 'appwrite://database_db_fra1_self_hosted_0_0?database=appwrite&namespace=_1';

$cli = new CLI(new Generic(), ['test.php', 'connect', '--database='.$database]);

$cli
->task('connect')
->param('database', null, new Text(2048), 'Database DSN')
->action(function ($database) {
echo $database;
});

$cli->run();

$result = ob_get_clean();

$this->assertEquals($database, $result);
}
}

0 comments on commit 0ff8b37

Please sign in to comment.