Guest User

Untitled

a guest
Mar 22nd, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. /** @test */
  2. public function it_updates_personal_details(){
  3.  
  4. $this->withoutMiddleware();
  5. $this->visit('/account/settings')
  6. ->post('/account/settings', ["firstname"=>"RingoUpdated", 'lastname'=>"RingyUpdated", "username"=>"ringo", "bio"=>"My Personal Information", "facebook"=>"myFbUsername", "twitter"=>"myTwUsername", ])
  7. ->seeJson([
  8. "signup"=>true
  9. ]);
  10. }
  11.  
  12. public function it_updates_personal_details(){
  13. Auth::shouldReceive('id')->andReturn(1);
  14.  
  15. $this->withoutMiddleware();
  16. $this->visit('/account/settings')
  17. ->post('/account/settings', ["firstname"=>"RingoUpdated", 'lastname'=>"RingyUpdated", "username"=>"ringo", "bio"=>"My Personal Information", "facebook"=>"myFbUsername", "twitter"=>"myTwUsername", ])
  18. ->seeJson([
  19. "signup"=>true
  20. ]);
  21. }
  22.  
  23. <?php
  24.  
  25. use IlluminateFoundationTestingWithoutMiddleware;
  26. use IlluminateFoundationTestingDatabaseMigrations;
  27. use IlluminateFoundationTestingDatabaseTransactions;
  28.  
  29. use AppUser; // user model
  30.  
  31. class ExampleTest extends TestCase
  32. {
  33. public function testApplication()
  34. {
  35. $user = User::find(1); // find specific user
  36.  
  37. $this->actingAs($user)
  38. ->visit('/')
  39. ->see('Hello, '.$user->name);
  40. }
  41. }
  42.  
  43. $user = factory(AppUser::class)->create();
  44. $this->actingAs($user)
  45. ->visit('/')
  46. ->see('Hello, '.$user->name);
  47.  
  48. public function loginWithFakeUser()
  49. {
  50. $user = new User([
  51. 'id' => 1,
  52. 'name' => 'yish'
  53. ]);
  54.  
  55. $this->be($user);
  56. }
Add Comment
Please, Sign In to add comment