Re: com php-src: Merge branch 'pull-request/1817': ext/hash/tests/hash_update_file.phpt
| From: | Christoph M. Becker | Date: | Mon, 17 Oct 2016 16:44:06 +0000 |
| Subject: | Re: com php-src: Merge branch 'pull-request/1817': ext/hash/tests/hash_update_file.phpt | ||
| References: | 1 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-95170@lists.php.net to get a copy of this message | ||
On 17.10.2016 at 18:02, Joe Watkins wrote:
> Commit: dcae3ce1e618ef3fbbf74f1e80f2a589ac711895
> Author: Joe Watkins <krakjoe@php.net> Mon, 17 Oct 2016 16:49:24 +0100
> Parents: 4dfd5f4403be85d467992bf8a6bae4de40d4a06e
> Branches: PHP-7.1
>
> Link:
> http://git.php.net/?p=php-src.git;a=commitdiff;h=dcae3ce1e618ef3fbbf74f1e80f2a589ac711895
>
> Log:
> Merge branch 'pull-request/1817'
>
> Changed paths:
> A ext/hash/tests/hash_update_file.phpt
>
>
> Diff:
> diff --git a/ext/hash/tests/hash_update_file.phpt b/ext/hash/tests/hash_update_file.phpt
> new file mode 100644
> index 0000000..32ce962
> --- /dev/null
> +++ b/ext/hash/tests/hash_update_file.phpt
> @@ -0,0 +1,21 @@
> +--TEST--
> +bool hash_update_file ( resource $hcontext , string $filename [, resource $scontext = NULL ]
> );
> +--CREDITS--
> +marcosptf - <marcosptf@yahoo.com.br> - @phpsp - sao paulo - br
> +--SKIPIF--
> +<?php
> +if (phpversion() < "5.3.0") {
> + die('SKIP php version so lower.');
> +}
> +require_once(dirname(__FILE__) . '/skip_mhash.inc'); ?>
> +?>
> +--FILE--
> +<?php
> +$ctx = hash_init('md5');
> +$filePath = __DIR__ . DIRECTORY_SEPARATOR . 'sha1.phpt';
> +fopen($filePath, "r");
> +var_dump(hash_update_file($ctx, $filePath));
> +hash_final($ctx);
> +?>
> +--EXPECT--
> +bool(true)
This test is meaningless. It just checks that hash_update_file()
returns true (and that PHP hasn't crashed before the var_dump()).
Therefore it gives a false sense of code coverage.
It were meaningful, if the result of hash_final() was checked.
--
Christoph M. Becker