php-platform/restful-unit

v0.1.4 2018-04-15 08:27 UTC

This package is not auto-updated.

Last update: 2024-09-29 05:41:52 UTC


README

此包提供了一组工具,用于从PHPPlatfrom/restful单元测试Restful Web服务

如何使用

  • 步骤 1

将此包中的 resources/autoload.php 添加到 phpunit.xml

<phpunit colors="true" bootstrap="vendor/php-platform/restful-unit/resources/autoload.php" >
</phpunit>
  • 步骤 2

从 TestCase 的 setup 方法中调用 PhpPlatform\Tests\RestfulUnit\ServiceTestCase 的 setupMethods

class MyRestFulTest extends TestCase {
    static function setUpBeforeClass(){
        parent::setUpBeforeClass();
        \PhpPlatform\Tests\RestfulUnit\ServiceTestCase::setUpBeforeClass();
    }
    
    function setUp(){
        parent::setUp();
        \PhpPlatform\Tests\RestfulUnit\ServiceTestCase::setUp();
    }
    
    static function tearDownAfterClass(){
        parent::tearDownAfterClass();
        \PhpPlatform\Tests\RestfulUnit\ServiceTestCase::tearDownAfterClass();
    }
    
    function tearDown(){
        parent::tearDown();
        \PhpPlatform\Tests\RestfulUnit\ServiceTestCase::tearDown();
    }
}