Skip to content

Commit 5da4da2

Browse files
committed
Test namespace ini configuration
1 parent ec9a8c5 commit 5da4da2

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

tests/namespace.phpt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
--TEST--
2+
PHP Bencode - Basic Test With Namespace
3+
--INI--
4+
bencode.namespace=1
5+
--FILE--
6+
<?php
7+
error_reporting(E_ALL);
8+
9+
function println($info) { echo $info . "\n"; }
10+
11+
$broot = bencode\bitem::load(__DIR__ . '/test.in');
12+
println(sha1($broot));
13+
println(serialize($broot->to_array()));
14+
println(serialize($broot->to_meta_array()));
15+
$broot->save(__DIR__ . '/test.out');
16+
println(sha1_file(__DIR__ . '/test.in') === sha1_file(__DIR__ . '/test.out'));
17+
unlink(__DIR__ . '/test.out');
18+
19+
exit(0);
20+
?>
21+
--EXPECTF--
22+
bef3e94aa2c1bf31a4991c86bb3774c527a553a2
23+
a:2:{s:4:"key1";a:4:{i:0;s:11:"hello world";i:1;s:7:"foo bar";i:2;s:9:"bye world";i:3;a:1:{s:6:"subkey";s:15:"I can eat glass";}}s:10:"key2/slash";i:65536;}
24+
a:3:{s:5:"_type";s:5:"bdict";s:7:"_length";i:92;s:5:"_data";a:2:{s:4:"key1";a:3:{s:5:"_type";s:5:"blist";s:7:"_length";i:64;s:5:"_data";a:4:{i:0;a:3:{s:5:"_type";s:4:"bstr";s:7:"_length";i:14;s:5:"_data";s:11:"hello world";}i:1;a:3:{s:5:"_type";s:4:"bstr";s:7:"_length";i:9;s:5:"_data";s:7:"foo bar";}i:2;a:3:{s:5:"_type";s:4:"bstr";s:7:"_length";i:11;s:5:"_data";s:9:"bye world";}i:3;a:3:{s:5:"_type";s:5:"bdict";s:7:"_length";i:28;s:5:"_data";a:1:{s:6:"subkey";a:3:{s:5:"_type";s:4:"bstr";s:7:"_length";i:18;s:5:"_data";s:15:"I can eat glass";}}}}}s:10:"key2/slash";a:3:{s:5:"_type";s:4:"bint";s:7:"_length";i:7;s:5:"_data";i:65536;}}}
25+
1
26+

0 commit comments

Comments
 (0)