我有同样的问题,可以钉下来,我试着写这是不definied类变量:
我的类(这是一个CakePHP的类)造成分段错误:
class MyClass extends AppModel {
protected $classVariableOne;
public function __construct($id = false, $table = null, $ds = null) {
parent::__construct($id, $table, $ds);
$this->classVariableOne =& ClassRegistry::init('ClassVariableOne');
// This line caused the segmentation fault as the variable doesn't exists
$this->classVariableTwo =& ClassRegistry::init('ClassVariableTwo');
}
}
我固定它通过添加第二个变量:
class MyClass extends AppModel {
protected $classVariableOne;
protected $classVariableTwo; // Added this line
public function __construct($id = false, $table = null, $ds = null) {
parent::__construct($id, $table, $ds);
$this->classVariableOne =& ClassRegistry::init('ClassVariableOne');
$this->classVariableTwo =& ClassRegistry::init('ClassVariableTwo');
}
}
请你展示如何调用PHPUnit的。你有没有尝试过程隔离? – hakre 2011-06-14 12:52:53
内存不足? – powtac 2011-06-14 12:53:22
@hakre - 是的,我已经尝试过程隔离,我得到的所有错误都是由于我的框架未正确实例化。我只是简单地从命令行调用它:phpunit quiz_service_Test.php – 2011-06-14 12:55:35