PHPackages                             lucinda/unit-testing - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. lucinda/unit-testing

ActiveLibrary[Testing &amp; Quality](/categories/testing)

lucinda/unit-testing
====================

Lightweight PHP8.1 library for unit testing with zero dependencies

v2.0.7(2w ago)021.5k120MITPHPPHP ^8.1

Since Dec 22Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/aherne/unit-testing)[ Packagist](https://packagist.org/packages/lucinda/unit-testing)[ Docs](https://github.com/aherne/unit-testing)[ RSS](/packages/lucinda-unit-testing/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (2)Versions (36)Used By (20)

Lucinda Unit Testing
====================

[](#lucinda-unit-testing)

Lightweight PHP 8.1 unit testing library with no package dependencies. It reads an XML configuration, mirrors source classes into test classes, runs matching test methods, and reports `Lucinda\UnitTest\Result` objects in the console or as JSON.

Requirements
------------

[](#requirements)

- PHP 8.1 or newer
- PHP extensions: `SimpleXML`, `cURL`, `PDO`, `tokenizer`
- Composer PSR-4 autoloading for `Lucinda\UnitTest\`

Install it in the project that owns the code you want to test:

```
composer require lucinda/unit-testing
```

Configuration
-------------

[](#configuration)

Create an XML file, commonly `unit-tests.xml`, that describes one or more source/test folder pairs:

```

```

`unit_tests` is required. Each `unit_test` entry requires `sources` and `tests` tags with non-empty `namespace` attributes. The `path` attributes default to `src` and `tests`; the source path must already exist, while a missing tests path is created automatically.

The **optional** `servers/sql/{environment}/server` entry configures the SQL validator. The environment name is the second argument passed to a controller, for example `local`.

Running Tests
-------------

[](#running-tests)

Create a small runner script in the consuming project:

```
