Guest User

Untitled

a guest
Dec 12th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. /** @test */
  2. public function a_job_can_be_stored_in_database()
  3. {
  4. $this->withoutExceptionHandling();
  5.  
  6. $company = factory('AppCompany')->create();
  7.  
  8. $job = factory('AppJob')->make([
  9. 'description' => 'we are looking for cheff helper'
  10. ]);
  11.  
  12. $this->post(route('jobs.store'), $job->toArray());
  13. $this->assertDatabaseHas('jobs', [
  14. 'description' => 'we are looking for cheff helper'
  15. ]);
  16. }
  17.  
  18. public function store(Company $company)
  19. {
  20.  
  21. $company->addJob([
  22. 'city_id' => request('city_id'),
  23. 'title' => request('title'),
  24. 'description' => request('description'),
  25. 'requirements' => request('requirements'),
  26. 'salary' => request('salary'),
  27. 'address' => request('address')
  28. ]);
  29.  
  30. return redirect(route('jobs.index'));
  31. }
  32.  
  33. public function addJob($data)
  34. {
  35. return $this->jobs()->create($data);
  36. }
  37.  
  38. TestsFeatureJobFeatureTest::a_job_can_be_stored_in_database
Add Comment
Please, Sign In to add comment