Skip to content

Commit

Permalink
Test cleanup improvements, files might be locked in the test process
Browse files Browse the repository at this point in the history
  • Loading branch information
weltling committed Aug 14, 2017
1 parent 71fd586 commit ab07265
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
8 changes: 6 additions & 2 deletions ext/standard/tests/file/bug65272.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if (stripos(PHP_OS, 'win') !== 0) die("skip windows required");
--FILE--
<?php

$file = dirname(__FILE__)."/flock.dat";
$file = dirname(__FILE__)."/flock_bug65272.dat";

$fp1 = fopen($file, "w");
var_dump(flock($fp1, LOCK_SH));
Expand All @@ -16,9 +16,13 @@ $fp2 = fopen($file, "r");
var_dump(flock($fp2, LOCK_EX|LOCK_NB, $wouldblock));
var_dump($wouldblock);

@unlink($file);
echo "Done\n";
?>
--CLEAN--
<?php
$file = dirname(__FILE__)."/flock_bug65272.dat";
unlink($file);
?>
--EXPECTF--
bool(true)
bool(false)
Expand Down
7 changes: 5 additions & 2 deletions ext/standard/tests/file/fgetss1.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,13 @@ foreach ($array as $str) {
var_dump(fgetss($fp, 10, "<script>,<a>"));
}

@unlink($filename);

echo "Done\n";
?>
--CLEAN--
<?php
$filename = dirname(__FILE__)."/fgetss1.html";
unlink($filename);
?>
--EXPECTF--
string(21) "askasdfasdf<b>aaaaaa
"
Expand Down
6 changes: 5 additions & 1 deletion ext/standard/tests/file/flock.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,13 @@ var_dump($would);
var_dump(flock($fp, -1));
var_dump(flock($fp, 0));

@unlink($file);
echo "Done\n";
?>
--CLEAN--
<?php
$file = dirname(__FILE__)."/flock.dat";
unlink($file);
?>
--EXPECTF--
Warning: flock() expects at least 2 parameters, 0 given in %s on line %d
NULL
Expand Down
6 changes: 5 additions & 1 deletion ext/standard/tests/file/fscanf.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,13 @@ file_put_contents($filename, "data");
$fp = fopen($filename, "rt");
var_dump(fscanf($fp, "%s%d", $v));

@unlink($filename);
echo "Done\n";
?>
--CLEAN--
<?php
$filename = dirname(__FILE__)."/fscanf.dat";
unlink($filename);
?>
--EXPECTF--
Warning: fscanf() expects at least 2 parameters, 0 given in %s on line %d
NULL
Expand Down

0 comments on commit ab07265

Please sign in to comment.