fixed/refactored some spl tests related to owner/group retrieval

This commit is contained in:
Knut Urdalen 2011-06-25 04:50:42 +00:00
parent 6bf101db54
commit bf61fbb33a
4 changed files with 56 additions and 71 deletions

View file

@ -8,23 +8,19 @@ Daniel Londero <daniel.londero@gmail.com>
Francesco Trucchia <ft@ideato.it> Francesco Trucchia <ft@ideato.it>
Jacopo Romei <jacopo@sviluppoagile.it> Jacopo Romei <jacopo@sviluppoagile.it>
#Test Fest Cesena (Italy) on 2009-06-20 #Test Fest Cesena (Italy) on 2009-06-20
--SKIPIF--
<?php
if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
?>
--FILE-- --FILE--
<?php <?php
$dirname = basename(__FILE__, '.phpt');
shell_exec('mkdir test_dir_ptfi'); mkdir($dirname);
$dir = new DirectoryIterator('test_dir_ptfi'); $dir = new DirectoryIterator($dirname);
$result = shell_exec('ls -lnd test_dir_ptfi | cut -d" " -f 4'); $expected = filegroup($dirname);
$actual = $dir->getGroup();
var_dump($dir->getGroup() == $result); var_dump($expected == $actual);
?> ?>
--CLEAN-- --CLEAN--
<?php <?php
rmdir('test_dir_ptfi'); $dirname = basename(__FILE__, '.phpt');
rmdir($dirname);
?> ?>
--EXPECTF-- --EXPECTF--
bool(true) bool(true)

View file

@ -1,5 +1,5 @@
--TEST-- --TEST--
SPL: Spl Directory Iterator test getOwner SPL: DirectoryIterator test getOwner
--CREDITS-- --CREDITS--
Cesare D'Amico <cesare.damico@gruppovolta.it> Cesare D'Amico <cesare.damico@gruppovolta.it>
Andrea Giorgini <agiorg@gmail.com> Andrea Giorgini <agiorg@gmail.com>
@ -8,22 +8,19 @@ Daniel Londero <daniel.londero@gmail.com>
Francesco Trucchia <ft@ideato.it> Francesco Trucchia <ft@ideato.it>
Jacopo Romei <jacopo@sviluppoagile.it> Jacopo Romei <jacopo@sviluppoagile.it>
#Test Fest Cesena (Italy) on 2009-06-20 #Test Fest Cesena (Italy) on 2009-06-20
--SKIPIF--
<?php
if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
?>
--FILE-- --FILE--
<?php <?php
$dirname = basename(__FILE__, '.phpt');
shell_exec('mkdir test_dir_ptfi'); mkdir($dirname);
$dir = new DirectoryIterator('test_dir_ptfi'); $dir = new DirectoryIterator($dirname);
$result = shell_exec('ls -lnd test_dir_ptfi | cut -d" " -f 3'); $expected = fileowner($dirname);
var_dump($dir->getOwner() == $result); $actual = $dir->getOwner();
var_dump($expected == $actual);
?> ?>
--CLEAN-- --CLEAN--
<?php <?php
rmdir('test_dir_ptfi'); $dirname = basename(__FILE__, '.phpt');
rmdir($dirname);
?> ?>
--EXPECTF-- --EXPECTF--
bool(true) bool(true)

View file

@ -1,5 +1,5 @@
--TEST-- --TEST--
SPL: Spl File Info test getGroup SPL: SplFileInfo test getGroup
--CREDITS-- --CREDITS--
Cesare D'Amico <cesare.damico@gruppovolta.it> Cesare D'Amico <cesare.damico@gruppovolta.it>
Andrea Giorgini <agiorg@gmail.com> Andrea Giorgini <agiorg@gmail.com>
@ -8,23 +8,19 @@ Daniel Londero <daniel.londero@gmail.com>
Francesco Trucchia <ft@ideato.it> Francesco Trucchia <ft@ideato.it>
Jacopo Romei <jacopo@sviluppoagile.it> Jacopo Romei <jacopo@sviluppoagile.it>
#Test Fest Cesena (Italy) on 2009-06-20 #Test Fest Cesena (Italy) on 2009-06-20
--SKIPIF--
<?php
if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
?>
--FILE-- --FILE--
<?php <?php
$filename = basename(__FILE__, 'phpt').'tmp';
//file touch($filename);
touch ('test_file_ptfi'); $fileInfo = new SplFileInfo($filename);
$fileInfo = new SplFileInfo('test_file_ptfi'); $expected = filegroup($filename);
$result = shell_exec('ls -ln test_file_ptfi | cut -d" " -f 4'); $actual = $fileInfo->getGroup();
var_dump($fileInfo->getGroup() == $result); var_dump($expected == $actual);
?> ?>
--CLEAN-- --CLEAN--
<?php <?php
unlink('test_file_ptfi'); $filename = basename(__FILE__, 'phpt').'tmp';
unlink($filename);
?> ?>
--EXPECTF-- --EXPECTF--
bool(true) bool(true)

View file

@ -1,5 +1,5 @@
--TEST-- --TEST--
SPL: Spl File Info test getOwner SPL: SplFileInfo test getOwner
--CREDITS-- --CREDITS--
Cesare D'Amico <cesare.damico@gruppovolta.it> Cesare D'Amico <cesare.damico@gruppovolta.it>
Andrea Giorgini <agiorg@gmail.com> Andrea Giorgini <agiorg@gmail.com>
@ -8,23 +8,19 @@ Daniel Londero <daniel.londero@gmail.com>
Francesco Trucchia <ft@ideato.it> Francesco Trucchia <ft@ideato.it>
Jacopo Romei <jacopo@sviluppoagile.it> Jacopo Romei <jacopo@sviluppoagile.it>
#Test Fest Cesena (Italy) on 2009-06-20 #Test Fest Cesena (Italy) on 2009-06-20
--SKIPIF--
<?php
if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
?>
--FILE-- --FILE--
<?php <?php
$filename = basename(__FILE__, 'phpt').'tmp';
//file touch($filename);
touch ('test_file_ptfi'); $fileInfo = new SplFileInfo($filename);
$fileInfo = new SplFileInfo('test_file_ptfi'); $expected = fileowner($filename);
$result = shell_exec('ls -ln test_file_ptfi | cut -d" " -f 3'); $actual = $fileInfo->getOwner();
var_dump($fileInfo->getOwner() == $result); var_dump($expected == $actual);
?> ?>
--CLEAN-- --CLEAN--
<?php <?php
unlink('test_file_ptfi'); $filename = basename(__FILE__, 'phpt').'tmp';
unlink($filename);
?> ?>
--EXPECTF-- --EXPECTF--
bool(true) bool(true)