Skip to content

Commit

Permalink
I'm sure this is basically the same, but ok!
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-xo committed Oct 17, 2022
1 parent cd3b902 commit fe52274
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
3 changes: 1 addition & 2 deletions test/FakeGetoptTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,9 @@ public function test_fake_getopt_escaping()
fake_getopt(array('php', '--media-dir=""'), '', array('media-dir::')),
array('media-dir' => '""')
);
print(fake_getopt(array('php', '--media-dir=\'\''), '', array('media-dir::')));
$this->assertEquals(
fake_getopt(array('php', "--media-dir=''"), '', array('media-dir::')),
false // XXX: seems to be a bug in getopt
array('media-dir' => "''")
);
}
public function test_fake_getopt_both_arg_types()
Expand Down
9 changes: 6 additions & 3 deletions test/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ function temp_xml_glob()

function escape_single_quoted_string($string)
{
return str_replace(array("'", '\\'), array("\\'", '\\\\'), $string);
$string = str_replace('\\', '\\\\', $string);
$string = str_replace('\'', '\\\'', $string);
return $string;
}

function fake_getopt_command($argv_in, $short_options, $long_options)
Expand Down Expand Up @@ -117,8 +119,9 @@ function fake_getopt($argv_in, $short_options, $long_options)
$output = null;
$result_code = null;
exec($command, $output, $result_code);
var_dump($output);
return unserialize($output[0]);
if(count($output) > 0)
return unserialize($output[0]);
return array();
}

define('NO_DISPATCHER', true);
Expand Down

0 comments on commit fe52274

Please sign in to comment.