@@ -364,6 +364,25 @@ function or an array function) , or a function provided by one of PHP's numerous
364
364
string\(19\) \" nica\x00turska panica\"
365
365
</pre>
366
366
367
+ <h3><a name="extensions" href="#extensions" class="anchor">#</a>EXTENSIONS</h3>
368
+ <p>Some tests depend on PHP extensions that may be unavailable. These extensions should
369
+ be listed in the EXTENSIONS section. If an extension is missing, PHP will try to find it in a
370
+ shared module and skip the test if it's not there.
371
+ </p>
372
+
373
+ <i>/ext/sodium/tests/crypto_scalarmult.phpt</i>
374
+ <pre>
375
+ --TEST--
376
+ Check for libsodium scalarmult
377
+ --EXTENSIONS--
378
+ sodium
379
+ --FILE--
380
+ <?php
381
+ $n = sodium_hex2bin("5dab087e624a8a4b79e17f8b83800ee66f3bb1292618b6fd1c2f8b27ff88e0eb");
382
+
383
+ [snip]
384
+ </pre>
385
+
367
386
<h3><a name="skipif" href="#skipif" class="anchor">#</a>SKIPIF</h3>
368
387
<p>Some tests depend on modules or functions available only in certain versions
369
388
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
372
391
the SKIPIF section must print out the word "skip" followed by a reason why
373
392
the test should skip.</p>
374
393
375
- <i>/ ext/exif /tests/exif005 .phpt</i>
394
+ <i>ext/sodium /tests/pwhash_argon2i .phpt</i>
376
395
<pre>
377
396
--TEST--
378
- Check for exif_read_data, unusual IFD start
397
+ Check for libsodium argon2i
398
+ --EXTENSIONS--
399
+ sodium
379
400
--SKIPIF--
380
401
<?php
381
- if (!extension_loaded('exif')) print 'skip exif extension not available';
382
- ?>
402
+ if (!defined('SODIUM_CRYPTO_PWHASH_SALTBYTES')) print "skip libsodium without argon2i"; ?>
383
403
--FILE--
384
- <?php
385
- /* Do not change this test it is a README.TESTING example.
386
- * test5.jpg is a 1*1 image that contains an Exif section with ifd = 00000009h
387
- */
388
- $image = exif_read_data('./ext/exif/tests/test5.jpg','',true,false);
389
- var_dump($image['IFD0']);
390
- ?>
391
- --EXPECT--
392
- array(2) {
393
- ["ImageDescription"]=>
394
- string(11) "Ifd00000009"
395
- ["DateTime"]=>
396
- string(19) "2002:10:18 20:06:00"
397
- }
404
+ [snip]
398
405
</pre>
399
406
400
407
<p>Test script and SKIPIF code should be directly written into *.phpt. However,
0 commit comments