Symfony2 (3) - atoum进行单元测试

2 篇文章 0 订阅
2 篇文章 0 订阅

文章转自 Zhipeng JIANG 的博客,http://jesusjzp.github.io/blog/2013/08/19/symfony2-test/


Atoum Bundle


简单介绍

atoum是php测试的一个开源工具,结合symfony我们可以直接安装此bundle并进行测试。与PHPUnit类似,这个bundle也可以进行单元测试。除此之外,atoum还支持代码覆盖率检查。

开源项目地址

安装教程

根据symfony的习惯,bundle需要通过composer安装

{
	"require": {
		"atoum/atoum": "dev-master",
		"atoum/atoum-bundle": "dev-master"
	}
}

修改好composer.json文件后,还需要修改app/AppKernal.php

if (in_array($this->getEnvironment(), array('dev', 'test'))) {
    //.....
    $bundles[] = new atoum\AtoumBundle\AtoumAtoumBundle();
}

常用命令

重用的几条命令也很简单,跟symfony的console结合得很好,直接用

$ php app/console atoum FooBundle --env=test # launch tests of FooBundle
$ php app/console atoum FooBundle BarBundle --env=test # launch tests of FooBundle and BarBundle
$ php app/console atoum acme_foo --env=test # launch tests of bundle where alias is acme_foo
$ php app/console atoum --env=test # launch tests from configuration.

示例

示例请参考下一篇博客,  http://jesusjzp.github.io/blog/2013/08/21/symfony2-test/




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值