Skip to content

Commit 20677ad

Browse files
authored
Automated doc testing (json-api-php#3)
1 parent 9f7d334 commit 20677ad

File tree

4 files changed

+17
-2
lines changed

4 files changed

+17
-2
lines changed

.doc2test.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
source = ./index.md
2+
destination = ./doc-test

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
composer.phar
2+
/vendor/
3+
composer.lock
4+
/doc-test

composer.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"require-dev": {
3+
"json-api-php/json-api": "^1.0",
4+
"doc2test/doc2test": "dev-master"
5+
},
6+
"scripts": {
7+
"test": "vendor/bin/doc2test && vendor/bin/phpunit -c doc-test/phpunit.xml --coverage-text"
8+
}
9+
}

index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ specification in a set of PHP 7 classes. We adhere to the following concepts:
1111
## Example
1212

1313
This JSON response...
14+
<!-- name=my_json -->
1415
```json
1516
{
1617
"data": [
@@ -111,10 +112,9 @@ This JSON response...
111112
}
112113
```
113114
...can be build with this PHP code
115+
<!-- assert=output expect=my_json -->
114116
```php
115117
<?php
116-
require_once __DIR__ . '/vendor/autoload.php';
117-
118118
use JsonApiPhp\JsonApi\Document;
119119
use JsonApiPhp\JsonApi\Document\Resource\Linkage\MultiLinkage;
120120
use JsonApiPhp\JsonApi\Document\Resource\Linkage\SingleLinkage;

0 commit comments

Comments
 (0)