I want to test a model in zend project,
<?php
//require_once('CustomModelBase.php');
class Application_Model_User extends Custom_Model_Base {
protected function __construct() {
parent::__construct();
}
static function create(array $data) {
}
static function load($id) {
}
static function find($name, $order=null, $limit=null, $offset=null) {
);
}
}
the model in under application/model folder, it extends a base class Custom_Model_Base which is under the same folder as class User.
In my test, I try to create a new object of User in this way
<?php
class Model_UserTest extends ControllerTestCase
{
protected $user2;
public function setUp() {
parent::setUp();
$this->user2 = new Application_Model_User2();
}
public function testCanDoTest() {
$this->assertTrue(true);
}
}
this is CustomModelBase.php: abstract class Custom_Model_Base { protected function __construct($adapter=null) {} }
it gives me error, say "PHP Fatal error: Class 'Custom_Model_Base' not found in \application\models\User.php on line 4", the I include "CustomModelBase.php" in User.php,it gives me another error "PHP Fatal error: Call to protected Application_Model_User::__construct() from context 'Model_User2Test' in D:\PHP\apache2\htdocs\ID24_Xiao\tests\application\models \UserTest.php on line 13"
then How could I handle it? can anyone give some suggestion?