コード例 #1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $dbIndustryRepository = new DbIndustryRepository();
     $dbUserRepository = new DbUserRepository();
     $authorUser = $dbUserRepository->findByEmail(env('COMPANY_REPRESENTATIVE_EMAIL'));
     $dbIndustryRepository->store($authorUser, ['name' => 'Health', 'fontawesome' => 'fa fa-heartbeat']);
     $dbIndustryRepository->store($authorUser, ['name' => 'Logistics', 'fontawesome' => 'fa fa-bar-chart']);
     $dbIndustryRepository->store($authorUser, ['name' => 'Energy', 'fontawesome' => 'fa fa-sun-o']);
     $dbIndustryRepository->store($authorUser, ['name' => 'Trade', 'fontawesome' => 'fa fa-exchange']);
     $dbIndustryRepository->store($authorUser, ['name' => 'Law', 'fontawesome' => 'fa fa-university']);
 }
コード例 #2
0
 /** @test */
 public function it_stores_an_industry()
 {
     $dbIndustryRepository = new DbIndustryRepository();
     $expectedIndustry = factory(Industry::class)->make();
     $author = factory(User::class)->create();
     $keys = $expectedIndustry->getFillable();
     $expectedData = array_only($expectedIndustry->toArray(), $keys);
     $this->notSeeInDatabase('industries', $expectedData);
     $actualIndustry = $dbIndustryRepository->store($author, $expectedData);
     $this->seeInDatabase('industries', $expectedData);
     $this->assertSame($author->id, $actualIndustry->author->id);
 }