From e5898683fd004ae857db053542c4fe4f77f38e28 Mon Sep 17 00:00:00 2001 From: Max Semenik Date: Sun, 18 Apr 2021 13:46:35 +0300 Subject: [PATCH] Update docs with --EXTENSIONS-- information --- write-test.php | 43 +++++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/write-test.php b/write-test.php index 2175763..cee6f24 100644 --- a/write-test.php +++ b/write-test.php @@ -364,6 +364,25 @@ function or an array function) , or a function provided by one of PHP's numerous string\(19\) \" nica\x00turska panica\" +

#EXTENSIONS

+

Some tests depend on PHP extensions that may be unavailable. These extensions should +be listed in the EXTENSIONS section. If an extension is missing, PHP will try to find it in a +shared module and skip the test if it's not there. +

+ +/ext/sodium/tests/crypto_scalarmult.phpt +
+--TEST--
+Check for libsodium scalarmult
+--EXTENSIONS--
+sodium
+--FILE--
+<?php
+$n = sodium_hex2bin("5dab087e624a8a4b79e17f8b83800ee66f3bb1292618b6fd1c2f8b27ff88e0eb");
+
+[snip]
+
+

#SKIPIF

Some tests depend on modules or functions available only in certain versions or they even require minimum version of php or zend. These tests should be @@ -372,29 +391,17 @@ function or an array function) , or a function provided by one of PHP's numerous the SKIPIF section must print out the word "skip" followed by a reason why the test should skip.

-/ext/exif/tests/exif005.phpt +ext/sodium/tests/pwhash_argon2i.phpt
 --TEST--
-Check for exif_read_data, unusual IFD start
+Check for libsodium argon2i
+--EXTENSIONS--
+sodium
 --SKIPIF--
 <?php
-	if (!extension_loaded('exif')) print 'skip exif extension not available';
-?>
+if (!defined('SODIUM_CRYPTO_PWHASH_SALTBYTES')) print "skip libsodium without argon2i"; ?>
 --FILE--
-<?php
-/* Do not change this test it is a README.TESTING example.
- * test5.jpg is a 1*1 image that contains an Exif section with ifd = 00000009h
- */
-$image  = exif_read_data('./ext/exif/tests/test5.jpg','',true,false);
-var_dump($image['IFD0']);
-?>
---EXPECT--
-array(2) {
-  ["ImageDescription"]=>
-  string(11) "Ifd00000009"
-  ["DateTime"]=>
-  string(19) "2002:10:18 20:06:00"
-}
+[snip]
 

Test script and SKIPIF code should be directly written into *.phpt. However,