[ Index ]

PHP Cross Reference of YOURLS

title

Body

[close]

/tests/ -> README.md (source)

   1  Unit Tests for [YOURLS](https://github.com/YOURLS/YOURLS/)
   2  =================
   3  
   4  
   5  About
   6  -----
   7  
   8  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.
   9  
  10  Tests
  11  -----------
  12  If you want to run tests locally:
  13  
  14  0. Install PHPUnit
  15  1. Create an empty MySQL database and user. **Do not use an exisiting database** or you will lose data, guaranteed.  
  16  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.  
  17  4. In YOURLS root directory, you can now run the shell command:
  18  ```bash
  19  $ phpunit
  20  ```
  21  
  22  Hopefully you should see something like the following appear:
  23  
  24  ```
  25  YOURLS installed, starting PHPUnit
  26  
  27  PHPUnit 7.5.20 by Sebastian Bergmann and contributors.
  28  
  29  Runtime:       PHP 7.4.3
  30  Configuration: D:\home\planetozh\ozh.in\phpunit.xml.dist
  31  
  32  ...............................................................  63 / 519 ( 12%)
  33  ............................................................... 126 / 519 ( 24%)
  34  ............................................................... 189 / 519 ( 36%)
  35  ............................................................... 252 / 519 ( 48%)
  36  ............................................................... 315 / 519 ( 60%)
  37  ............................................................... 378 / 519 ( 72%)
  38  ............................................................... 441 / 519 ( 84%)
  39  ............................................................... 504 / 519 ( 97%)
  40  ...............                                                 519 / 519 (100%)
  41  
  42  Time: 6.06 seconds, Memory: 24.25Mb
  43  
  44  OK (519 tests, 1123 assertions)
  45  ```
  46  
  47  You can elect to run only selected groups of tests, eg:
  48  
  49  ```bash
  50  $ phpunit --group formatting
  51  ```
  52  
  53  See each `@group` directive in selected tests.
  54  
  55  PHPUnit supports both `phpunit.xml` and `phpunit.xml.dist`, where `phpunit.xml` has higher priority:
  56  if you want to specify your own settings, copy `phpunit.xml.dist` to `phpunit.xml` and edit that file.


Generated: Tue Jan 21 05:10:11 2025 Cross-referenced by PHPXref 0.7.1