Skip to content

Commit 768265c

Browse files
committed
Fix some more CLEAN sections
1 parent 86a0d4b commit 768265c

17 files changed

+42
-72
lines changed

ext/com_dotnet/tests/bug78650.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ print('OK');
1717
OK
1818
--CLEAN--
1919
<?php
20+
@rmdir(__DIR__ . '/bug78650/foo/bar');
21+
@rmdir(__DIR__ . '/bug78650/foo');
2022
rmdir(__DIR__ . '/bug78650/baz/bar');
21-
rmdir(__DIR__ . '/bug78650/foo/bar');
2223
rmdir(__DIR__ . '/bug78650/baz');
23-
rmdir(__DIR__ . '/bug78650/foo');
2424
rmdir(__DIR__ . '/bug78650');
2525
?>

ext/phar/tests/phar_buildfromdirectory2-win.phpt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@ try {
1919
echo $e->getMessage() . "\n";
2020
}
2121
?>
22-
--CLEAN--
23-
<?php
24-
unlink(__DIR__ . '/buildfromdirectory2.phar');
25-
__HALT_COMPILER();
26-
?>
2722
--EXPECTF--
2823
%s(24) "UnexpectedValueException"
2924
RecursiveDirectoryIterator::__construct(1): %s (code: 2)

ext/phar/tests/phar_gobyebye-win32.phpt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@ opendir("foo/hi");
2626
include $pname . '/foo/hi';
2727
?>
2828
--CLEAN--
29-
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
30-
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.2.php'); ?>
29+
<?php
30+
@unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php');
31+
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.2.php');
32+
?>
3133
--EXPECTF--
3234
Warning: readfile(foo/hi): Failed to open stream: No such file or directory in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
3335

ext/phar/tests/tar/phar_buildfromiterator4.phpt

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,15 @@ class myIterator implements Iterator
3535
reset($this->a);
3636
}
3737
}
38-
try {
39-
chdir(__DIR__);
40-
$phar = new Phar(__DIR__ . '/buildfromiterator.phar.tar');
41-
var_dump($phar->buildFromIterator(new myIterator(array('a' => basename(__FILE__, 'php') . 'phpt'))));
42-
var_dump($phar->isFileFormat(Phar::TAR));
43-
} catch (Exception $e) {
44-
var_dump(get_class($e));
45-
echo $e->getMessage() . "\n";
46-
}
38+
39+
chdir(__DIR__);
40+
$phar = new Phar(__DIR__ . '/buildfromiterator4.phar.tar');
41+
var_dump($phar->buildFromIterator(new myIterator(array('a' => basename(__FILE__, 'php') . 'phpt'))));
42+
var_dump($phar->isFileFormat(Phar::TAR));
4743
?>
4844
--CLEAN--
4945
<?php
50-
unlink(__DIR__ . '/buildfromiterator.phar.tar');
51-
__HALT_COMPILER();
46+
unlink(__DIR__ . '/buildfromiterator4.phar.tar');
5247
?>
5348
--EXPECTF--
5449
rewind

ext/phar/tests/tar/phar_buildfromiterator8.phpt

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,16 @@ phar
66
phar.readonly=0
77
--FILE--
88
<?php
9-
try {
10-
chdir(__DIR__);
11-
$phar = new Phar(__DIR__ . '/buildfromiterator.phar.tar');
12-
$a = $phar->buildFromIterator(new RegexIterator(new DirectoryIterator('.'), '/^frontcontroller\d{0,2}\.phar\.phpt\\z|^\.\\z|^\.\.\\z/'), __DIR__ . DIRECTORY_SEPARATOR);
13-
asort($a);
14-
var_dump($a);
15-
var_dump($phar->isFileFormat(Phar::TAR));
16-
} catch (Exception $e) {
17-
var_dump(get_class($e));
18-
echo $e->getMessage() . "\n";
19-
}
9+
chdir(__DIR__);
10+
$phar = new Phar(__DIR__ . '/buildfromiterator8.phar.tar');
11+
$a = $phar->buildFromIterator(new RegexIterator(new DirectoryIterator('.'), '/^frontcontroller\d{0,2}\.phar\.phpt\\z|^\.\\z|^\.\.\\z/'), __DIR__ . DIRECTORY_SEPARATOR);
12+
asort($a);
13+
var_dump($a);
14+
var_dump($phar->isFileFormat(Phar::TAR));
2015
?>
2116
--CLEAN--
2217
<?php
23-
unlink(__DIR__ . '/buildfromiterator.phar.tar');
24-
__HALT_COMPILER();
18+
unlink(__DIR__ . '/buildfromiterator8.phar.tar');
2519
?>
2620
--EXPECTF--
2721
array(21) {

ext/phar/tests/tar/phar_buildfromiterator9.phpt

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,15 @@ class myIterator implements Iterator
3535
reset($this->a);
3636
}
3737
}
38-
try {
39-
chdir(__DIR__);
40-
$phar = new Phar(__DIR__ . '/buildfromiterator.phar.tar');
41-
var_dump($phar->buildFromIterator(new myIterator(array('a' => $a = fopen(basename(__FILE__, 'php') . 'phpt', 'r')))));
42-
fclose($a);
43-
} catch (Exception $e) {
44-
var_dump(get_class($e));
45-
echo $e->getMessage() . "\n";
46-
}
38+
39+
chdir(__DIR__);
40+
$phar = new Phar(__DIR__ . '/buildfromiterator9.phar.tar');
41+
var_dump($phar->buildFromIterator(new myIterator(array('a' => $a = fopen(basename(__FILE__, 'php') . 'phpt', 'r')))));
42+
fclose($a);
4743
?>
4844
--CLEAN--
4945
<?php
50-
unlink(__DIR__ . '/buildfromiterator.phar.tar');
51-
__HALT_COMPILER();
46+
unlink(__DIR__ . '/buildfromiterator9.phar.tar');
5247
?>
5348
--EXPECTF--
5449
rewind

ext/sockets/tests/socket_clear_error-win32.phpt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,6 @@ var_dump(socket_last_error($socket));
1919
socket_clear_error($socket);
2020
var_dump(socket_last_error($socket));
2121
?>
22-
--CLEAN--
23-
<?php
24-
socket_close($socket);
25-
unset($socket);
26-
unset($socketConn);
27-
?>
2822
--EXPECTF--
2923
Warning: socket_connect(): unable to connect [%d]: No connection could be made because the target machine actively refused it in %s on line %d
3024
int(%d)

ext/spl/tests/RecursiveDirectoryIterator_hasChildren.phpt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ bool(false)
3030
--CLEAN--
3131
<?php
3232
$dir = __DIR__ . DIRECTORY_SEPARATOR . 'symlinktest';
33-
unlink($dir . DIRECTORY_SEPARATOR . 'symlink');
33+
if (PHP_OS_FAMILY == 'Windows') {
34+
rmdir($dir . DIRECTORY_SEPARATOR . 'symlink');
35+
} else {
36+
unlink($dir . DIRECTORY_SEPARATOR . 'symlink');
37+
}
3438
rmdir($dir);
3539
?>

ext/spl/tests/SplFileInfo_getExtension_basic.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ foreach ($exts as $ext) {
1515
$file = md5('SplFileInfo::getExtension');
1616
$exts = array('.txt', '.extension', '..', '.', '');
1717
foreach ($exts as $ext) {
18-
unlink($file . $ext);
18+
@unlink($file . $ext);
1919
}
2020
?>
2121
--EXPECT--

ext/standard/tests/file/005_variation-win32.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ unlink($file_path."/005_variation_softlink.tmp");
139139
unlink($file_path."/005_variation_hardlink.tmp");
140140
unlink($file_path."/005_variation1.tmp");
141141
unlink($file_path."/005_variation_copy.tmp");
142-
unlink($file_path."/005_variation_touch.tmp");
142+
@unlink($file_path."/005_variation_touch.tmp");
143143
unlink($file_path."/005_variation_touch_fly.tmp");
144144
unlink($file_path."/005_variation_touch_new.tmp");
145145
?>

ext/standard/tests/file/bug65701.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ var_dump(filesize($dst));
2222
<?php
2323
$file_path = __DIR__ . "/bug65701/";
2424
foreach (scandir($file_path) as $file) {
25-
if (strpos($file, "bug65701") !== false || 'WIN' == substr(PHP_OS, 0, 3)) {
25+
if (!is_dir($file_path . $file)) {
2626
unlink($file_path . $file);
2727
}
2828
}

ext/standard/tests/file/copy_variation12-win32.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ echo "*** Done ***\n";
2727
?>
2828
--CLEAN--
2929
<?php
30-
unlink(__DIR__."/copy_copy_variation12");
3130
rmdir(__DIR__."/copy_variation12");
3231
?>
3332
--EXPECTF--

ext/standard/tests/file/realpath_basic4.phpt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,13 @@ echo "2. " . realpath("$file_path/realpath_basic4/link2/test") . "\n";
1212
--CLEAN--
1313
<?php
1414
$file_path = __DIR__;
15-
unlink("$file_path/realpath_basic4/link2");
16-
unlink("$file_path/realpath_basic4/link1");
15+
if (PHP_OS_FAMILY == 'Windows') {
16+
rmdir("$file_path/realpath_basic4/link2");
17+
rmdir("$file_path/realpath_basic4/link1");
18+
} else {
19+
unlink("$file_path/realpath_basic4/link2");
20+
unlink("$file_path/realpath_basic4/link1");
21+
}
1722
rmdir("$file_path/realpath_basic4/home/test");
1823
rmdir("$file_path/realpath_basic4/home");
1924
rmdir("$file_path/realpath_basic4");

ext/standard/tests/file/rename_variation-win32.phpt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,12 @@ foreach($src_filenames as $src_filename) {
4646
unlink($dest_filename);
4747
}
4848

49-
rmdir("$file_path/rename_variation");
50-
5149
echo "Done\n";
5250
?>
5351
--CLEAN--
5452
<?php
5553
$file_path = __DIR__;
56-
unlink($file_path."/rename_variation_link.tmp");
57-
unlink($file_path."/rename_variation.tmp");
58-
rmdir($file_path."/rename_variation_dir");
54+
rmdir($file_path."/rename_variation");
5955
?>
6056
--EXPECTF--
6157
*** Testing rename() : rename files across directories ***

ext/standard/tests/file/rename_variation1-win32.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@ echo "Done\n";
5555
--CLEAN--
5656
<?php
5757
$file_path = __DIR__;
58-
unlink($file_path."/rename_variation_link.tmp");
59-
unlink($file_path."/rename_variation.tmp");
6058
rmdir($file_path."/rename_variation_dir");
6159
?>
6260
--EXPECT--

ext/standard/tests/file/rename_variation2-win32.phpt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,12 @@ var_dump( rename($file_path."/rename_variation2_dir/", $file_path."/12345") );
3434
var_dump( file_exists($file_path."/rename_variation2_dir" ) ); // expecting false
3535
var_dump( file_exists($file_path."/12345" ) ); // expecting true
3636

37-
rmdir($file_path."/12345");
38-
3937
echo "Done\n";
4038
?>
4139
--CLEAN--
4240
<?php
4341
$file_path = __DIR__;
44-
unlink($file_path."/rename_variation2_link.tmp");
45-
unlink($file_path."/rename_variation2.tmp");
46-
rmdir($file_path."/rename_variation2_dir");
42+
rmdir($file_path."/12345");
4743
?>
4844
--EXPECT--
4945
*** Testing rename() by renaming a file and directory to numeric name ***

ext/standard/tests/file/rename_variation3-win32.phpt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,6 @@ echo "Done\n";
5151
--CLEAN--
5252
<?php
5353
$file_path = __DIR__;
54-
unlink($file_path."/rename_variation3_link.tmp");
55-
unlink($file_path."/rename_variation3.tmp");
56-
rmdir($file_path."/rename_variation3_dir");
5754
rmdir($file_path."/rename_variation3.tmp");
5855
?>
5956
--EXPECTF--

0 commit comments

Comments
 (0)