【发布时间】:2014-04-10 23:58:42
【问题描述】:
我是 php 新手,我正在编写一个测试函数来测试我已经编写的类。但是,我不确定应该如何正确调用函数 assertTrue()。
这是我的代码:
<?php
require_once(dirname(__FILE__) . '/simpletest/autorun.php');
require_once('../db/fileToBeTested.php');
class TestDbManager extends UnitTestCase {
function TestDbManager(){
$this->UnitTestCase("Test DB Manager");
}
// Function to test if isTableExisting() method works correctly
function testIsTableExisting() {
$testDB = new DB("localhost", "root", "password", "GraphAppDB", "3306", "empty@empty.com", true, "GraphApp")
$this->assertTrue($testDB->isTableExisting("users"), "users table exists");
$this->assertFalse($testDB->isTableExisting("notAValidTable"), "notAValidTable does not exist");
$this->assertFalse($testDB->isTableExisting(""));
}
}
?>
这是我得到的错误:
解析错误:语法错误,意外'$this' (T_VARIABLE) in /Applications/XAMPP/xamppfiles/htdocs/GraphApp/tests/TestDbManager.php 第 14 行
【问题讨论】:
标签: php simpletest