YOURLS/tests
jarebear6expepjozn6rakjq5iczi3irqwphcvbswgkahd6b6twnxxid 8e57e1a30a
Use sandbox for all included files (#3478)
- updated calls to functions
- deprecate function yourls_activate_plugin_sandbox()
- add unit tests
- log loaded files
- tweak yourls_debug_log to allow early uses

Co-authored-by: e-ht <1045813+e-ht@users.noreply.github>
Co-authored-by: eht <1045813+e-ht@users.noreply.github.com>
Co-authored-by: ྅༻ Ǭɀħ ༄༆ཉ <ozh@ozh.org>

Closes #3321
2023-02-12 13:31:46 +01:00
..
data Use sandbox for all included files (#3478) 2023-02-12 13:31:46 +01:00
includes Move to GitHub Actions (#2828) 2021-02-04 13:44:35 +01:00
tests Use sandbox for all included files (#3478) 2023-02-12 13:31:46 +01:00
.htaccess Forbid tests/ 2020-04-27 21:07:22 +02:00
README.md Move to GitHub Actions (#2828) 2021-02-04 13:44:35 +01:00
bootstrap.php Always include `functions-(upgrade|install).php` (#3354) 2022-05-29 14:27:25 +02:00
composer.json Move to GitHub Actions (#2828) 2021-02-04 13:44:35 +01:00
composer.lock Bump to php 8.1 and drop 7.2, 7.3 (#3230) 2022-02-21 19:53:27 +01:00

README.md

Unit Tests for YOURLS

About

This is the unit test suite for YOURLS : a collection of hundreds of tests to make sure that whenever something in YOURLS is added, changed or removed, everything still works under all the supported PHP versions.

Tests

If you want to run tests locally:

  1. Install PHPUnit
  2. Create an empty MySQL database and user. Do not use an exisiting database or you will lose data, guaranteed.
  3. Copy <YOURLS_ROOT>tests/data/config/yourls-tests-config-sample.php to <YOURLS_ROOT>/tests/yourls-tests-config.php and edit it to match your setup.
  4. In YOURLS root directory, you can now run the shell command:
$ phpunit

Hopefully you should see something like the following appear:

YOURLS installed, starting PHPUnit

PHPUnit 7.5.20 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.4.3
Configuration: D:\home\planetozh\ozh.in\phpunit.xml.dist

...............................................................  63 / 519 ( 12%)
............................................................... 126 / 519 ( 24%)
............................................................... 189 / 519 ( 36%)
............................................................... 252 / 519 ( 48%)
............................................................... 315 / 519 ( 60%)
............................................................... 378 / 519 ( 72%)
............................................................... 441 / 519 ( 84%)
............................................................... 504 / 519 ( 97%)
...............                                                 519 / 519 (100%)

Time: 6.06 seconds, Memory: 24.25Mb

OK (519 tests, 1123 assertions)

You can elect to run only selected groups of tests, eg:

$ phpunit --group formatting

See each @group directive in selected tests.

PHPUnit supports both phpunit.xml and phpunit.xml.dist, where phpunit.xml has higher priority: if you want to specify your own settings, copy phpunit.xml.dist to phpunit.xml and edit that file.