Codeception submitForm因SQL错误而失败

时间:2014-10-02 20:22:59

标签: php testing laravel-4 codeception

我正在尝试使用Laravel 4.2进行一些Codeception测试,我收到一个奇怪的错误。我的测试是尝试创建用户但由于SQL更新错误而失败。这是测试:

<?php
    $I = new FunctionalTester($scenario);
    $I->wantTo('create a new user');

    $I->amLoggedAs(User::find(1));
    $I->amOnPage('/users');
    $I->click('Create New');
    $I->amOnPage('/users/create');
    $I->submitForm('#create-users-form', ['firstName' => 'John', 'lastName' => 'Doe', 'emailAddress' => 'jd@yahoo.com']);
    $I->amOnPage('/users');
    $I->seeInDatabase('users', ['emailAddress' => 'jd@yahoo.com']);

此测试生成的输出:

There was 1 error:

---------
1) Failed to create a new user in CreateNewUserCept (tests/functional/CreateNewUserCept.php)
Couldn't submit form "#create-users-form",{"firstName":"John","lastName":"Doe","emailAddress":"jd@yahoo.com"}:
Illuminate\Database\QueryException: SQLSTATE[HY000]: General error: 1 no such column: email (SQL: update "users" set "email" = jd@yahoo.com, "password" = y$/vao8Yx/nRjGEGdg0NaN/ugr3O.KZjekVqJw7tq71uGsgFcp.SkA2, "updated_at" = 2014-10-02 20:14:39 where "id" = 27)

Scenario Steps:
5. I submit form "#create-users-form",{"firstName":"John","lastName":"Doe","emailAddress":"jd@yahoo.com"}
4. I am on page "/users/create"
3. I click "Create New"
2. I am on page "/users"
1. I am logged as "{** actual user detail **}"

它在第5步失败。为什么要运行更新查询,为什么要查找email

谢谢!

0 个答案:

没有答案