わからないこと
App/User.php の中にあるcreateメソッドに対するテスト
エラーメッセージ
Table 'test_dbname.mockery_0__app__users' doesn't exist (SQL: insert into `mockery_0__app__ users`(..略..)
エラー文を見る限りテーブル名に接頭辞を付けられてしまい、テーブルが見つからないと出ているのですが
勝手につけさせないためにはmockeryの制御をするのでしょうか。
この辺りの制御方法をどなたかご存知でしたら教えてください。
よろしくお願いします。
環境
LAMP
centos7, php7.2.x phpunit(~6.0)
やったこと
php vendor/bin/phpunit tests/Unit/UserTest.php
** UserTest.php **
public function testSample() { $user = new \stdClass(); $user->name = $this->user_name; $user->email = "email"; $user->password = bcrypt("password"); $user->remarks = "remarks"; $user->authority = 0; $user->deleted = 0; $mock = \Mockery::mock('App\User')->makePartial(); try{ $mock->create($user, 1); }catch (\PDOException $e){ print_r($e->getMessage()); } }
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。