`
#rethink#
  • 浏览: 44851 次
  • 性别: Icon_minigender_1
  • 来自: 厦门
社区版块
存档分类
最新评论

phpunit相关

阅读更多

1  命令

PHPUnit 3.4.15 by Sebastian Bergmann.


Usage: phpunit [switches] UnitTest [UnitTest.php]

       phpunit [switches] <directory>


  --log-junit <file>       Log test execution in JUnit XML format to file.

  --log-tap <file>         Log test execution in TAP format to file.

  --log-json <file>        Log test execution in JSON format.


  --coverage-html <dir>    Generate code coverage report in HTML format.

  --coverage-clover <file> Write code coverage data in Clover XML format.

  --coverage-source <dir>  Write code coverage / source data in XML format.


  --story-html <file>      Write Story/BDD results in HTML format to file.

  --story-text <file>      Write Story/BDD results in Text format to file.


  --testdox-html <file>    Write agile documentation in HTML format to file.

  --testdox-text <file>    Write agile documentation in Text format to file.


  --filter <pattern>       Filter which tests to run.

  --group ...              Only runs tests from the specified group(s).

  --exclude-group ...      Exclude tests from the specified group(s).

  --list-groups            List available test groups.


  --loader <loader>        TestSuiteLoader implementation to use.

  --repeat <times>         Runs the test(s) repeatedly.


  --story                  Report test execution progress in Story/BDD format.

  --tap                    Report test execution progress in TAP format.

  --testdox                Report test execution progress in TestDox format.


  --colors                 Use colors in output.

  --stderr                 Write to STDERR instead of STDOUT.

  --stop-on-failure        Stop execution upon first error or failure.

  --verbose                Output more verbose information.

  --wait                   Waits for a keystroke after each test.


  --skeleton-class         Generate Unit class for UnitTest in UnitTest.php.

  --skeleton-test          Generate UnitTest class for Unit in Unit.php.


  --process-isolation      Run each test in a separate PHP process.

  --no-globals-backup      Do not backup and restore $GLOBALS for each test.

  --static-backup          Backup and restore static attributes for each test.

  --syntax-check           Try to check source files for syntax errors.


  --bootstrap <file>       A "bootstrap" PHP file that is run before the tests.

  --configuration <file>   Read configuration from XML file.

  --no-configuration       Ignore default configuration file (phpunit.xml).

  --include-path <path(s)> Prepend PHP's include_path with given path(s).

  -d key[=value]           Sets a php.ini value.


  --help                   Prints this usage information.

  --version                Prints the version and exits.

 

2 sample 1:

DependencyFailureTest.php:

<!--<br/ /><br/ />Code highlighting produced by Actipro CodeHighlighter (freeware)<br/ />http://www.CodeHighlighter.com/<br/ /><br/ />--><?php
class DependencyFailureTest extends PHPUnit_Framework_TestCase
{
    
public function testOne()
    {
        
$this->assertTrue(true);
    }
 
    
/**
     * @depends testOne
     
*/
    
public function testTwo()
    {
        
$this->assertTrue(false);
    }

    
/**
     * @depends testTwo
     
*/
    
public function testThree()
    {
        
$this->assertTrue(true);
    }


    
public function testFour()
    {
        
$this->assertTrue(true);
    }

     
/**
     * @depends testFive
     
*/
    
public function testSix()
    {
        
$this->assertTrue(true);
    }
}

/*
1    "@depends testTwo" 该注释标明testThree方法依赖于testTwo测试通过才行,否则会被skip。
2    testFour方法没有@depends的注释,所以不依赖于某个方法
3    testSix方法依赖于 testFive 测试通过才行,但是不存在testFive方法,所以也被skip
*/
?>

 

 

运行:D:\www2\phpunit>phpunit --verbose DependencyFailureTest

 

结果:

PHPUnit 3.4.15 by Sebastian Bergmann.

DependencyFailureTest

.FSS

Time: 0 seconds, Memory: 4.00Mb

 

There was 1 failure:

1) DependencyFailureTest::testTwo

Failed asserting that <boolean:false> is true.

D:\www2\phpunit\DependencyFailureTest.php:14

 

There were 2 skipped tests:

1) DependencyFailureTest::testThree

This test depends on "DependencyFailureTest::testTwo" to pass.


2) DependencyFailureTest::testSix

This test depends on "DependencyFailureTest::testFive" to pass.


FAILURES!

Tests: 3, Assertions: 3, Failures: 1, Skipped: 2.

 


分享到:
评论

相关推荐

    PHPUnit(PHP 单元测试框架) v6.5.3.zip

    PHPUnit(PHP 单元测试框架)简介 PHPUnit是一个轻量级的PHP测试框架。... 单元测试是几个现代敏捷开发方法的基础,使得PHPUnit成为许多大型PHP项目的关键工具。这个工具也可以被Xdebug扩展...相关阅读 同类推荐:程序框架

    phpunit:PHP单元测试框架

    PHPUnit PHPUnit是一个面向程序员PHP测试框架。 它是用于单元测试框架的xUnit体系结构的一个实例。 安装 我们分发了一个 ,该文件具有捆绑在单个文件中...请参阅以获取有关如何为PHPUnit及其相关项目做出贡献的信息。

    sebastianbergman

    PHPUnit ... 它是用于单元测试框架的xUnit体系结构的一个实例。... 您可以在GitHub上每个与PHPUnit相关的软件包中找到贡献者的详细列表。 此列表仅显示主要组件: 非常感谢所有为文档做出贡献并帮助维护翻译的人员:

    phpunit参考手册manual2014最新

    单元测试工具phpunit的参考手册,详解了相关的函数的使用方法,手册作成日期是2014年04月28日

    wp-phpunit:WordPress核心PHPUnit库。 [只读]每天都会构建新的WordPress版本。

    WP PHPUnit WordPress核心PHPUnit库。 该存储库是从官方WordPress git镜像git://develop.git.wordpress.org构建的。 请直接说明所有问题。 有关更多信息,。

    PHPUnit测试私有属性和方法功能示例

    主要介绍了PHPUnit测试私有属性和方法功能,结合实例形式较为详细的分析了使用PHPUnit针对私有属性和方法进行测试的相关操作技巧与注意事项,需要的朋友可以参考下

    php单元测试phpunit入门实例教程

    主要介绍了php单元测试phpunit,结合实例形式分析了php单元测试phpunit的基本概念、使用方法及相关注意事项,需要的朋友可以参考下

    EcomDev_PHPUnit:Magento PHPUnit集成

    Magento PHPUnit集成 Magento是一个非常复杂的平台,没有内置的... 您也可以关注我们的相关。 安装 有两种获取扩展名的方法: 使用 modman clone git://github.com/EcomDev/EcomDev_PHPUnit.git 在您的composer.json中

    prophecy-phpunit:在PHPUnit测试案例中集成预言

    预言 预言PHPUnit的整合与嘲讽库在您的测试套件提供了一个更简单的嘲弄。... 有关预言双打的用法,请参阅。 下面是一个用法示例: &lt;?phpnamespace App ;use PHPUnit \ Framework \ TestCase ;use Prophecy \ PhpUn

    PHP单元测试框架PHPUnit用法详解

    主要介绍了PHP单元测试框架PHPUnit用法,结合实例形式详细分析了单元测试框架PHPUnit原理、安装、使用相关操作技巧与注意事项,需要的朋友可以参考下

    CentOS环境下安装PHPUnit的方法分析

    主要介绍了CentOS环境下安装PHPUnit的方法,结合实例形式分析了CentOS环境下安装PHPUnit的步骤、相关问题与解决方法,需要的朋友可以参考下

    phpunit-asynchronicity:用于断言与PHPUnit异步发生的事情的库

    请参阅我获取有关概念和一些代码示例的解释。 请注意,本文涵盖了库的版本1。用法使用PHPUnit use Asynchronicity \ PHPUnit \ Asynchronicity ;use PHPUnit \ Framework \ Assert ;use PHPUnit \ Framework \ ...

    phpunit-github-actions-printer

    如果您想了解有关GitHub Actions的更多信息,请用法将此打印机添加到您的项目中composer require --dev mheap/phpunit-github-actions-printer 运行测试时,将mheap\GithubActionsReporter\Printer指定为要使用的...

    phpunit-test-runner

    使用一系列环境变量进行配置(有关带注释的概述,请参见 )。 使用记录实现细节,以避免README与上游冲突。 在较高级别,测试套件运行程序: 为测试套件准备测试环境。 在测试环境中运行PHPUnit测试。 将...

    phpunit-orb:在CircleCI中运行PHPUnit Orb

    PHPUnit CircleCI天体 一个用于运行测试的 。 用法 有关完整的使用指南,请参见。 版本控制 该项目符合。 变更日志 有关更改的完整列表以及如何在主要版本之间进行迁移,请参见。

    PHP使用phpunit进行单元测试示例

    主要介绍了PHP使用phpunit进行单元测试,结合实例形式分析了phpunit的安装及单元测试相关使用技巧,需要的朋友可以参考下

    phpunit-mockfunction:PHPUnit扩展,它使用runkit来模拟PHP函数(用户定义的和系统的)或静态方法,并使用模拟对象样式的调用匹配器,参数约束和所有魔术

    有关工作版本,请参见 为了能够模拟系统功能(不是用户定义的功能),您需要在PHP配置中打开runkit.internal_override 。安装如果您使用作曲家,则安装MockFunction很容易: "require-dev": { "tcz/phpunit-...

    PHPUnit 单元测试安装与使用入门教程

    主要介绍了PHPUnit 单元测试安装与使用,结合实例形式分析了PHPunit单元测试的下载、安装、测试运行相关操作技巧与使用注意事项,需要的朋友可以参考下

    PHP测试框架PHPUnit组织测试操作示例

    主要介绍了PHP测试框架PHPUnit组织测试,结合实例形式分析了PHPUnit组织测试具体步骤、相关命令与操作技巧,需要的朋友可以参考下

Global site tag (gtag.js) - Google Analytics