PHPackages                             nabeelalihashmi/lighttest - 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. nabeelalihashmi/lighttest

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

nabeelalihashmi/lighttest
=========================

Lightweight Testing Framework for PHP

v1.0.0(3y ago)15MITPHP

Since Jun 19Pushed 3y ago1 watchersCompare

[ Source](https://github.com/nabeelalihashmi/LightTest)[ Packagist](https://packagist.org/packages/nabeelalihashmi/lighttest)[ RSS](/packages/nabeelalihashmi-lighttest/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

[![LightTest](./docs/header.png)](./docs/header.png)

LightTest
=========

[](#lighttest)

An easy to use extensible testing system for PHP.

[![LightTest Screenshot](./docs/lt.png)](./docs/lt.png)

About Author
------------

[](#about-author)

[Nabeel Ali](https://iconiccodes.com)

Website:

Email:

Features
--------

[](#features)

```
* Fast
* Easy
* Extensible

```

Installtion
-----------

[](#installtion)

```
composer require nabeelalihashmi/LightTest

```

Basic Usage
-----------

[](#basic-usage)

### Creating Test

[](#creating-test)

First, create object of test type class (e.g `LEqualityTest`).

A test required 3 arguments, `expected output`, `callback` and `message`.

Callback must be a function argument. You can call other functions in this function.

### Test

[](#test)

Now, create the LightTest object and add the tests.

Call `run` method to run the tests.

```

function getName() {
    return 'Nabeel Ali';
}
function getName2() {
    return 'Not Nabeel Ali but Nabeel Ali';
}

function getAge() {
    return 28;
}
function getAgeWrong() {
    return "28";
}

function printName() {
    echo 'Nabeel';
}

$test1 = new LEqualityTest('Nabeel Ali', function() { return getName(); }, "Test First Name");
$test2 = new LEqualityTest('Nabeel Ali', function() { return getName2(); }, "Testing Second Name");
$test3 = new LInstanceOfTest('string', function() { return getName(); }, "Testing If Name is a string");
$test4 = new LInstanceOfTest('integer', function() { return getAge(); }, "Testing if Age is an integer");
$test5 = new LInstanceOfTest('integer', function() { return getAge(); }, "Testing if Age is an integer");
$test6 = new LOutputEqualityTest('Nabeel', function() {  printName(); }, "Testing output of printName()");

$lt = new LightTest();
$lt->addTest($test1);
$lt->addTest($test2);
$lt->addTest($test3);
$lt->addTest($test4);
$lt->addTest($test5);
$lt->addTest($test6);
$lt->run();

```

Available Tests
---------------

[](#available-tests)

By default, LightTest has these tests

### Equality Test

[](#equality-test)

Check Values of Callback for Equality with Expected Value

### Instance Check Test

[](#instance-check-test)

Check if Callback returns an instance that matches expected argument.

### Output Check Test

[](#output-check-test)

Check if Callback prints expected output.

Make Own Test Handler
---------------------

[](#make-own-test-handler)

You can make your own test handler by extending the `LTestClass` class. You need to implement the `handle` method.

Optionally, you can also implement the `runAfter` method. This method is executed after the execution of callback and it is to modify result.

In `handle` method, you can use `$this->getResult()` and `$this->exprectedOutput`.

if test passes, call `$this->pass()` else call `$this->fail()`

```
namespace IconicCodes\LightTest;

class LInstanceOfTest extends LTest
{
    public function runAfter() {
        $this->result = gettype($this->result);
    }
    public function handle()
    {
        $this->__start();
        if ($this->getResult() == $this->expectedOutput) {
            $this->pass();
        } else {
            $this->fail();
        }
    }
}

```

---

License
-------

[](#license)

LightTest is released under permissive licese with following conditions:

- It cannot be used to create adult apps.
- It cannot be used to gambling apps.
- It cannot be used to create apps having hate speech.

### MIT License

[](#mit-license)

Copyright 2022 Nabeel Ali | IconicCodes.com

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

22

—

LowBetter than 23% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1419d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/449341cf2d2c255eeaa52f06da4293fdcf2f407b10984846b6c130418c7b4eab?d=identicon)[nabeelalihashmi](/maintainers/nabeelalihashmi)

---

Top Contributors

[![nabeelalihashmi](https://avatars.githubusercontent.com/u/14184842?v=4)](https://github.com/nabeelalihashmi "nabeelalihashmi (4 commits)")

---

Tags

phpphp-testphp-unit-testtesting-librarytesting-tools

### Embed Badge

![Health badge](/badges/nabeelalihashmi-lighttest/health.svg)

```
[![Health](https://phpackages.com/badges/nabeelalihashmi-lighttest/health.svg)](https://phpackages.com/packages/nabeelalihashmi-lighttest)
```

###  Alternatives

[phpspec/prophecy

Highly opinionated mocking framework for PHP 5.3+

8.5k551.7M677](/packages/phpspec-prophecy)[vimeo/psalm

A static analysis tool for finding errors in PHP applications

5.8k77.5M6.7k](/packages/vimeo-psalm)[brianium/paratest

Parallel testing for PHP

2.5k118.8M753](/packages/brianium-paratest)[beberlei/assert

Thin assertion library for input validation in business models.

2.4k96.9M570](/packages/beberlei-assert)[mikey179/vfsstream

Virtual file system to mock the real file system in unit tests.

1.4k108.0M2.7k](/packages/mikey179-vfsstream)[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k39.1M32.0k](/packages/orchestra-testbench)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
