summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKnut Urdalen <knut@php.net>2011-06-25 04:50:42 +0000
committerKnut Urdalen <knut@php.net>2011-06-25 04:50:42 +0000
commitf8e21c395b901a301c3bc622435fc01d533d9768 (patch)
tree02f91ceb96b938e902509ca06f27f9d530cb272d
parentd70a9f988dabe68346caede1bc5d168432dfd796 (diff)
downloadphp-git-f8e21c395b901a301c3bc622435fc01d533d9768.tar.gz
fixed/refactored some spl tests related to owner/group retrieval
-rw-r--r--ext/spl/tests/DirectoryIterator_getGroup_basic.phpt20
-rw-r--r--ext/spl/tests/DirectoryIterator_getOwner_basic.phpt35
-rw-r--r--ext/spl/tests/SplFileInfo_getGroup_basic.phpt36
-rw-r--r--ext/spl/tests/SplFileInfo_getOwner_basic.phpt36
4 files changed, 56 insertions, 71 deletions
diff --git a/ext/spl/tests/DirectoryIterator_getGroup_basic.phpt b/ext/spl/tests/DirectoryIterator_getGroup_basic.phpt
index 58387cccef..3573d85852 100644
--- a/ext/spl/tests/DirectoryIterator_getGroup_basic.phpt
+++ b/ext/spl/tests/DirectoryIterator_getGroup_basic.phpt
@@ -8,23 +8,19 @@ Daniel Londero <daniel.londero@gmail.com>
Francesco Trucchia <ft@ideato.it>
Jacopo Romei <jacopo@sviluppoagile.it>
#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--
<?php
-
-shell_exec('mkdir test_dir_ptfi');
-$dir = new DirectoryIterator('test_dir_ptfi');
-$result = shell_exec('ls -lnd test_dir_ptfi | cut -d" " -f 4');
-
-var_dump($dir->getGroup() == $result);
-
+$dirname = basename(__FILE__, '.phpt');
+mkdir($dirname);
+$dir = new DirectoryIterator($dirname);
+$expected = filegroup($dirname);
+$actual = $dir->getGroup();
+var_dump($expected == $actual);
?>
--CLEAN--
<?php
-rmdir('test_dir_ptfi');
+$dirname = basename(__FILE__, '.phpt');
+rmdir($dirname);
?>
--EXPECTF--
bool(true)
diff --git a/ext/spl/tests/DirectoryIterator_getOwner_basic.phpt b/ext/spl/tests/DirectoryIterator_getOwner_basic.phpt
index e342dcdb6f..f02cb6e04e 100644
--- a/ext/spl/tests/DirectoryIterator_getOwner_basic.phpt
+++ b/ext/spl/tests/DirectoryIterator_getOwner_basic.phpt
@@ -1,29 +1,26 @@
---TEST--
-SPL: Spl Directory Iterator test getOwner
---CREDITS--
+--TEST--
+SPL: DirectoryIterator test getOwner
+--CREDITS--
Cesare D'Amico <cesare.damico@gruppovolta.it>
Andrea Giorgini <agiorg@gmail.com>
Filippo De Santis <fd@ideato.it>
Daniel Londero <daniel.londero@gmail.com>
Francesco Trucchia <ft@ideato.it>
Jacopo Romei <jacopo@sviluppoagile.it>
-#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--
-<?php
-
-shell_exec('mkdir test_dir_ptfi');
-$dir = new DirectoryIterator('test_dir_ptfi');
-$result = shell_exec('ls -lnd test_dir_ptfi | cut -d" " -f 3');
-var_dump($dir->getOwner() == $result);
-
+#Test Fest Cesena (Italy) on 2009-06-20
+--FILE--
+<?php
+$dirname = basename(__FILE__, '.phpt');
+mkdir($dirname);
+$dir = new DirectoryIterator($dirname);
+$expected = fileowner($dirname);
+$actual = $dir->getOwner();
+var_dump($expected == $actual);
?>
--CLEAN--
<?php
-rmdir('test_dir_ptfi');
-?>
---EXPECTF--
+$dirname = basename(__FILE__, '.phpt');
+rmdir($dirname);
+?>
+--EXPECTF--
bool(true)
diff --git a/ext/spl/tests/SplFileInfo_getGroup_basic.phpt b/ext/spl/tests/SplFileInfo_getGroup_basic.phpt
index 7b0528d7d1..c5808c57d9 100644
--- a/ext/spl/tests/SplFileInfo_getGroup_basic.phpt
+++ b/ext/spl/tests/SplFileInfo_getGroup_basic.phpt
@@ -1,30 +1,26 @@
---TEST--
-SPL: Spl File Info test getGroup
---CREDITS--
+--TEST--
+SPL: SplFileInfo test getGroup
+--CREDITS--
Cesare D'Amico <cesare.damico@gruppovolta.it>
Andrea Giorgini <agiorg@gmail.com>
Filippo De Santis <fd@ideato.it>
Daniel Londero <daniel.londero@gmail.com>
Francesco Trucchia <ft@ideato.it>
Jacopo Romei <jacopo@sviluppoagile.it>
-#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--
-<?php
-
-//file
-touch ('test_file_ptfi');
-$fileInfo = new SplFileInfo('test_file_ptfi');
-$result = shell_exec('ls -ln test_file_ptfi | cut -d" " -f 4');
-var_dump($fileInfo->getGroup() == $result);
-
+#Test Fest Cesena (Italy) on 2009-06-20
+--FILE--
+<?php
+$filename = basename(__FILE__, 'phpt').'tmp';
+touch($filename);
+$fileInfo = new SplFileInfo($filename);
+$expected = filegroup($filename);
+$actual = $fileInfo->getGroup();
+var_dump($expected == $actual);
?>
--CLEAN--
<?php
-unlink('test_file_ptfi');
-?>
---EXPECTF--
+$filename = basename(__FILE__, 'phpt').'tmp';
+unlink($filename);
+?>
+--EXPECTF--
bool(true)
diff --git a/ext/spl/tests/SplFileInfo_getOwner_basic.phpt b/ext/spl/tests/SplFileInfo_getOwner_basic.phpt
index 50f79430c9..790dcc69ba 100644
--- a/ext/spl/tests/SplFileInfo_getOwner_basic.phpt
+++ b/ext/spl/tests/SplFileInfo_getOwner_basic.phpt
@@ -1,30 +1,26 @@
---TEST--
-SPL: Spl File Info test getOwner
---CREDITS--
+--TEST--
+SPL: SplFileInfo test getOwner
+--CREDITS--
Cesare D'Amico <cesare.damico@gruppovolta.it>
Andrea Giorgini <agiorg@gmail.com>
Filippo De Santis <fd@ideato.it>
Daniel Londero <daniel.londero@gmail.com>
Francesco Trucchia <ft@ideato.it>
Jacopo Romei <jacopo@sviluppoagile.it>
-#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--
-<?php
-
-//file
-touch ('test_file_ptfi');
-$fileInfo = new SplFileInfo('test_file_ptfi');
-$result = shell_exec('ls -ln test_file_ptfi | cut -d" " -f 3');
-var_dump($fileInfo->getOwner() == $result);
-
+#Test Fest Cesena (Italy) on 2009-06-20
+--FILE--
+<?php
+$filename = basename(__FILE__, 'phpt').'tmp';
+touch($filename);
+$fileInfo = new SplFileInfo($filename);
+$expected = fileowner($filename);
+$actual = $fileInfo->getOwner();
+var_dump($expected == $actual);
?>
--CLEAN--
<?php
-unlink('test_file_ptfi');
-?>
---EXPECTF--
+$filename = basename(__FILE__, 'phpt').'tmp';
+unlink($filename);
+?>
+--EXPECTF--
bool(true)