From: Marcus Boerger Date: Sat, 27 Jan 2007 17:32:21 +0000 (+0000) Subject: - Add new tests X-Git-Tag: RELEASE_1_0_0RC1~122 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fa60adaffafac9394b22815b99cffa719798000f;p=php - Add new tests --- diff --git a/ext/phar/tests/phar_oo_compressed_002.phpt b/ext/phar/tests/phar_oo_compressed_002.phpt new file mode 100755 index 0000000000..c318750a31 --- /dev/null +++ b/ext/phar/tests/phar_oo_compressed_002.phpt @@ -0,0 +1,72 @@ +--TEST-- +Phar: context/compress=GZ +--SKIPIF-- + + +--INI-- +phar.require_hash=0 +--FILE-- +'; + +$files = array(); +$files['a'] = 'a'; +$files['b'] = 'b'; +$files['c'] = 'c'; + +include 'phar_test.inc'; + +$phar = new Phar($fname); + +var_dump(file_get_contents($pname . '/a')); +var_dump($phar['a']->isCompressed()); +var_dump(file_get_contents($pname . '/b')); +var_dump($phar['b']->isCompressed()); +var_dump(file_get_contents($pname . '/c')); +var_dump($phar['c']->isCompressed()); + +$context = stream_context_create(array('phar'=>array('compress'=>Phar::GZ))); + +file_put_contents($pname . '/b', 'new b'); +file_put_contents($pname . '/c', 'new c', 0, $context); +file_put_contents($pname . '/d', 'new d'); +file_put_contents($pname . '/e', 'new e', 0, $context); + +$phar = new Phar($fname); +var_dump(file_get_contents($pname . '/a')); +var_dump($phar['a']->isCompressed()); +var_dump(file_get_contents($pname . '/b')); +var_dump($phar['b']->isCompressed()); +var_dump(file_get_contents($pname . '/c')); +var_dump($phar['c']->isCompressed()); +var_dump(file_get_contents($pname . '/d')); +var_dump($phar['d']->isCompressed()); +var_dump(file_get_contents($pname . '/e')); +var_dump($phar['e']->isCompressed()); + +?> +===DONE=== +--CLEAN-- + +--EXPECTF-- +string(1) "a" +bool(false) +string(1) "b" +bool(false) +string(1) "c" +bool(false) +string(1) "a" +bool(false) +string(5) "new b" +bool(false) +string(5) "new c" +bool(true) +string(5) "new d" +bool(false) +string(5) "new e" +bool(true) +===DONE=== diff --git a/ext/phar/tests/phar_oo_compressed_002b.phpt b/ext/phar/tests/phar_oo_compressed_002b.phpt new file mode 100755 index 0000000000..bac50d77ba --- /dev/null +++ b/ext/phar/tests/phar_oo_compressed_002b.phpt @@ -0,0 +1,72 @@ +--TEST-- +Phar: context/compress=BZip2 +--SKIPIF-- + + +--INI-- +phar.require_hash=0 +--FILE-- +'; + +$files = array(); +$files['a'] = 'a'; +$files['b'] = 'b'; +$files['c'] = 'c'; + +include 'phar_test.inc'; + +$phar = new Phar($fname); + +var_dump(file_get_contents($pname . '/a')); +var_dump($phar['a']->isCompressed()); +var_dump(file_get_contents($pname . '/b')); +var_dump($phar['b']->isCompressed()); +var_dump(file_get_contents($pname . '/c')); +var_dump($phar['c']->isCompressed()); + +$context = stream_context_create(array('phar'=>array('compress'=>Phar::BZ2))); + +file_put_contents($pname . '/b', 'new b'); +file_put_contents($pname . '/c', 'new c', 0, $context); +file_put_contents($pname . '/d', 'new d'); +file_put_contents($pname . '/e', 'new e', 0, $context); + +$phar = new Phar($fname); +var_dump(file_get_contents($pname . '/a')); +var_dump($phar['a']->isCompressed()); +var_dump(file_get_contents($pname . '/b')); +var_dump($phar['b']->isCompressed()); +var_dump(file_get_contents($pname . '/c')); +var_dump($phar['c']->isCompressed()); +var_dump(file_get_contents($pname . '/d')); +var_dump($phar['d']->isCompressed()); +var_dump(file_get_contents($pname . '/e')); +var_dump($phar['e']->isCompressed()); + +?> +===DONE=== +--CLEAN-- + +--EXPECTF-- +string(1) "a" +bool(false) +string(1) "b" +bool(false) +string(1) "c" +bool(false) +string(1) "a" +bool(false) +string(5) "new b" +bool(false) +string(5) "new c" +bool(true) +string(5) "new d" +bool(false) +string(5) "new e" +bool(true) +===DONE===