Skip to content

Commit 7053551

Browse files
committed
Discuss PHPT format in Testing section info
1 parent b160c62 commit 7053551

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

CONTRIBUTING.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,38 @@ make clean > /dev/null && make all > /dev/null && make install
2323

2424
## Testing
2525

26+
The extension's test use the PHPT format from PHP internals. This format is
27+
documented in the following links:
28+
29+
* [Introduction to PHPT Files](https://qa.php.net/write-test.php)
30+
* [PHPT - Test File Layout](https://qa.php.net/phpt_details.php)
31+
32+
Generally, most tests will be based on the following template:
33+
34+
```
35+
--TEST--
36+
Description of API or JIRA issue being tested
37+
--SKIPIF--
38+
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
39+
<?php /* One or more skip functions */ ?>
40+
--FILE--
41+
<?php
42+
require_once __DIR__ . "/../utils/basic.inc";
43+
44+
// Test code
45+
46+
?>
47+
===DONE===
48+
<?php exit(0); ?>
49+
--EXPECT--
50+
===DONE===
51+
```
52+
53+
The `basic-skipif.inc` and `basic.inc` files contain utility functions for the
54+
`SKIPIF` and `FILE` sections, respectively. If those functions are not needed
55+
(e.g. skip logic only depends on checking the `PHP_INT_SIZE` constant), the test
56+
should not include the file. When it doubt, keep it simple.
57+
2658
### Local Mongo Orchestration (and Travis CI)
2759

2860
The test suite depends on [Mongo Orchestration](https://github.com/10gen/mongo-orchestration).

0 commit comments

Comments
 (0)