Skip to content

Commit f8e21c3

Browse files
author
Knut Urdalen
committed
fixed/refactored some spl tests related to owner/group retrieval
1 parent d70a9f9 commit f8e21c3

4 files changed

+56
-71
lines changed

ext/spl/tests/DirectoryIterator_getGroup_basic.phpt

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,19 @@ Daniel Londero <daniel.londero@gmail.com>
88
Francesco Trucchia <ft@ideato.it>
99
Jacopo Romei <jacopo@sviluppoagile.it>
1010
#Test Fest Cesena (Italy) on 2009-06-20
11-
--SKIPIF--
12-
<?php
13-
if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
14-
?>
1511
--FILE--
1612
<?php
17-
18-
shell_exec('mkdir test_dir_ptfi');
19-
$dir = new DirectoryIterator('test_dir_ptfi');
20-
$result = shell_exec('ls -lnd test_dir_ptfi | cut -d" " -f 4');
21-
22-
var_dump($dir->getGroup() == $result);
23-
13+
$dirname = basename(__FILE__, '.phpt');
14+
mkdir($dirname);
15+
$dir = new DirectoryIterator($dirname);
16+
$expected = filegroup($dirname);
17+
$actual = $dir->getGroup();
18+
var_dump($expected == $actual);
2419
?>
2520
--CLEAN--
2621
<?php
27-
rmdir('test_dir_ptfi');
22+
$dirname = basename(__FILE__, '.phpt');
23+
rmdir($dirname);
2824
?>
2925
--EXPECTF--
3026
bool(true)
Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,26 @@
1-
--TEST--
2-
SPL: Spl Directory Iterator test getOwner
3-
--CREDITS--
1+
--TEST--
2+
SPL: DirectoryIterator test getOwner
3+
--CREDITS--
44
Cesare D'Amico <cesare.damico@gruppovolta.it>
55
Andrea Giorgini <agiorg@gmail.com>
66
Filippo De Santis <fd@ideato.it>
77
Daniel Londero <daniel.londero@gmail.com>
88
Francesco Trucchia <ft@ideato.it>
99
Jacopo Romei <jacopo@sviluppoagile.it>
10-
#Test Fest Cesena (Italy) on 2009-06-20
11-
--SKIPIF--
12-
<?php
13-
if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
14-
?>
15-
--FILE--
16-
<?php
17-
18-
shell_exec('mkdir test_dir_ptfi');
19-
$dir = new DirectoryIterator('test_dir_ptfi');
20-
$result = shell_exec('ls -lnd test_dir_ptfi | cut -d" " -f 3');
21-
var_dump($dir->getOwner() == $result);
22-
10+
#Test Fest Cesena (Italy) on 2009-06-20
11+
--FILE--
12+
<?php
13+
$dirname = basename(__FILE__, '.phpt');
14+
mkdir($dirname);
15+
$dir = new DirectoryIterator($dirname);
16+
$expected = fileowner($dirname);
17+
$actual = $dir->getOwner();
18+
var_dump($expected == $actual);
2319
?>
2420
--CLEAN--
2521
<?php
26-
rmdir('test_dir_ptfi');
27-
?>
28-
--EXPECTF--
22+
$dirname = basename(__FILE__, '.phpt');
23+
rmdir($dirname);
24+
?>
25+
--EXPECTF--
2926
bool(true)
Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,26 @@
1-
--TEST--
2-
SPL: Spl File Info test getGroup
3-
--CREDITS--
1+
--TEST--
2+
SPL: SplFileInfo test getGroup
3+
--CREDITS--
44
Cesare D'Amico <cesare.damico@gruppovolta.it>
55
Andrea Giorgini <agiorg@gmail.com>
66
Filippo De Santis <fd@ideato.it>
77
Daniel Londero <daniel.londero@gmail.com>
88
Francesco Trucchia <ft@ideato.it>
99
Jacopo Romei <jacopo@sviluppoagile.it>
10-
#Test Fest Cesena (Italy) on 2009-06-20
11-
--SKIPIF--
12-
<?php
13-
if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
14-
?>
15-
--FILE--
16-
<?php
17-
18-
//file
19-
touch ('test_file_ptfi');
20-
$fileInfo = new SplFileInfo('test_file_ptfi');
21-
$result = shell_exec('ls -ln test_file_ptfi | cut -d" " -f 4');
22-
var_dump($fileInfo->getGroup() == $result);
23-
10+
#Test Fest Cesena (Italy) on 2009-06-20
11+
--FILE--
12+
<?php
13+
$filename = basename(__FILE__, 'phpt').'tmp';
14+
touch($filename);
15+
$fileInfo = new SplFileInfo($filename);
16+
$expected = filegroup($filename);
17+
$actual = $fileInfo->getGroup();
18+
var_dump($expected == $actual);
2419
?>
2520
--CLEAN--
2621
<?php
27-
unlink('test_file_ptfi');
28-
?>
29-
--EXPECTF--
22+
$filename = basename(__FILE__, 'phpt').'tmp';
23+
unlink($filename);
24+
?>
25+
--EXPECTF--
3026
bool(true)
Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,26 @@
1-
--TEST--
2-
SPL: Spl File Info test getOwner
3-
--CREDITS--
1+
--TEST--
2+
SPL: SplFileInfo test getOwner
3+
--CREDITS--
44
Cesare D'Amico <cesare.damico@gruppovolta.it>
55
Andrea Giorgini <agiorg@gmail.com>
66
Filippo De Santis <fd@ideato.it>
77
Daniel Londero <daniel.londero@gmail.com>
88
Francesco Trucchia <ft@ideato.it>
99
Jacopo Romei <jacopo@sviluppoagile.it>
10-
#Test Fest Cesena (Italy) on 2009-06-20
11-
--SKIPIF--
12-
<?php
13-
if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
14-
?>
15-
--FILE--
16-
<?php
17-
18-
//file
19-
touch ('test_file_ptfi');
20-
$fileInfo = new SplFileInfo('test_file_ptfi');
21-
$result = shell_exec('ls -ln test_file_ptfi | cut -d" " -f 3');
22-
var_dump($fileInfo->getOwner() == $result);
23-
10+
#Test Fest Cesena (Italy) on 2009-06-20
11+
--FILE--
12+
<?php
13+
$filename = basename(__FILE__, 'phpt').'tmp';
14+
touch($filename);
15+
$fileInfo = new SplFileInfo($filename);
16+
$expected = fileowner($filename);
17+
$actual = $fileInfo->getOwner();
18+
var_dump($expected == $actual);
2419
?>
2520
--CLEAN--
2621
<?php
27-
unlink('test_file_ptfi');
28-
?>
29-
--EXPECTF--
22+
$filename = basename(__FILE__, 'phpt').'tmp';
23+
unlink($filename);
24+
?>
25+
--EXPECTF--
3026
bool(true)

0 commit comments

Comments
 (0)