Skip to content

🧪 YOURLS test suite for plugins. Write unit tests for your YOURLS plugins!

License

Notifications You must be signed in to change notification settings

YOURLS/YOURLS-test-suite-for-plugins

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

YOURLS test suite for plugins Listed in 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 framework.

Usage

  1. Have a plugin with tests
    See the short how-to guide about writing unit tests for YOURLS plugins.

  2. Install the YOURLS test suite for plugins
    In my-cool-plugin/ :

    $ git clone https://github.com/YOURLS/YOURLS-test-suite-for-plugins test-suite
  3. Install the YOURLS test suite and the testing database

    $ bash test-suite/src/install-test-suite.sh <db-name> <db-user> <db-password> [db-host, default localhost] [YOURLS version, default master]

    Examples :

    $ 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
  4. Run your plugin unit tests
    Once you have written unit tests, run them :

    $ phpunit -c ./test-suite/src/phpunit.xml

    Expected result would be something like :

    $ phpunit -c ./test-suite/src/phpunit.xml
    YOURLS installed, starting PHPUnit
    
    Plugin 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)
    $
  5. 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 guide.

License

Free software. Do whatever the hell you want with it. YOURLS is released under the MIT license.

About

🧪 YOURLS test suite for plugins. Write unit tests for your YOURLS plugins!

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published