xref: /PHP-8.0/ext/spl/tests/fileobject_005.phpt (revision 3962f00b)
1--TEST--
2SPL: SplFileObject truncate tests
3--CREDITS--
4Mark Ammann
5#Hackday Webtuesday 2008-05-24
6--FILE--
7<?php
8
9$path = __DIR__.DIRECTORY_SEPARATOR.'fileobject_005.txt';
10touch($path);
11
12$fo = new SplFileObject($path, 'w+', true);
13$fo->fwrite("blahlubba");
14var_dump($fo->ftruncate(4));
15
16$fo->rewind();
17var_dump($fo->fgets());
18
19$fo->rewind();
20$fo->fwrite("blahlubba");
21
22?>
23--CLEAN--
24<?php
25$path = __DIR__.DIRECTORY_SEPARATOR.'fileobject_005.txt';
26unlink($path);
27?>
28--EXPECT--
29bool(true)
30string(4) "blah"
31