bypikod / php-test
Very simple testing library with PHP
Installs: 9
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:project
README
Simple PHP test library for unit testing.
Warning
Minimum PHP version for this package is PHP7.
Installation
Add this package to your project with composer:
composer require bypikod/php-test
Getting Started
Basic Test:
use PHPTest\Test; Test::it("test", function (Test $test) { $test->assertEqual(1, 2); });
Suite Test:
use PHPTest\Test; Test::suite("test", function ($it) { $it("test", function (Test $test) { $test->assertEqual(1, 1); }); $it("test", function (Test $test) { $test->assertEqual(1, 2); }); });
Suite Test with Class:
use PHPTest\Test; class RouterTest extends Router { /** * Test get branch * @test Branch Getter Test * @since 1.0.0 */ public function getBranchTest(Test $test): void { // Test get branch $this->getBranch('/a/b', false)[] = 'test'; $test->assertArrayContains($this->getBranch('/a/b', false), 'test'); // Test by popping the last element $this->getBranch('/a/b/test', true)[] = 'test'; $test->assertArrayContains($this->getBranch('/a/b', false), 'test'); } } $router = new RouterTest(); Test::suiteClass($router);
Contribute
Contributers are welcome! Just make sure you understand the follow the rules below:
- Contributions must follow the PSR-2 coding standard.
- Make sure you're writing documentation that covers your code changes.
- Follow the Code of Conduct.
And you should know your submissions will be under MIT License.
License
This project is licensed under the terms of the MIT License.
You are free to use this project in compliance with the MIT License. If you decide to use, modify, or redistribute this software, you must include a copy of the original license and copyright notice in all copies or substantial portions of the software.
For more information about the MIT License, visit: MIT License.