Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test fwrite and fread with both tmpfile() and fopen()
- Loading branch information
Showing
3 changed files
with
40 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--TEST-- | ||
Calls to fwrite and fread are logged | ||
--SKIPIF-- | ||
<?php if (!extension_loaded("scoutapm")) die("skip scoutapm extension required."); ?> | ||
--FILE-- | ||
<?php | ||
$fh = fopen(tempnam(sys_get_temp_dir(), 'scoutapm-test'), 'w+'); | ||
|
||
fwrite($fh, "fread/fwrite test\n"); | ||
fseek($fh, 0); | ||
echo fread($fh, 18); | ||
fclose($fh); | ||
|
||
$calls = scoutapm_get_calls(); | ||
|
||
var_dump($calls[0]['function']); | ||
var_dump($calls[0]['argv']); | ||
|
||
var_dump($calls[1]['function']); | ||
var_dump($calls[1]['argv']); | ||
?> | ||
--EXPECTF-- | ||
fread/fwrite test | ||
string(6) "fwrite" | ||
array(2) { | ||
[0]=> | ||
resource(%d) of type (Unknown) | ||
[1]=> | ||
string(18) "fread/fwrite test | ||
" | ||
} | ||
string(5) "fread" | ||
array(2) { | ||
[0]=> | ||
string(24) "/tmp/scoutapm-test%s" | ||
[1]=> | ||
string(2) "w+" | ||
} |