Skip to content

mattsches/s9y-plugins-phpunit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

s9y-plugins-phpunit

Files to enable unit testing Serendipity plugins using PHPUnit.

Requirements

This has been tested with

  • PHP 5.3.6, 5.5.3
  • Serendipity 1.7-alpha1, 2.0-beta4
  • PHPUnit 3.6.12, 3.7.24
  • An active PSO_SQLITE PDO driver for PHP

Installation

Clone this repository into the S9Y_ROOT/tests/plugins directory

git clone https://github.com/mattsches/s9y-plugins-phpunit tests/plugins.

Copy phpunit.xml.dist to phpunit.xml (and edit if needed).

Writing tests

Unit tests go into a tests directory under each plugin directory and should have the name of the plugin, e.g. S9Y_ROOT/plugins/serendipity_event_foobar/tests/foobarTest.php. There is an example file in the example directory of this repository.

Running tests

You can run your unit tests from the Serendipity root directory:

phpunit -c tests/plugins/phpunit.xml plugins/serendipity_event_foobar/tests/foobarTest.php

or simply

phpunit -c tests/plugins/phpunit.xml

to run all plugin unit tests.

You can also set up your IDE to run phpunit tests, e.g. in PhpStorm use the following in Project Settings > PHP > PHPUnit > Test Runner:

  • Use configuration file: /path/to/tests/plugins/phpunit.xml
  • Use bootstrap file: /path/to/tests/plugins/bootstrap.php

About

Files to enable unit testing Serendipity plugins using PHPUnit

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages