{"id":18803091,"url":"https://github.com/nabeelalihashmi/lighttest","last_synced_at":"2026-01-05T11:30:16.576Z","repository":{"id":38891996,"uuid":"505174787","full_name":"nabeelalihashmi/LightTest","owner":"nabeelalihashmi","description":"Easy Testing System for PHP","archived":false,"fork":false,"pushed_at":"2022-06-23T18:40:53.000Z","size":690,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-12-29T20:22:45.557Z","etag":null,"topics":["php","php-test","php-unit-test","testing-library","testing-tools"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nabeelalihashmi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-06-19T17:23:27.000Z","updated_at":"2022-06-19T17:42:32.000Z","dependencies_parsed_at":"2022-09-18T13:12:11.965Z","dependency_job_id":null,"html_url":"https://github.com/nabeelalihashmi/LightTest","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nabeelalihashmi%2FLightTest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nabeelalihashmi%2FLightTest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nabeelalihashmi%2FLightTest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nabeelalihashmi%2FLightTest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nabeelalihashmi","download_url":"https://codeload.github.com/nabeelalihashmi/LightTest/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239735259,"owners_count":19688262,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["php","php-test","php-unit-test","testing-library","testing-tools"],"created_at":"2024-11-07T22:33:02.809Z","updated_at":"2026-01-05T11:30:16.528Z","avatar_url":"https://github.com/nabeelalihashmi.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"![LightTest](./docs/header.png)\n\n# LightTest\n\nAn easy to use extensible testing system for PHP.\n\n![LightTest Screenshot](./docs/lt.png)\n\n\n## About Author\n[Nabeel Ali](https://iconiccodes.com)\n\nWebsite: [https://iconiccodes.com](https://iconiccodes.com)\n\nEmail: [mail2nabeelali@gmail.com](mailto:mail2nabeelali@gmail.com)\n\n## Features\n\n    * Fast\n    * Easy\n    * Extensible\n\n\n## Installtion\n```\ncomposer require nabeelalihashmi/LightTest\n```\n\n## Basic Usage\n\n### Creating Test\n\nFirst, create object of test type class (e.g `LEqualityTest`).\n\nA test required 3 arguments, `expected output`, `callback` and `message`.\n\nCallback must be a function argument. You can call other functions in this function.\n\n### Test\n\nNow, create the LightTest object and add the tests.\n\nCall `run` method to run the tests.\n\n\n```\n\nfunction getName() {\n    return 'Nabeel Ali';\n}\nfunction getName2() {\n    return 'Not Nabeel Ali but Nabeel Ali';\n}\n\nfunction getAge() {\n    return 28;\n}\nfunction getAgeWrong() {\n    return \"28\";\n}\n\nfunction printName() {\n    echo 'Nabeel';\n}\n\n$test1 = new LEqualityTest('Nabeel Ali', function() { return getName(); }, \"Test First Name\");\n$test2 = new LEqualityTest('Nabeel Ali', function() { return getName2(); }, \"Testing Second Name\");\n$test3 = new LInstanceOfTest('string', function() { return getName(); }, \"Testing If Name is a string\");\n$test4 = new LInstanceOfTest('integer', function() { return getAge(); }, \"Testing if Age is an integer\");\n$test5 = new LInstanceOfTest('integer', function() { return getAge(); }, \"Testing if Age is an integer\");\n$test6 = new LOutputEqualityTest('Nabeel', function() {  printName(); }, \"Testing output of printName()\");\n\n$lt = new LightTest();\n$lt-\u003eaddTest($test1);\n$lt-\u003eaddTest($test2);\n$lt-\u003eaddTest($test3);\n$lt-\u003eaddTest($test4);\n$lt-\u003eaddTest($test5);\n$lt-\u003eaddTest($test6);\n$lt-\u003erun();\n\n```\n\n## Available Tests\n\nBy default, LightTest has these tests\n### Equality Test\nCheck Values of Callback for Equality with Expected Value\n\n### Instance Check Test\nCheck if Callback returns an instance that matches expected argument.\n\n### Output Check Test\nCheck if Callback prints expected output.\n\n## Make Own Test Handler\n\nYou can make your own test handler by extending the `LTestClass` class. You need to implement the `handle` method.\n\nOptionally, you can also implement the `runAfter` method. This method is executed after the execution of callback and it is to modify result. \n\nIn `handle` method, you can use \n`$this-\u003egetResult()` and `$this-\u003eexprectedOutput`.\n\nif test passes, call `$this-\u003epass()` else call `$this-\u003efail()`\n\n```\nnamespace IconicCodes\\LightTest;\n\nclass LInstanceOfTest extends LTest\n{\n    public function runAfter() {\n        $this-\u003eresult = gettype($this-\u003eresult);\n    }\n    public function handle()\n    {\n        $this-\u003e__start();\n        if ($this-\u003egetResult() == $this-\u003eexpectedOutput) {\n            $this-\u003epass();\n        } else {\n            $this-\u003efail();\n        }\n    }\n}\n```\n\n-------------------------\n\n## License\n\nLightTest is released under permissive licese with following conditions:\n\n* It cannot be used to create adult apps.\n* It cannot be used to gambling apps.\n* It cannot be used to create apps having hate speech.\n\n### MIT License\n\nCopyright 2022 Nabeel Ali | IconicCodes.com\n\nPermission 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:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE 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.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnabeelalihashmi%2Flighttest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnabeelalihashmi%2Flighttest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnabeelalihashmi%2Flighttest/lists"}