The Definitive Guide to symfony | Chapter 15 - Unit And Functional Testing | symfony | Web PHP Framework

The Definitive Guide to symfony | Chapter 15 - Unit And Functional Testing | symfony | Web PHP Framework

The Lime Testing Framework

There are many unit test frameworks in the PHP world, with the most well known being PhpUnit and SimpleTest. Symfony has its own, called lime. It is based on the Test::More Perl library, and is TAP compliant, which means that the result of tests is displayed as specified in the Test Anything Protocol, designed for better readability of test output.

Lime provides support for unit testing. It is more lightweight than other PHP testing frameworks and has several advantages:

  • It launches test files in a sandbox to avoid strange side effects between each test run. Not all testing frameworks guarantee a clean environment for each test.
  • Lime tests are very readable, and so is the test output. On compatible systems, lime uses color output in a smart way to distinguish important information.
  • Symfony itself uses lime tests for regression testing, so many examples of unit and functional tests can be found in the symfony source code.
  • The lime core is validated by unit tests.
  • It is written in PHP, and it is fast and well coded. It is contained in a single file, lime.php, without any dependence.

The various tests described next use the lime syntax. They work out of the box with any symfony installation.

你可能感兴趣的:(framework)