Created
July 26, 2017 13:36
-
-
Save NandoKstroNet/42eab6903705f8048993fde6f702350e to your computer and use it in GitHub Desktop.
Conteúdo criado na série sobre testes com Silex pela Code Experts Learning https://codeexpertslearning.com.br
This file contains hidden or 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 Silex\WebTestCase; | |
class RoutesTest extends WebTestCase | |
{ | |
public function createApplication() | |
{ | |
return require ROOT_DIR . '/app.php'; | |
} | |
public function testIndexRoute() | |
{ | |
$client = $this->createClient(); | |
$crawler = $client->request('GET', '/'); | |
$this->assertTrue($client->getResponse()->isOk()); | |
$this->assertCount(1, $crawler->filter('h1:contains("Testando")')); | |
} | |
public function testNewsRouteWithDynamicParameter() | |
{ | |
$slug = 'noticia-teste'; | |
$client = $this->createClient(); | |
$crawler = $client->request('GET', '/noticia/' . $slug); | |
$this->assertTrue($client->getResponse()->isOk()); | |
$this->assertCount(1, $crawler->filter('h1:contains("Noticia: ' . $slug . '")')); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment