-
-
Notifications
You must be signed in to change notification settings - Fork 21
/
mddoc.xml
91 lines (89 loc) · 4.24 KB
/
mddoc.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<mddoc>
<docpage target="README.md" autoloader="psr4" autoloader-root="src"
autoloader-root-namespace="donatj\MockWebServer">
<section title="Mock Web Server">
<badge-poser type="version"/>
<badge-poser type="license"/>
<badge-github-action name="donatj/mock-webserver" workflow-file="ci.yml" />
<text><![CDATA[Simple, easy to use Mock Web Server for PHP unit testing. Gets along simply with PHPUnit and other unit testing frameworks.
Unit testing HTTP requests can be difficult, especially in cases where injecting a request library is difficult or not ideal. This helps greatly simplify the process.
Mock Web Server creates a local Web Server you can make predefined requests against.
]]></text>
<section title="Documentation">
<docpage target="docs/docs.md" autoloader="psr4" autoloader-root="src"
autoloader-root-namespace="donatj\MockWebServer">
<replace regex="true" search="/127\.0\.0\.1:\d+/" replace="127.0.0.1:8123">
<section title="Documentation">
<file name="src/MockWebServer.php"/>
<file name="src/Response.php"/>
<file name="src/ResponseStack.php"/>
<file name="src/ResponseByMethod.php"/>
<file name="src/DelayedResponse.php"/>
<section title="Built-In Responses">
<file name="src/Responses/DefaultResponse.php"/>
<file name="src/Responses/NotFoundResponse.php"/>
</section>
</section>
</replace>
</docpage>
</section>
<section title="Requirements">
<composer-requires/>
</section>
<section title="Installing">
<composer-install dev="true"/>
</section>
<replace search="%:\d{4,}%" replace=":61874" regex="true">
<replace search="%PHP/[\d.]+%" replace="PHP/7.3.25" regex="true">
<replace search="/Date: .*/" replace="Date: Tue, 31 Aug 2021 19:50:15 GMT" regex="true">
<section title="Examples">
<section title="Basic Usage">
<text><![CDATA[The following example shows the most basic usage. If you do not define a path, the server will simply bounce a JSON body describing the request back to you.]]></text>
<source name="example/basic.php" lang="php"/>
<text>Outputs:</text>
<exec cmd="php example/basic.php" format="code-block"/>
</section>
<section title="Simple">
<source name="example/simple.php" lang="php"/>
<text>Outputs:</text>
<exec cmd="php example/simple.php" format="code-block"/>
</section>
<section title="Change Default Response">
<source name="example/notfound.php" lang="php"/>
<text>Outputs:</text>
<exec cmd="php example/notfound.php" format="code-block"/>
</section>
<section title="PHPUnit">
<source name="example/phpunit.php" lang="php"/>
</section>
<section title="Delayed Response Usage">
<text><![CDATA[By default responses will happen instantly. If you're looking to test timeouts, the DelayedResponse response wrapper may be useful.]]></text>
<source name="example/delayed.php" lang="php"/>
<text>Outputs:</text>
<replace regex="true" search="%Realtime Request took: 0\.\d+ seconds%" replace="Realtime Request took: 0.015669107437134 seconds">
<replace regex="true" search="%Delayed Request took: 0\.\d+ seconds%" replace="Delayed Request took: 0.10729098320007 seconds">
<exec cmd="php example/delayed.php" format="code-block" />
</replace>
</replace>
</section>
</section>
<section title="Multiple Responses from the Same Endpoint">
<section title="Response Stack">
<text>If you need an ordered set of responses, that can be done using the ResponseStack.</text>
<source name="example/multi.php" lang="php"/>
<text>Outputs:</text>
<exec cmd="php example/multi.php" format="code-block"/>
</section>
<section title="Response by Method">
<text>If you need to vary responses to a single endpoint by method, you can do that using the ResponseByMethod response object.</text>
<source name="example/methods.php" lang="php"/>
<text>Outputs:</text>
<exec cmd="php example/methods.php" format="code-block"/>
</section>
</section>
</replace>
</replace>
</replace>
</section>
</docpage>
</mddoc>