Skip to content

Instantly share code, notes, and snippets.

@muhamed-didovic
Forked from laracasts/test.php
Last active August 29, 2015 14:11
Show Gist options
  • Select an option

  • Save muhamed-didovic/9e701af1224fb1b518d7 to your computer and use it in GitHub Desktop.

Select an option

Save muhamed-didovic/9e701af1224fb1b518d7 to your computer and use it in GitHub Desktop.
<?php
class ExampleTest extends TestCase {
public function setUp()
{
parent::setUp();
DB::beginTransaction();
}
/**
* A basic functional test example.
*
* @return void
*/
public function testShowsPosts()
{
$title = 'Yay Great Post';
// "Create" post
Post::create(compact('title'));
$crawler = $this->client->request('GET', 'posts');
$this->assertEquals(
1,
count($crawler->filter("body:contains('{$title}')")),
"Expected to see the text '{$title}' within a body element."
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment