作为基础,我使用\ Codeception\TestCase\Test类.
我注意到,对于类中定义的每个test*方法,codeception都会重新创建TestCase\Test类!
但为什么?
结果我不能使用类字段!
public function getName() {
if (!empty($this->_name)) {
return $this->_name;
} else $this->_name = uniqid('_name');
}
Run Code Online (Sandbox Code Playgroud)
每个测试方法的getName()都会返回新生成的名称..这对我来说是错误的行为.如果我想为每个测试方法使用类字段,就像普通的OOP一样,可以解决这种情况吗?