mirror of
https://github.com/php/php-src.git
synced 2026-04-16 20:41:18 +02:00
We're not only checking that hash_update_file() succeeds, but rather that it properly works. Furthermore, we fix the SKIPIF section – we don't need mhash to run the test, and we don't need to check for unsupported PHP versions. We also shorten the test name to avoid cluttering the test reports with unnecessary detail.
25 lines
619 B
PHP
25 lines
619 B
PHP
--TEST--
|
|
hash_update_file() function - basic test
|
|
--CREDITS--
|
|
marcosptf - <marcosptf@yahoo.com.br> - @phpsp - sao paulo - br
|
|
--SKIPIF--
|
|
<?php
|
|
if (!extension_loaded('hash')) die('skip hash extension not available');
|
|
?>
|
|
--FILE--
|
|
<?php
|
|
$filePath = __DIR__ . DIRECTORY_SEPARATOR . 'hash_update_stream.txt';
|
|
file_put_contents($filePath, 'The quick brown fox jumped over the lazy dog.');
|
|
|
|
$ctx = hash_init('md5');
|
|
var_dump(hash_update_file($ctx, $filePath));
|
|
echo hash_final($ctx);
|
|
?>
|
|
--EXPECT--
|
|
bool(true)
|
|
5c6ffbdd40d9556b73a21e63c3e0e904
|
|
--CLEAN--
|
|
<?php
|
|
unlink(__DIR__ . DIRECTORY_SEPARATOR . 'hash_update_stream.txt');
|
|
?>
|