xref: /PHP-8.2/ext/spl/tests/dit_004.phpt (revision 0535872b)
1--TEST--
2SPL: DirectoryIterator and clone
3--FILE--
4<?php
5
6@mkdir($dir = __DIR__ . '/dit_004');
7touch($dir . '/file1');
8touch($dir . '/file2');
9touch($dir . '/file3');
10
11$a = new DirectoryIterator($dir);
12$b = clone $a;
13var_dump((string)$b == (string)$a);
14var_dump($a->key(), $b->key());
15$a->next();
16$a->next();
17$a->next();
18$c = clone $a;
19var_dump((string)$c == (string)$a);
20var_dump($a->key(), $c->key());
21?>
22--CLEAN--
23<?php
24$dir = __DIR__ . '/dit_004';
25unlink($dir . '/file1');
26unlink($dir . '/file2');
27unlink($dir . '/file3');
28rmdir($dir);
29?>
30--EXPECT--
31bool(true)
32int(0)
33int(0)
34bool(true)
35int(3)
36int(3)
37