我正在学习 tutsplus 的课程:https ://tutsplus.com/lesson/laravel-gotchas/但我在本课中有一个错误: https ://tutsplus.com/lesson/laravel-gotchas/
错误是我正在尝试创建 Post 类型的对象(Post 是 Laravel 中的模型),但是在运行代码接收测试时出现下一条消息:
laravel : codecept run
Codeception PHP Testing Framework v1.8.3
Powered by PHPUnit 3.7.31 by Sebastian Bergmann.
Acceptance Tests (1) ------------------------------------------------
Trying to perform actions and see result (SigninCept.php) Ok
---------------------------------------------------------------------
Functional Tests (2) -------------------------------------------------
FATAL ERROR. TESTS NOT FINISHED.
Class 'Post' not found
in laravel/app/tests/functional/PostCest.php:9
这是我的测试 PostCest.php
<?php
use \TestGuy;
class PostCest
{
public function _before()
{
}
public function _after()
{
}
// tests
public function tryToTest(TestGuy $I) {
$post = new Post;
$post->title = 'Some title';
$post->body = 'Some title';
$post->save();
}
}
这是我的 Post 类:
<?php
class Post extends Eloquent {
protected $guarded = array();
public static $rules = array();
}