Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yourls/yourls-test-suite-for-plugins
๐งช YOURLS test suite for plugins. Write unit tests for your YOURLS plugins!
https://github.com/yourls/yourls-test-suite-for-plugins
github-actions phpunit testing unit-tests yourls yourls-plugin
Last synced: 4 days ago
JSON representation
๐งช YOURLS test suite for plugins. Write unit tests for your YOURLS plugins!
- Host: GitHub
- URL: https://github.com/yourls/yourls-test-suite-for-plugins
- Owner: YOURLS
- License: mit
- Created: 2022-04-12T14:03:05.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-04-24T17:22:01.000Z (over 2 years ago)
- Last Synced: 2024-10-24T00:16:51.524Z (20 days ago)
- Topics: github-actions, phpunit, testing, unit-tests, yourls, yourls-plugin
- Language: Shell
- Homepage:
- Size: 30.3 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# YOURLS test suite for plugins [![Listed in Awesome YOURLS!](https://img.shields.io/badge/Awesome-YOURLS-C5A3BE)](https://github.com/YOURLS/awesome-yourls/)
> A PHPUnit tool for YOURLS plugins.
## About
The **YOURLS test suite for plugins** is a tool to test YOURLS plugins with standard PHPUnit tests.
This tool assumes basic knowledge of command line tools and of the [PHPUnit](https://phpunit.de/ "PHPUnit") framework.
## Usage
0. **Have a plugin with tests**
See the short [how-to guide](HOWTO.md) about writing unit tests for YOURLS plugins.1. **Install the YOURLS test suite for plugins**
In `my-cool-plugin/` :
```shell
$ git clone https://github.com/YOURLS/YOURLS-test-suite-for-plugins test-suite
```2. **Install the YOURLS test suite and the testing database**
```shell
$ bash test-suite/src/install-test-suite.sh [db-host, default localhost] [YOURLS version, default master]
```
Examples :
```shell
$ bash test-suite/src/install-test-suite.sh yourlstest root ""
$ bash test-suite/src/install-test-suite.sh yourlstest mydbuser mydbpassword mysql.myserver.com:666 1.8.2
```3. **Run your plugin unit tests**
Once you have written unit tests, run them :
```sh
$ phpunit -c ./test-suite/src/phpunit.xml
```
Expected result would be something like :
```sh
$ phpunit -c ./test-suite/src/phpunit.xml
YOURLS installed, starting PHPUnitPlugin Loaded : My cool plugin by Joe (my-cool-plugin/plugin.php)
PHPUnit 9.5.2 by Sebastian Bergmann and contributors.
...... 3 / 3 (100%)
Time: 00:00.007, Memory: 22.00 MB
OK (3 tests, 6 assertions)
$
```
4. **Automate tests**
On a Github repository, set up Github actions to automatically run tests when your plugin code changes, or when there's a
new version of YOURLS available. See the [workflows](WORKFLOWS.md) guide.## License
Free software. Do whatever the hell you want with it.
YOURLS is released under the [MIT license](LICENSE).