2017 © Pedro Peláez
 

library unit-test

Thinkphp Unit Test

image

zt/unit-test

Thinkphp Unit Test

  • Monday, December 26, 2016
  • by zt
  • Repository
  • 3 Watchers
  • 23 Stars
  • 12 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 16 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

ThinkPHPUnit v0.95

一个为ThinkPHP打造的的UnitTest,简单易用、高效便捷。
, (*1)


, (*2)

How To Use

详细使用介绍查看项目example,下面列出一个简单的使用介绍

  • Application目录下创建Test/Controller,编写测试Controller。
  • 以编写 IndexController为例:
namespace \Test\Controller;
class IndexController extends UnitTest{

    /**
     *   调用方法:
     *   1. http://localhost/PROJECT_NAME/index.php?m=Test  自动执行全部测试文件
     *   2. http://localhost/PROJECT_NAME/index.php?m=Test&controller=XXX  自动执行参数crontroller指定的文件
     */
    function index(){
        $this->run(true); //测试方式1 : 通过自动遍历测试文件的方式执行测试

    }

    function index2(){
        $this->setController( array(__CLASS__ ,'\OtherClassName') );  //测试方式2 :设置将要执行的测试类
        $this->run();                               //执行测试代码

    }

    function testExample1(){                    //该方法将自动被测试
        $this->assertTrue(true);
        $this->assertFalse(false);
    }

    function testExample2(){                    //该方法将自动被测试
            $this->assertEmpty(null);
            $this->assertNotEmpty(true);
    }
}
  • 到浏览器运行 http://localhost/PROJECT_PATH/index.php?m=Test
  • 运行结果 IMG


, (*3)

Bug && Contact Author

The Versions

26/12 2016

dev-master

9999999-dev https://github.com/hizt/ThinkPHPUnit

Thinkphp Unit Test

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Avatar zt

thinkphp unittest

26/12 2016

1.2

1.2.0.0 https://github.com/hizt/ThinkPHPUnit

Thinkphp Unit Test

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Avatar zt

thinkphp unittest