diff --git a/test/FakeGetoptTest.php b/test/FakeGetoptTest.php index 887ff2c..c3769b2 100644 --- a/test/FakeGetoptTest.php +++ b/test/FakeGetoptTest.php @@ -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() diff --git a/test/bootstrap.php b/test/bootstrap.php index cf82cfb..9fe6f3e 100644 --- a/test/bootstrap.php +++ b/test/bootstrap.php @@ -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) @@ -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);