Php Laravel-Larabook教程:用户。Codeception确实看到了新记录

Php Laravel-Larabook教程:用户。Codeception确实看到了新记录,php,mysql,laravel-4,codeception,Php,Mysql,Laravel 4,Codeception,在larabook教程中,我很难通过codeception测试。我正在完成第8集:但我的codeception测试通过时遇到了问题。即使从视频中更正代码并添加“记住”,我也会得到同样的错误 There was 1 failure: --------- 1) Failed to perform actions and see result in SignUpCept (/home/vagrant/larabook/tests/functional/SignUpCept.php) Couldn't

在larabook教程中,我很难通过codeception测试。我正在完成第8集:但我的codeception测试通过时遇到了问题。即使从视频中更正代码并添加“记住”,我也会得到同样的错误

There was 1 failure:

---------
1) Failed to perform actions and see result in SignUpCept (/home/vagrant/larabook/tests/functional/SignUpCept.php)
Couldn't see record "users",{"username":"JohnDoe","email":"john@example.com"}:
Couldn't find users with {"username":"JohnDoe","email":"john@example.com"}

Scenario Steps:
12. I see record "users",{"username":"JohnDoe","email":"john@example.com"}
11. I see "Welcome to Larabook"
10. I see current url equals ""
9 . I click "Sign Up","input[type="submit"]"
8 . I fill field "Password Confirmation:","demo"
7 . I fill field "Password:","demo"
6 . I fill field "Email:","john@example.com"


FAILURES!                            
Tests: 1, Assertions: 3, Failures: 1.
下面是我创建此记录的文件。有人能帮我调试这个错误吗

SignUpCept.php

$I = new FunctionalTester($scenario);
$I->am('a guest');
$I->wantTo('perform actions and see result');

$I->amOnPage('/');
$I->click('Sign Up!');
$I->seeCurrentUrlEquals('/register');

$I->fillField('Username:', 'JohnDoe');
$I->fillField('Email:', 'john@example.com');
$I->fillField('Password:', 'demo');
$I->fillField('Password Confirmation:', 'demo');
$I->click('Sign Up', 'input[type="submit"]');

$I->seeCurrentUrlEquals('');
$I->see('Welcome to Larabook');
$I->seeRecord('users', [
    'username' => 'JohnDoe',
    'email' => 'john@example.com'
]);
迁移

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateUsersTable extends Migration {

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function(Blueprint $table)
        {
            $table->increments('id');
            $table->string('username')->unique();
            $table->string('email')->unique();
            $table->string('password', 60);
            $table->string('remember_token')->nullable();
            $table->timestamps();
        });
    }


    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('users');
    }

}
User.php

use Illuminate\Auth\UserTrait;
use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableTrait;
use Illuminate\Auth\Reminders\RemindableInterface;


class User extends Eloquent implements UserInterface, RemindableInterface {

    use UserTrait, RemindableTrait;

    /**
     * Which fields may be mass assigned?
     *
     * @var array
     */
    protected $fillable = ['username', 'name', 'password'];

    /**
     * The database table used by the model.
     *
     * @var string
     */
    protected $table = 'users';

    /**
     * The attributes excluded from the model's JSON form.
     *
     * @var array
     */
    protected $hidden = array('password', 'remember_token');
}
RegistrationController.php



class RegistrationController extends \BaseController
{

    /**
     * Show a form to register a user.
     *
     * @return Response
     */
    public function create()
    {
        return View::make('registration.create');
    }


    /**
     * Create a new larabook user
     *
     * @return string
     */
    public function store()
    {
        User::create(
            Input::only('username', 'email', 'password')
        );

        return Redirect::home();

    }
}

看看你的User.php

/**
 * Which fields may be mass assigned?
 *
 * @var array
 */
protected $fillable = ['username', 'name', 'password'];
应该是

protected $fillable = ['username', 'email', 'password'];

非常感谢。你是对的。我犯了一个新手错误。非常感谢你的帮助