SimpleTest - Unit Testing for PHP
PHP XSLT HTML JavaScript Shell CSS
Permalink
Failed to load latest commit information.
.phan added config for Phan (Static Analyser), referencing https://github.c… Dec 22, 2016
docs Using the modern versionless html DOCTYPE: Nov 23, 2016
extensions cleanup extension CodeCoverage Dec 25, 2016
packages Using the modern versionless html DOCTYPE: Nov 23, 2016
test welcome to reflection hell. do not add "abstract" to interface methods Dec 22, 2016
tutorials/SimpleTest replace deprecated setReturnValue() with returns(). Dec 3, 2015
.gitattributes added two more files to ignore Dec 3, 2015
.gitignore ignore from gitattributes files to shrink zip Dec 2, 2015
.php_cs enforce short_array_syntax on php-cs-fixer runs Jul 31, 2016
.travis.yml fix find warning: Jul 30, 2016
Changelog.md added config for Phan (Static Analyser), referencing https://github.c… Dec 22, 2016
HELP_MY_TESTS_DONT_WORK_ANYMORE Moving recoreder from extensions to core Mar 28, 2010
LICENSE License change Sep 11, 2006
README.md fix readme: probably add to require-dev instead of require Jul 30, 2016
TODO.xml Changing the TODO to reflect the "maintenance mode" Jan 12, 2012
VERSION fixed changelog compare links and updated VERSION Dec 6, 2015
arguments.php compute the size beforehand, and not on each iteration (moved count()… Jul 31, 2016
authentication.php cs fixes Dec 2, 2015
autorun.php return the status of the test suite and not always true Jul 30, 2016
browser.php added referer handling: new method setReferer() on UserAgent, getHead… Nov 30, 2016
collector.php replace deprecated usage of $test->addTestFile() with $test->addFile(). Dec 3, 2015
compatibility.php cs fixes Dec 2, 2015
composer.json removed "replace" section; added myself to authors [skip ci] Oct 25, 2016
cookies.php cs fixes Dec 2, 2015
default_reporter.php Merge branch 'master-sil' of https://github.com/sillsdev/simpletest i… Jul 30, 2016
detached.php removed unnecessary return-object-by-reference ampersands Dec 8, 2015
dumper.php removed concats in favor of sprintf Jul 31, 2016
eclipse.php fixed syntax error Jul 30, 2016
encoding.php cs fixes Dec 2, 2015
errors.php fix method signature of SimpleTestErrorHandler Aug 1, 2016
exceptions.php rename "coerce" to "force" Dec 22, 2016
expectation.php rename "coerce" to "force" Dec 22, 2016
form.php fix wrong param name Aug 1, 2016
frames.php removed explicit assign-object-by-reference ampersands Dec 8, 2015
http.php added referer handling: new method setReferer() on UserAgent, getHead… Nov 30, 2016
invoker.php cs fixes Dec 2, 2015
mock_objects.php welcome to reflection hell. do not add "abstract" to interface methods Dec 22, 2016
page.php docblock fix: mixed type string|bool Dec 22, 2016
php_parser.php renamed "Selectors" Aug 1, 2016
recorder.php cs fixes Dec 2, 2015
reflection.php refactoring: pull out into method getReturnType() Dec 22, 2016
remote.php cs fixes Dec 2, 2015
reporter.php Using the modern versionless html DOCTYPE: Nov 23, 2016
scorer.php compute the size beforehand, and not on each iteration Jul 31, 2016
selector.php renamed "Selectors" Aug 1, 2016
shell_tester.php fix phpdoc annotations Aug 1, 2016
simpletest.php renamed "reflection_php5.php" to "reflection", changed other files ac… Jul 31, 2016
socket.php prevent closing sockets which are already closed Dec 24, 2016
tag.php rename "coerce" to "force" Dec 22, 2016
test_case.php welcome to reflection hell. do not add "abstract" to interface methods Dec 22, 2016
tidy_parser.php use strict comparisons Dec 2, 2015
unit_tester.php rename "coerce" to "force" Dec 22, 2016
url.php cs fixes Dec 2, 2015
user_agent.php added referer handling: new method setReferer() on UserAgent, getHead… Nov 30, 2016
web_tester.php change visibility of browser property, else it's not available in ext… Aug 1, 2016
xml.php renamed "Nesting" to "Nested" to fit the phpdoc annotations :) Aug 1, 2016

README.md

SimpleTest Build Status Latest Stable Version Total Downloads Latest Unstable Version

SimpleTest is a framework for unit testing, web site testing and mock objects for PHP.

Installation

Downloads

All downloads are stored on Github Releases.

You may find the zip of the "latest released/tagged version" here:

https://github.com/simpletest/simpletest/releases/latest

You may find the zip archive of the "dev-master" branch here:

https://github.com/simpletest/simpletest/archive/master.zip

Composer

You may also install the extension through Composer into the /vendor folder of your project.

Either run

php composer.phar require --dev --prefer-dist simpletest/simpletest "^1.1"

or add the package simpletest/simpletest to the require-dev section of your composer.json file:

{
    "require-dev": {
        "simpletest/simpletest": "^1.1"
    }
}

followed by running composer install.

Issues

Please report all issues you encounter at Github Issues.

Community

Feel free to ask a new question on Stack Overflow or at Github Issues.

StackOverflow offers also a good collection of SimpleTest related questions.

Requirements

PHP 5.4+

Authors

License

GNU LGPL v2.1


You probably got this package from:

http://simpletest.org/en/download.html

SimpleTest is a framework for unit testing, web site testing and mock objects for PHP 5.0.5+.

If you have used JUnit, you will find this PHP unit testing version very similar. Also included is a mock objects and server stubs generator. The stubs can have return values set for different arguments, can have sequences set also by arguments and can return items by reference. The mocks inherit all of this functionality and can also have expectations set, again in sequences and for different arguments.

A web tester similar in concept to JWebUnit is also included. There is no JavaScript or tables support, but forms, authentication, cookies and frames are handled.

You can see a release schedule at http://simpletest.org/en/overview.html which is also copied to the documentation folder with this release. A full PHPDocumenter API documentation exists at http://simpletest.org/api/.

The user interface is minimal in the extreme, but a lot of information flows from the test suite. After version 1.0 we will release a better web UI, but we are leaving XUL and GTK versions to volunteers as everybody has their own opinion on a good GUI, and we don't want to discourage development by shipping one with the toolkit. You can download an Eclipse plug-in separately.

The unit tests for SimpleTest itself can be run here:

test/unit_tests.php

And tests involving live network connections as well are here:

test/all_tests.php

The full tests will typically overrun the 8Mb limit often allowed to a PHP process. A workaround is to run the tests on the command with a custom php.ini file or with the switch -dmemory_limit=-1 if you do not have access to your server version.

The full tests read some test data from simpletest.org. If the site is down or has been modified for a later version then you will get spurious errors. A unit_tests.php failure on the other hand would be very serious. Please notify us if you find one.

Even if all of the tests run please verify that your existing test suites also function as expected. The file:

HELP_MY_TESTS_DONT_WORK_ANYMORE

...contains information on interface changes. It also points out deprecated interfaces, so you should read this even if all of your current tests appear to run.

There is a documentation folder which contains the core reference information in English and French, although this information is fairly basic. You can find a tutorial on...

http://simpletest.org/en/first_test_tutorial.html

...to get you started and this material will eventually become included with the project documentation. A French translation exists at:

http://simpletest.org/fr/first_test_tutorial.html

If you download and use, and possibly even extend this tool, please let us know. Any feedback, even bad, is always welcome and we will work to get your suggestions into the next release. Ideally please send your comments to:

simpletest-support@lists.sourceforge.net

...so that others can read them too. We usually try to respond within 48 hours.

There is no change log except at Sourceforge. You can visit the release notes to see the completed TODO list after each cycle and also the status of any bugs, but if the bug is recent then it will be fixed in SVN only. The SVN check-ins always have all the tests passing and so SVN snapshots should be pretty usable, although the code may not look so good internally.

Oh, and one last thing: SimpleTest is called "Simple" because it should be simple to use. We intend to add a complete set of tools for a test first and "test as you code" type of development. "Simple" does not mean "Lite" in this context.

Thanks to everyone who has sent comments and offered suggestions. They really are invaluable, but sadly you are too many to mention in full. Thanks to all on the advanced PHP forum on SitePoint, especially Harry Fuecks. Early adopters are always an inspiration.

-- Marcus Baker, Jason Sweat, Travis Swicegood, Perrick Penet and Edward Z. Yang.