Skip to content

Commit f312aba

Browse files
Document using functional test scripts (#153)
1 parent 5b92607 commit f312aba

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

README.md

+11-4
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ The constructor takes a single parameter, `$envPrefix`, which is upper-cased and
5151
* [Process configuration](#process-configuration)
5252
* [Troubleshooting](#troubleshooting)
5353
* [Extending the library](#extending-the-library)
54+
* [Examples](#examples)
5455

5556
### How it works
5657

@@ -64,6 +65,8 @@ A temporary ini file is created from the loaded (and scanned) ini files, with an
6465
* The application runs and exits.
6566
* The main process exits with the exit code from the restarted process.
6667

68+
See [Examples](#examples) for further information.
69+
6770
#### Signal handling
6871
Asynchronous signal handling is automatically enabled if the pcntl extension is loaded. `SIGINT` is set to `SIG_IGN` in the parent
6972
process and restored to `SIG_DFL` in the restarted process (if no other handler has been set).
@@ -74,7 +77,7 @@ From PHP 7.4 on Windows, `CTRL+C` and `CTRL+BREAK` handling is automatically ena
7477
There are a few things to be aware of when running inside a restarted process.
7578

7679
* Extensions set on the command-line will not be loaded.
77-
* Ini file locations will be reported as per the restart - see [getAllIniFiles()](#getallinifiles).
80+
* Ini file locations will be reported as per the restart - see [getAllIniFiles()](#getallinifiles-array).
7881
* Php sub-processes may be loaded with Xdebug enabled - see [Process configuration](#process-configuration).
7982

8083
### Helper methods
@@ -200,12 +203,12 @@ Uses environment variables to remove Xdebug from the new process and persist the
200203

201204
>_If the new process calls a PHP sub-process, Xdebug will not be loaded in that sub-process._
202205
203-
This strategy can be used in the restart by calling [setPersistent()](#setpersistent).
206+
This strategy can be used in the restart by calling [setPersistent()](#setpersistent-self).
204207

205208
#### Sub-processes
206209
The `PhpConfig` helper class makes it easy to invoke a PHP sub-process (with or without Xdebug loaded), regardless of whether there has been a restart.
207210

208-
Each of its methods returns an array of PHP options (to add to the command-line) and sets up the environment for the required strategy. The [getRestartSettings()](#getrestartsettings) method is used internally.
211+
Each of its methods returns an array of PHP options (to add to the command-line) and sets up the environment for the required strategy. The [getRestartSettings()](#getrestartsettings-array) method is used internally.
209212

210213
* `useOriginal()` - Xdebug will be loaded in the new process.
211214
* `useStandard()` - Xdebug will **not** be loaded in the new process - see [standard settings](#standard-settings).
@@ -245,7 +248,7 @@ The API is defined by classes and their accessible elements that are not annotat
245248
By default the process will restart if Xdebug is loaded and not running with `xdebug.mode=off`. Extending this method allows an application to decide, by returning a boolean (or equivalent) value.
246249
It is only called if `MYAPP_ALLOW_XDEBUG` is empty, so it will not be called in the restarted process (where this variable contains internal data), or if the restart has been overridden.
247250

248-
Note that the [setMainScript()](#setmainscriptscript) and [setPersistent()](#setpersistent) setters can be used here, if required.
251+
Note that the [setMainScript()](#setmainscriptstring-script-self) and [setPersistent()](#setpersistent-self) setters can be used here, if required.
249252

250253
#### _restart(array $command): void_
251254
An application can extend this to modify the temporary ini file, its location given in the `tmpIni` property. New settings can be safely appended to the end of the data, which is `PHP_EOL` terminated.
@@ -294,5 +297,9 @@ class MyRestarter extends XdebugHandler
294297
}
295298
```
296299

300+
### Examples
301+
The `tests\App` directory contains command-line scripts that demonstrate the internal workings in a variety of scenarios.
302+
See [Functional Test Scripts](./tests/App/README.md).
303+
297304
## License
298305
composer/xdebug-handler is licensed under the MIT License, see the LICENSE file for details.

tests/App/README.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
This folder contains the PHP scripts that produce the output for the functional tests.
44

5-
They can be run from the command-line to provide a visual representation of xdebug-handler's inner
6-
workings.
5+
They can also be run from the command-line to provide a visual representation of xdebug-handler's
6+
inner workings.
77

88
## Usage
99

@@ -27,6 +27,9 @@ The `--display` options provides colorized output with a detailed list of xdebug
2727

2828
These values are obtained after any restart has happened.
2929

30+
Each line of output is prefixed `name[pid]`, where name is either 'logger' (for xdebug-handler's
31+
internal logger) or the name of the script, and pid is the process identifier.
32+
3033
## Scripts
3134

3235
The following scripts are in addition to the core scripts (which are used by some of these).

0 commit comments

Comments
 (0)