PHP test libraries

A collection of libraries for testing

  • Alice – Alice allows you to create a ton of fixtures/fake data for use while developing or testing your project. It gives you a few essential tools to make it very easy to generate complex data with constraints in a readable and easy to edit way, so that everyone on your team can tweak the fixtures if needed.
  • AspectMock – AspectMock allows you to stub and mock practically anything in your PHP code!
  • Atoum – atoum is a unit testing framework specific to the PHP language.
  • Behat – Behat is an open source behavior-driven development framework for PHP 5.3 and 5.4. What is behavior-driven development, you ask? It’s the idea that you start by writing human-readable sentences that describe a feature of your application and how it should work, and only then implement this behavior in software.
  • Codeception – a modern full-stack testing framework for PHP. Inspired by BDD, it provides an absolutely new way of writing acceptance, functional and even unit tests. Powered by PHPUnit.
  • DBUnit – extension for database interaction testing.
  • Faker – a PHP library that generates fake data for you. Whether you need to bootstrap your database, create good-looking XML documents, fill-in your persistence to stress test it, or anonymize data taken from a production service, Faker is for you.
  • HTTP Mock – mocks the server side of an HTTP request to allow integration testing with the HTTP side. It uses PHP’s builtin web server to start a second process that handles the mocking. The server allows registering request matcher and responses from the client side.
  • Kahlan – a full-featured Unit & BDD test framework a la RSpec/JSpec which uses a describe-it syntax and moves testing in PHP one step forward.
  • Mink – an open source browser controller/emulator for web applications, written in PHP 5.3.
  • Mockery –  simple yet flexible PHP mock object framework for use in unit testing with PHPUnit, PHPSpec or any other testing framework.
  • ParaTest – is to support parallel testing in PHPUnit. Provided you have well-written PHPUnit tests, you can drop paratest in your project and start using it with no additional bootstrap or configurations
  • Peridot – highly extensible, highly enjoyable, PHP testing framework.
  • Phake – a framework for PHP that aims to provide mock objects, test doubles and method stubs.
  • Pho – BDD test framework for PHP, inspired by Jasmine and RSpec. Features a familiar syntax, and a watch command to automatically re-run specs during development. It can also be extended with custom matchers and reporters.
  • PHP-Mock – a testing library which mocks non deterministic built-in PHP functions like time() or rand()
  • PHPSpec – a tool which can help you write clean and working PHP code using behaviour driven development or BDD. BDD is a technique derived from test-first development.
  • PHPT – A phpt test is a little script used by the php internal and quality assurance teams to test PHP’s functionality.
  • PHPUnit – PHPUnit is a programmer-oriented testing framework for PHP. It is an instance of the xUnit architecture for unit testing frameworks.
  • Prophecy – a highly opinionated yet very powerful and flexible PHP object mocking framework. Though initially it was created to fulfil phpspec2 needs, it is flexible enough to be used inside any testing framework out there with minimal effort.
  • Samsui – you can quickly build prototype application and generate as many data as you need for testing your prototype.
  • VFS Stream – a stream wrapper for a virtual file system that may be helpful in unit tests to mock the real file system. It can be used with any unit test framework, like PHPUnit or SimpleTest.
  • VFS – a virtual file system for PHP built using the stream wrapper API.
SHARE
Previous articleForms in PHP video

LEAVE A REPLY

Please enter your comment!
Please enter your name here

*