Last active
November 24, 2015 22:18
-
-
Save helmerdavila/e864f6895da6692a156f to your computer and use it in GitHub Desktop.
Laravel Testing Tricks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Submit form with data | |
public function test_login_form() | |
{ | |
$this->visit('/login') | |
->submitForm('Log In', ['email' => '[email protected]', 'password' => 'secret']) | |
->see('Welcome!') | |
->onPage('dashboard'); | |
} | |
// Select works in select and radio buttons | |
public function test_signups_can_complete() | |
{ $this->visit('/signup') | |
->type('Matt Stauffer', 'name') | |
->check('overTwentyOne') | |
->select('Florida', 'state') | |
->attach('../uploads/test.jpg', 'profilePicture') | |
->press('Sign Up') | |
->seePageIs('/signup/thanks'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment