phpunit 在kohana3.3中的使用方法

来源:互联网 发布:润和软件怎么样 编辑:程序博客网 时间:2024/05/16 11:11

安装phpunit步骤:

1、安装apache & php

2、安装pear

3、安装phpunit

pear install phpunit/PHPUnit

运行测试 kohana system


$ phpunit --bootstrap=modules/unittest/bootstrap.php modules/unittest/tests.php


KOHANA中写test

1、在application中写测试放在 "application/tests" 文件中

2、为module写测试放在“ modules/modulefolder/tests”中



分组测试

To allow users to selectively run tests you need to organise your tests into groups. Here's an example test showing how to do this



<?php


/**

 * This is a description for my testcase

 *

 * @group somegroup

 * @group somegroup.morespecific

 */

Class AnotherReallyCoolTest extends Unittest_TestCase

{

/**

 * Tests can also be grouped too!

 *

 * @group somegroup.morespecific.annoyingstuff

 */

function testSomeAnnoyingCase()

{

// CODE!!

}

}


指定测试某个组

$ phpunit --bootstrap=index.php --group=somegroup modules/unittest/tests.php

列出所有测试组

$ phpunit --bootstrap=modules/unittest/bootstrap.php --list-groups modules/unittest/tests.php

原创粉丝点击