Last active
August 29, 2015 14:17
-
-
Save laracasts/438807e138f5503eacf7 to your computer and use it in GitHub Desktop.
Working on integration testing helper for PHPUnit.
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 | |
class ExampleTest extends IntegrationTest | |
{ | |
/** test */ | |
public function it_verifies_that_pages_load_properly() | |
{ | |
$this->visit('/'); | |
} | |
/** test */ | |
public function it_follows_links() | |
{ | |
$this->visit('/page-1') | |
->click('Follow Me') | |
->andSee('You are on Page 2') | |
->onPage('/page-2'); | |
} | |
/** @test */ | |
public function it_submits_forms() | |
{ | |
$this->visit('page-with-form') | |
->submitForm('Submit', ['title' => 'Foo Title']) | |
->andSee('You entered Foo Title') | |
->onPage('/page-with-form-results'); | |
// Another way to write it. | |
$this->visit('page-with-form') | |
->type('Foo Title', '#title') | |
->press('Submit') | |
->see('You Entered Foo Title'); | |
} | |
/** @test */ | |
public function it_verifies_information_in_the_database() | |
{ | |
$this->visit('database-test') | |
->type('Testing', 'name') | |
->press('Save to Database') | |
->verifyInDatabase('things', ['name' => 'Testing']); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment