Last active
August 29, 2015 14:23
-
-
Save petersuhm/ec04e497f3c9eca42086 to your computer and use it in GitHub Desktop.
Laravel 5.1 test example
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 | |
use Illuminate\Foundation\Testing\DatabaseMigrations; | |
use WpShop\Product; | |
class ProductOverviewTest extends TestCase | |
{ | |
use DatabaseMigrations; | |
/** | |
* @test | |
*/ | |
public function it_can_list_all_products() | |
{ | |
// With no products in DB | |
$this->visit('/admin/products')->see('No products'); | |
// Populate DB | |
Product::create(['name' => 'WP Pusher']); | |
Product::create(['name' => 'Mailchimp for WordPress']); | |
// Chain test expectations | |
$this | |
// Go to product creation page | |
->visit('/admin/products') | |
// Make sure we see the products added | |
->see('WP Pusher') | |
->see('Mailchimp for WordPress') | |
; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment