【发布时间】:2013-11-24 07:22:06
【问题描述】:
我使用 Simpletest 编写了一个测试类。这是我的 PHP 代码:
<?php
require_once '../simpletest/autorun.php';
class Exam extends UnitTestCase {
private $CI;
function testUser() {
$this->CI = & get_instance();
$this->CI->load->model('user_model');
$this->assertTrue($this->CI->user_model->listAll());
}
}
但是当我执行这个脚本时。有一个错误:
Fatal error: Call to undefined function get_instance() in
D:\xampp\htdocs\simpleCI\test\exam.php on line 10
为什么 get_instance 未定义,我怎样才能使它可用?
【问题讨论】:
-
你有没有收到并回答过这个问题?