承接 thomasnordahldk/tester 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

thomasnordahldk/tester

Composer 安装命令:

composer require thomasnordahldk/tester

包简介

An object oriented approach to testing for PHP.

README 文档

README

PHP Version Latest Stable Version License Build Status

An object oriented approach to testing PHP code.

Tester aims to be: easy to learn, light weight, object oriented, and extensible.

Documentation here

Installation

The library is released as a composer package.

composer require --dev thomasnordahldk/tester

Tests

Tests are defined by creating TestCase classes.

class MyTestCase implements TestCase
{
    public function getDescription(): string
    {
        return "My new unit test";
    }
    
    public function run(Tester $tester): void
    {
        $tester->assert(true, "This assertion passes!");
        $tester->assert(false, "This assertion fails!");
    }
}

The test case is defined as a description of the test and a run test method.

Docs: Creating a test case.

Test suites

Tests suites are defined by the TestSuite class which is created with a description and an array of TestCase classes.

$unit_tests = new TestSuite("Unit tests", [new UserUnitTest, AddressUnitTest]);

Docs: Test Suites.

Running tests

The library comes with a native test runner that is run from the command line interface, and outputs a summary of the test.

Which tests to run is defined in the file test.php in the root composer directory. The file is expected to return an array of test suites.

# test.php
$unit_tests = new TestSuite("Unit tests", [new UserUnitTest, new AddressUnitTest]);

return [$unit_tests];
$composer-root/~ bin/tester

---------------------------------------------------------------------------
 - Unit tests - cases: 2
 --- Unit test of User ✔
 --- Unit test of Address ✔
---------------------------------------------------------------------------
success: 2, failure: 0, assertions: 8, time: 0.04s
---------------------------------------------------------------------------

For a comprehensive description of the options available for the native test runner script:

Docs: How to run tests.

Inspiration

This library is inspired by the testing library mindplay-dk/testies.

统计信息

  • 总下载量: 26
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-09-29

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固