Skip to content

Commit e589868

Browse files
committed
Update docs with --EXTENSIONS-- information
1 parent fb387e5 commit e589868

File tree

1 file changed

+25
-18
lines changed

1 file changed

+25
-18
lines changed

write-test.php

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,25 @@ function or an array function) , or a function provided by one of PHP's numerous
364364
string\(19\) \" nica\x00turska panica\"
365365
</pre>
366366

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+
&lt;?php
381+
$n = sodium_hex2bin("5dab087e624a8a4b79e17f8b83800ee66f3bb1292618b6fd1c2f8b27ff88e0eb");
382+
383+
[snip]
384+
</pre>
385+
367386
<h3><a name="skipif" href="#skipif" class="anchor">#</a>SKIPIF</h3>
368387
<p>Some tests depend on modules or functions available only in certain versions
369388
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
372391
the SKIPIF section must print out the word "skip" followed by a reason why
373392
the test should skip.</p>
374393

375-
<i>/ext/exif/tests/exif005.phpt</i>
394+
<i>ext/sodium/tests/pwhash_argon2i.phpt</i>
376395
<pre>
377396
--TEST--
378-
Check for exif_read_data, unusual IFD start
397+
Check for libsodium argon2i
398+
--EXTENSIONS--
399+
sodium
379400
--SKIPIF--
380401
&lt;?php
381-
if (!extension_loaded('exif')) print 'skip exif extension not available';
382-
?&gt;
402+
if (!defined('SODIUM_CRYPTO_PWHASH_SALTBYTES')) print "skip libsodium without argon2i"; ?&gt;
383403
--FILE--
384-
&lt;?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-
?&gt;
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]
398405
</pre>
399406

400407
<p>Test script and SKIPIF code should be directly written into *.phpt. However,

0 commit comments

Comments
 (0)