在PHP中使用简单测试的奇怪事情 [英] Strange thing using simple test in Php
本文介绍了在PHP中使用简单测试的奇怪事情的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
文件1:
<?php
require_once('simpletest/autorun.php');
require_once('simpletest/web_tester.php');
class TestOfRankings extends WebTestCase {
function tesetWeAreTopOfGoogle() {
$this->get('http://poll:8888/index.php/admin/unit_test');
$this->assertText('this is good');
}
}
?>
文件2:
require_once('simpletest/autorun.php');
require_once('simpletest/web_tester.php');
class MakTest extends WebTestCase {
function testOneAndOneMakesTwo() {
$this->get('http://poll:8888/index.php/admin/unit_test');
$this->assertText('this is good');
}
}
几乎相同的文件,为什么它们给我不同的结果?
almost identical files, why do they give me different result?
file1.php
OK
Test cases run: 0/2, Passes: 0, Failures: 0, Exceptions: 0
file2.php
OK
Test cases run: 1/2, Passes: 1, Failures: 0, Exceptions: 0
推荐答案
根据 SimpleTest文档:
运行测试用例时,它将搜索以字符串"test"开头的任何方法并执行该方法.如果该方法开始测试",则为测试.
When a test case runs, it will search for any method that starts with the string "test" and execute that method. If the method starts "test", it's a test.
在file1
中,函数名称为tesetWeAreTopOfGoogle
(这似乎是一个错字).切换到testWeAreTopOfGoogle
,您会很高兴.
In file1
the function name is tesetWeAreTopOfGoogle
(this seems to be a typo). Switch to testWeAreTopOfGoogle
and you'll be golden.
这篇关于在PHP中使用简单测试的奇怪事情的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文