File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / spl / tests / SplFileObject_ftruncate_error_001.phpt
Revision 1.1.1.2 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue May 29 12:34:43 2012 UTC (12 years, 2 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, HEAD
php 5.4.3+patches

--TEST--
SplFileObject::ftruncate function - truncating with stream that does not support truncation 
--FILE--
<?php

//create a basic stream class
class VariableStream {
    var $position;
    var $varname;

    function stream_open($path, $mode, $options, &$opened_path)
    {
        return true;
    }

    function url_stat() {
    }
}
stream_wrapper_register("SPLtest", "VariableStream");
$ftruncate_test = "";
//end creating stream

//open an SplFileObject using the above test stream
$obj = New SplFileObject("SPLtest://ftruncate_test"); 
try {
	$obj->ftruncate(1);
} catch (LogicException $e) {
	echo($e->getMessage());
}
?>
--EXPECTF--
Can't truncate file %s

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>