File:
[ELWIX - Embedded LightWeight unIX -] /
embedaddon /
php /
ext /
spl /
tests /
fileobject_005.phpt
Revision
1.1.1.1 (vendor branch):
download - view:
text,
annotated -
select for diffs -
revision graph
Tue Feb 21 23:48:01 2012 UTC (12 years, 6 months ago) by
misho
Branches:
php,
MAIN
CVS tags:
v5_4_3elwix,
v5_4_29p0,
v5_4_29,
v5_4_20p0,
v5_4_20,
v5_4_17p0,
v5_4_17,
v5_3_10,
HEAD
php
--TEST--
SPL: SplFileObject truncate tests
--CREDITS--
Mark Ammann
#Hackday Webtuesday 2008-05-24
--FILE--
<?php
set_include_path(dirname(dirname(__FILE__)));
$path = dirname(__FILE__).DIRECTORY_SEPARATOR.'fileobject_005.txt';
touch($path);
$fo = new SplFileObject('tests'.DIRECTORY_SEPARATOR.'fileobject_005.txt', 'w+', true);
$fo->fwrite("blahlubba");
var_dump($fo->ftruncate(4));
$fo->rewind();
var_dump($fo->fgets(8));
$fo->rewind();
$fo->fwrite("blahlubba");
// This should throw a warning and return NULL since an argument is missing
var_dump($fo->ftruncate());
?>
==DONE==
--CLEAN--
<?php
$path = dirname(__FILE__).DIRECTORY_SEPARATOR.'fileobject_005.txt';
unlink($path);
?>
--EXPECTF--
bool(true)
Warning: SplFileObject::fgets() expects exactly 0 parameters, 1 given in %s on line %d
NULL
Warning: SplFileObject::ftruncate() expects exactly 1 parameter, 0 given in %s on line %d
NULL
==DONE==
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>