Annotation of embedaddon/php/ext/phar/tests/phar_oo_009.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Phar object: iterating via SplFileObject and reading csv
3: --SKIPIF--
4: <?php if (!extension_loaded('phar')) die('skip'); ?>
5: <?php if (!defined('SplFileObject::READ_CSV') || !defined('SplFileObject::SKIP_EMPTY')) die('skip newer SPL version is required'); ?>
6: --INI--
7: phar.require_hash=0
8: --FILE--
9: <?php
10:
11: $pharconfig = 2;
12:
13: require_once 'files/phar_oo_test.inc';
14:
15: $phar = new Phar($fname);
16: $phar->setInfoClass('SplFileObject');
17:
18: $f = $phar['a.csv'];
19: $f->setFlags(SplFileObject::SKIP_EMPTY | SplFileObject::DROP_NEW_LINE);
20: foreach($f as $k => $v)
21: {
22: echo "$k=>$v\n";
23: }
24:
25: ?>
26: ===CSV===
27: <?php
28:
29: $f->setFlags(SplFileObject::SKIP_EMPTY | SplFileObject::DROP_NEW_LINE | SplFileObject::READ_CSV);
30: foreach($f as $k => $v)
31: {
32: echo "$k=>" . join('|', $v) . "\n";
33: }
34:
35: ?>
36: ===DONE===
37: --CLEAN--
38: <?php
39: unlink(dirname(__FILE__) . '/files/phar_oo_test.phar.php');
40: __halt_compiler();
41: ?>
42: --EXPECTF--
43: 0=>1,2,3
44: 1=>2,a,b
45: 2=>3,"c","'e'"
46: 3=>4
47: 4=>5,5
48: 5=>7,777
49: ===CSV===
50: 0=>1|2|3
51: 1=>2|a|b
52: 2=>3|c|'e'
53: 3=>4
54: 4=>5|5
55: 6=>7|777
56: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>