Php FactoryMuff跳过laravel模型回调

Php FactoryMuff跳过laravel模型回调,php,unit-testing,laravel-4,Php,Unit Testing,Laravel 4,当我为模型编写测试时,我使用FactoryMuff将伪模型创建放在setUp方法中 $this->user = FactoryMuff::create('User', array('password' => '12345678')); 在模型内部有一个保存回调函数,用于散列密码。回调被触发(密码被散列),直到到达第二个测试(密码未被散列)。我甚至用简单的var_dump检查了一下 public function testFirst() { // $this->user is

当我为模型编写测试时,我使用FactoryMuff将伪模型创建放在
setUp
方法中

$this->user = FactoryMuff::create('User', array('password' => '12345678'));
在模型内部有一个
保存
回调函数,用于散列密码。回调被触发(密码被散列),直到到达第二个测试(密码未被散列)。我甚至用简单的var_dump检查了一下

public function testFirst() { // $this->user is a good model } 
public function testSecond() { // $this->user is a bad model }

看起来我找到了答案,我只需要在
setUp
中手动调用
User::boot()
来注册回调