1,安装pear 用官方的方法 :request in your browser and save the output to a local file go-pear.phar.
You can then run “ php go-pear.phar”in a Windows Command Prompt to start the update process.
After changing php.ini , you need to restart your web server. ()
2 ,安装phpunit
先安装下列包
pear channel-discover pear.phpunit.de
pear channel-discover components.ez.no
pear channel-discover pear.symfony-project.com
pear update-channels
pear upgrade-all
最后运行
pear install phpunit/PHPUnit或者pear install –alldeps phpunit/PHPUnit
3,安装过程种出现这个错误时:No releases available for package “pear.phpunit.de/PHPUnit
用 pear clear-cache清一下缓存就好了。
4,安装后执行结果:
test1.php的内容:
03
|
class wxTest extends PHPUnit_Framework_TestCase{
|
09
|
$this->o = new wechatCallbackapiTest();
|
18
|
foreach(array('adsfasdjl...k','jianli','我的简历','sdfs简历dfa') as $value){
|
19
|
$this->assertTrue($this->o->checkResume($value));
|
wechatCallbackapiTest 此类的checkResume()方法代码:
1
|
function checkResume($content){
|
2
|
$resum_keywords = array('jl','jianli','简历');
|
3
|
foreach ($resum_keywords as $key => $value) {
|
4
|
if(preg_match("/$value/i", $content))
|
别人的相关博文:
http://flyer0126.iteye.com/blog/1441817
http://www.cnblogs.com/zhja/archive/2013/02/28/2937046.html
http://blog.csdn.net/jucrazy/article/details/6720935
phpunit 手册 :
阅读(2203) | 评论(0) | 转发(0) |