mercredi 23 décembre 2015

Error: Base table or view not found when Creating Records on Laravel Test SetUp()?

When creating a record in setUp():

public function setUp(){
  parent::setUp();

  $company = new App\Company();
  $company->company_name = 'MyTest';
  $company->save();
}

I get the following error:

Base table or view not found

I am using use DatabaseMigrations; in my TestCase. It could be that the migrations run just before a testCase starts, so when `setUpz is run there is no table created yet.

Using Laravel 5.1

Currently I have to repeat myself by creating this record in every test.

Any ideas how to make this work?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire