예제 #1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $dbIndustryRepository = new DbIndustryRepository();
     $dbCountryRepository = new DbCountryRepository();
     $dbUserRepository = new DbUserRepository();
     $healthIndustry = $dbIndustryRepository->findByName('Health');
     $countries = $dbCountryRepository->all()->toArray();
     $companyRepresentativeUsers = $dbUserRepository->withCompanyRepresentativeRole()->get()->toArray();
     $faker = Factory::create();
     foreach ($this->popularCompanies as $company) {
         factory(Company::class, 'relationless')->create(['name' => $company['name'], 'description' => $company['description'], 'industry_id' => $healthIndustry->id, 'country_id' => $faker->randomElement($countries)['id'], 'user_id' => $faker->randomElement($companyRepresentativeUsers)['id'], 'logo_id' => factory(File::class)->create()->id]);
     }
 }
예제 #2
0
 /** @test */
 public function it_returns_decisions_by_companies_industry()
 {
     $dbCompanyRepository = new DbCompanyRepository();
     $dbIndustryRepository = new DbIndustryRepository();
     $industry = factory(Industry::class)->create();
     $companies = factory(Company::class, 2)->create(['industry_id' => $industry->id]);
     $decisions0 = factory(Decision::class, 2)->create();
     $decisions1 = factory(Decision::class, 2)->create();
     $events = $dbIndustryRepository->companyDecisions($industry)->get();
     $this->assertCount(0, $events);
     $this->assertNotFalse($dbCompanyRepository->assignDecisions($companies->get(0), $decisions0));
     $this->assertNotFalse($dbCompanyRepository->assignDecisions($companies->get(1), $decisions1));
     $events = $dbIndustryRepository->companyDecisions($industry)->get();
     $this->assertCount(4, $events);
 }
예제 #3
0
 /** @test */
 public function it_returns_files_of_companies_by_industry()
 {
     $dbCompanyRepository = new DbCompanyRepository();
     $dbIndustryRepository = new DbIndustryRepository();
     $industry = factory(Industry::class)->create();
     $companies = factory(Company::class, 2)->create(['industry_id' => $industry->id]);
     $files0 = factory(File::class, 2)->create();
     $files1 = factory(File::class, 2)->create();
     $files = $dbIndustryRepository->companyFiles($industry)->get();
     $this->assertCount(0, $files);
     $this->assertNotFalse($dbCompanyRepository->assignFiles($companies->get(0), $files0));
     $this->assertNotFalse($dbCompanyRepository->assignFiles($companies->get(1), $files1));
     $files = $dbIndustryRepository->companyFiles($industry)->get();
     $this->assertCount(4, $files);
 }
예제 #4
0
 /** @test */
 public function it_reads_work_groups_show()
 {
     $dbIndustryRepository = new DbIndustryRepository();
     $dbArticleRepository = new DbArticleRepository();
     $dbCompanyRepository = new DbCompanyRepository();
     $users = factory(User::class, 2)->create();
     $industry = factory(Industry::class)->create();
     $workGroup = factory(Workgroup::class)->create();
     $dbIndustryRepository->assignWorkGroupsById($industry, [$workGroup->id]);
     $articles = factory(Article::class, 3)->create(['industry_id' => $industry->id, 'publish' => true]);
     $articleChecker = factory(Article::class)->create();
     $company = factory(Company::class)->create(['industry_id' => $industry->id, 'user_id' => $users->get(0)->id]);
     $files = factory(File::class, 2)->create();
     $dbCompanyRepository->assignFiles($company, $files);
     $events = factory(Event::class, 2)->create();
     $dbCompanyRepository->assignEvents($company, $events);
     $decisions = factory(Decision::class, 2)->create();
     $dbCompanyRepository->assignDecisions($company, $decisions);
     $this->visit(route('industries.work_groups.show', ['industry_slug' => $industry->slug, 'work_group_slug' => $workGroup->slug]))->seePageIs(route('industries.work_groups.show', ['industry_slug' => $industry->slug, 'work_group_slug' => $workGroup->slug]))->see("<title> {$workGroup->name} - {$industry->name} · Chamb.Net</title>")->see('<span>Protocols</span>')->see('<span>Ideas</span>')->see('<span>Decisions</span>')->see('<span>Events</span>')->see('<h2 class="title-v2 title-center">POPULAR NEWS</h2>')->see($articles->get(0)->title)->see($articles->get(1)->title)->see($articles->get(2)->title)->dontSee($articleChecker->title)->see('<h2 class="title-v2 title-center">PROTOCOLS</h2>')->see($files->get(0)->name)->see($files->get(0)->description)->see(route('files.download', ['path' => $files->get(0)->path]))->see($files->get(1)->name)->see($files->get(1)->description)->see(route('files.download', ['path' => $files->get(1)->path]))->see("<span>{$events->get(0)->start_date->format('d')}</span>")->see("<small>{$events->get(0)->start_date->format('m, Y')}</small>")->see($events->get(0)->name)->see($events->get(0)->description)->see("<span>{$events->get(1)->start_date->format('d')}</span>")->see("<small>{$events->get(1)->start_date->format('m, Y')}</small>")->see($events->get(1)->name)->see($events->get(1)->description)->see('<i class="fa fa-pencil"></i>Decisions')->see($decisions->get(0)->name)->see($events->get(0)->description)->see($decisions->get(1)->name)->see($events->get(1)->description)->see($users->get(0)->name)->see($users->get(0)->created_at->format('M D, Y'))->see($users->get(0)->facebook_url)->see($users->get(0)->twitter_url)->see($users->get(0)->linked_in_url)->see($users->get(0)->email)->see($users->get(0)->website_url)->dontSee($users->get(1)->name);
 }
예제 #5
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']);
 }
예제 #6
0
 /** @test */
 public function it_finds_industry_by_name()
 {
     $dbIndustryRepository = new DbIndustryRepository();
     $actualIndustry = factory(Industry::class)->create();
     $keys = $actualIndustry->getFillable();
     $expectedIndustry = $dbIndustryRepository->findByName($actualIndustry->name);
     $this->assertNotNull($expectedIndustry);
     $this->assertEquals(array_only($actualIndustry->toArray(), $keys), array_only($expectedIndustry->toArray(), $keys));
 }
예제 #7
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $dbIndustryRepository = new DbIndustryRepository();
     $healthIndustry = $dbIndustryRepository->findByName('Health');
     factory(Article::class, 'without_industry', 3)->create(['industry_id' => $healthIndustry->id, 'publish' => 1]);
 }