controllersTest.php 743 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. use Silex\WebTestCase;
  3. class controllersTest extends WebTestCase {
  4. public function testGetHomepage() {
  5. $client = $this->createClient();
  6. $client->followRedirects(TRUE);
  7. $crawler = $client->request('GET', '/');
  8. $this->assertTrue($client->getResponse()->isOk());
  9. // cf index.html.twig.
  10. $this->assertContains('Welcome', $crawler->filter('body')->text());
  11. }
  12. public function createApplication() {
  13. $app = require __DIR__ . '/../src/app.php';
  14. require __DIR__ . '/../config/dev.php';
  15. require __DIR__ . '/../src/controllers.php';
  16. $app['session.test'] = TRUE;
  17. // Get raw exceptions instead of HTML page responses.
  18. // unset($app['exception_handler']);
  19. return $this->app = $app;
  20. }
  21. }