我在 laravel 4 中使用 jeffrey 的 laravel-test-helper 包来测试我的模型。当我使用
protected $softDelete = true;
在我的模型中,以下断言失败:
public function testMyModel()
{
$obj = Factory::create('Modelname');
Assert::equals(1,$obj->count());
}
当我在没有 $softDelete 变量的情况下运行测试时,它工作正常。有什么问题的线索吗?这是 phpunit 命令的堆栈跟踪,如果有帮助的话:
/var/www/project/vendor/way/laravel-test-helpers/src/Way/Tests/TestFacade.php:41
/var/www/project/vendor/way/laravel-test-helpers/src/Way/Tests/TestFacade.php:25
/var/www/project/vendor/way/laravel-test-helpers/src/Way/Tests/TestFacade.php:55
/var/www/project/app/tests/models/ModelTest.php:13
/var/www/project/app/tests/models/ModelTest.php:13