/** @test */ public function it_returns_all_events() { $dbEventRepository = new DbEventRepository(); $this->assertCount(0, $dbEventRepository->all()); $actualEvents = factory(Event::class, 2)->create(); $expectedEvents = $dbEventRepository->all(); $this->assertSame(2, $expectedEvents->count()); $this->assertSame(array_only($expectedEvents->toArray(), $expectedEvents[0]->getFillable()), array_only($actualEvents->toArray(), $expectedEvents[0]->getFillable())); }
/** * Run the database seeds. * * @return void */ public function run() { $dbCompanyRepository = new DbCompanyRepository(); $dbEventRepository = new DbEventRepository(); $dbDecisionRepository = new DbDecisionRepository(); foreach ($dbCompanyRepository->all() as $event) { $files = factory(File::class, 2)->create(); $dbCompanyRepository->assignFiles($event, $files); } foreach ($dbEventRepository->all() as $event) { $files = factory(File::class, 2)->create(); $dbEventRepository->assignFiles($event, $files); } foreach ($dbDecisionRepository->all() as $decision) { $file = factory(File::class)->create(); $dbDecisionRepository->assignFile($decision, $file); } }