1
0
mirror of https://github.com/php/php-src.git synced 2026-03-30 12:13:02 +02:00
Files
archived-php-src/ext/spl/tests/fileobject_005.phpt
Peter Kokot 6426420f61 Merge branch 'PHP-7.4'
* PHP-7.4:
  Replace dirname(__FILE__) by __DIR__ in tests
2019-03-15 23:36:47 +01:00

35 lines
602 B
PHP

--TEST--
SPL: SplFileObject truncate tests
--CREDITS--
Mark Ammann
#Hackday Webtuesday 2008-05-24
--FILE--
<?php
set_include_path(dirname(__DIR__));
$path = __DIR__.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());
$fo->rewind();
$fo->fwrite("blahlubba");
?>
==DONE==
--CLEAN--
<?php
$path = __DIR__.DIRECTORY_SEPARATOR.'fileobject_005.txt';
unlink($path);
?>
--EXPECTF--
bool(true)
string(4) "blah"
==DONE==