ogbitblt/unit-testing

基于PHP的项目的轻量级最小单元测试框架。

v1.0.0 2022-12-27 05:42 UTC

This package is not auto-updated.

Last update: 2024-10-02 12:29:15 UTC


README

轻量级PHP单元测试框架

安装

使用 composer

composer require ogbitblt/unit-testing

使用方法

// initialize a new test suite
UnitTest::InitTestSuite("MyTestSuite");

// check if bool, float, int, or string values are equal
// if they are the test passes, and fails otherwise
UnitTest::BoolEqual(true,true,"does true equal true");
UnitTest::BoolEqual(true,false,"does true equal false");
UnitTest::FloatEqual(0,0,"does 0 float equal 0 float");
UnitTest::FloatEqual(0,1,"does 0 float equal 1 float");
UnitTest::FloatEqual(1.234567890,1.234567890,"how deep does your precision test");
UnitTest::FloatEqual(2.345678901,2.345678900,"how deep does your precision grow");
UnitTest::IntEqual(0,0,"does 0 int equal 0 int");
UnitTest::IntEqual(0,1,"does 0 int equal 1 int");
UnitTest::StringEqual("hello","hello","does hello equal hello");
UnitTest::StringEqual("hello","bye","does hello equal bye");

// show a test results summary
UnitTest::ShowResults();

贡献

欢迎pull requests。对于重大更改,请先打开一个问题来讨论您想更改的内容。

请确保适当更新测试。

许可证

MIT