Guest User

Untitled

a guest
Dec 14th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 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
  39.  
  40. public function temporalTest()
  41. {
  42. $this->withoutExceptionHandling();
  43.  
  44. $song = factory('AppSong')->make(['name' => 'charlie']);
  45.  
  46. $this->post(route('songs.store', $song->artist_id), $song->toArray());
  47.  
  48. $this->assertDatabaseHas('songs',[
  49. 'name' => 'charlie'
  50. ]);
  51. }
Add Comment
Please, Sign In to add comment