Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save emil-nasso/2a37ceb9a88500a84928a03422fff1c0 to your computer and use it in GitHub Desktop.
Save emil-nasso/2a37ceb9a88500a84928a03422fff1c0 to your computer and use it in GitHub Desktop.
// tests/AppBundle/Controller/PostControllerTest.php
namespace Tests\AppBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class PostControllerTest extends WebTestCase
{
public function testShowPost()
{
$mock = /** mocked version of the service with data relevant to this test**/
$client = static::createClient(['app.externalapi' => $mock);
$crawler = $client->request('GET', '/post/hello-world');
$this->assertGreaterThan(
0,
$crawler->filter('html:contains("Hello World")')->count()
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment