Lime (test framework)

Unit testing and functional testing framework


title: "Lime (test framework)" type: doc version: 1 created: 2026-02-28 author: "Wikipedia contributors" status: active scope: public tags: ["unit-testing-frameworks", "php-frameworks"] description: "Unit testing and functional testing framework" topic_path: "general/unit-testing-frameworks" source: "https://en.wikipedia.org/wiki/Lime_(test_framework)" license: "CC BY-SA 4.0" wikipedia_page_id: 0 wikipedia_revision_id: 0

::summary Unit testing and functional testing framework ::

::data[format=table title="Infobox software"]

FieldValue
namelime
authorFabien Potencier
developerBernhard Schussek
released
discontinuedyes
latest_release_version1.0.9
latest_release_date
latest preview version2.0.0alpha1
latest preview date
operating_systemCross-platform
programming_languagePHP
genreTest tool
licenseMIT License
website
::

| name = lime | logo = | screenshot = | caption = | author = Fabien Potencier | developer = Bernhard Schussek | released = | discontinued = yes | latest_release_version = 1.0.9 | latest_release_date = | latest preview version = 2.0.0alpha1 | latest preview date = | operating_system = Cross-platform | programming_language = PHP | genre = Test tool | license = MIT License | website = lime is a unit testing and functional testing framework built specifically for the Symfony web application framework based on the Test::More Perl library. The framework is designed to have readable output from tests, including color formatting, by following the Test Anything Protocol which also allows for easy integration with other tools. lime tests are run in a sandbox environment to minimize test executions from influencing each other. Though the lime testing framework is built for testing within Symfony, lime is contained within a single PHP file and has no dependency on Symfony or any other library.

The alpha version of lime 2.0 was announced on November 10, 2009 and is compatible with Symfony 1.2 and lower. Symfony 2.0 uses PHPUnit for testing instead of lime.

Example

lime unit tests use the lime_test object to make assertions. The following is a basic example lime unit test to test PHP's built-in in_array function.

::code[lang=php] include dirname(FILE) . '/bootstrap/unit.php'; // Include lime.

// Create the lime_test object for 10 number of assertions and color output. $t = new lime_test(10, new lime_output_color());

// The test array. $arr = ['Hello', 'World', 123];

// Output a comment. $t->diag('in_array()');

// Test to make sure in_array returns a boolean value for both values // that are in the array and not in the array. $t->isa_ok(in_array('hey', $arr), 'bool', ''in_array' did not return a boolean value.'); $t->isa_ok(in_array('Hello', $arr), 'bool', ''in_array' did not return a boolean value.'); $t->isa_ok(in_array(5, $arr), 'bool', ''in_array' did not return a boolean value.'); $t->isa_ok(in_array(FALSE, $arr), 'bool', ''in_array' did not return a boolean value.');

// Test to make sure in_array can find values that are in the array // and doesn't find values that are not in the array. $t->ok(!in_array('hey', $arr), ''in_array' found a value not in the array.'); $t->ok(!in_array(5, $arr), ''in_array' found a value not in the array.'); $t->ok(!in_array(FALSE, $arr), ''in_array' found a value not in the array.'); $t->ok(in_array('Hello', $arr), ''in_array' failed to find a value that was in the array.'); $t->ok(in_array('World', $arr), ''in_array' failed to find a value that was in the array.'); $t->ok(in_array(123, $arr), ''in_array' failed to find a value that was in the array.'); ::

Version 2.0

The alpha version of lime 2.0 was announced on the Symfony blog on November 10, 2009. The second version of lime was built to be as backward compatible with the first version as was possible - the two parts of lime 2.0 that are not compatible with lime 1.0 are the configuration of the test harness and the LimeCoverage class. lime 2.0 includes support for xUnit output, source code annotations, parallel execution of tests, automatic generation of mock and stub objects, and operator overloading for data within tests. Unlike the first version of lime, lime 2.0 does have some dependencies on Symfony.

References

References

  1. "/tools/lime/tags/RELEASE_1_0_9 (log)".
  2. Potencier, Fabien; Zaninotto, François. ''The Definitive Guide to symfony'', Apress, January 26, 2007, pp. 317-344. {{ISBN. 1-59059-786-9
  3. "Lime 2 alpha released (Symfony Blog)".
  4. "Using Symfony's Lime in phpUnderControl".
  5. "Can someone post a full working example of Lime 2 annotations?".
  6. SensioLabs. "(Press Release) Lime 2 alpha released".

::callout[type=info title="Wikipedia Source"] This article was imported from Wikipedia and is available under the Creative Commons Attribution-ShareAlike 4.0 License. Content has been adapted to SurfDoc format. Original contributors can be found on the article history page. ::

unit-testing-frameworksphp-frameworks