2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

phpunit テスト実行時にエラー General error: 1 no such table テーブル名

Posted at

エラー内容

tarminal
SQLSTATE[HY000]: General error: 1 no such table: users ...................
........
.....

usersテーブルが無いよ!って返事が北

テーブルあるけどなぁ、、、、
ggったらphpunit.xmlの設定を変えると改善するとのこと

phpunit.xml
    <php>
        <server name="APP_ENV" value="testing"/>
        <server name="BCRYPT_ROUNDS" value="4"/>
        <server name="CACHE_DRIVER" value="array"/>
        <server name="DB_CONNECTION" value="sqlite"/><!--使用しているDB言語に変更-->
        <server name="DB_DATABASE" value=":memory:"/><!--使用しているDB名に変更-->
        <server name="MAIL_DRIVER" value="array"/>
        <server name="QUEUE_CONNECTION" value="sync"/>
        <server name="SESSION_DRIVER" value="array"/>
    </php>


tarminal

PHPUnit 8.5.8 by Sebastian Bergmann and contributors.

...                                                                 3 / 3 (100%)

Time: 4.47 seconds, Memory: 24.00 MB

OK (3 tests, 7 assertions)

無事テスト成功しました🙌

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?