简体   繁体   中英

Testing models using Simpletest and CodeIgniter

I am new to the PHP world and I am trying to setup some tests for my models. I am using CodeIgniter and Simpletest. I keep getting this error:

Fatal error: Class 'CI_Model' not found...

I assume that this happens because my model extends from CI_Model . CI_Model class has the following code:

if ( ! defined('BASEPATH')) exit('No direct script access allowed');

So my question is: how can I test my models using Simpletest?

Your test script needs to configure the necessary environment. In this case, you can define BASEPATH :

define('BASEPATH', '/your/path');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM