Skip to content

Instantly share code, notes, and snippets.

@flug
Last active October 31, 2019 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flug/570c9f6aa0155aed260c5b7d8cd8fbd3 to your computer and use it in GitHub Desktop.
Save flug/570c9f6aa0155aed260c5b7d8cd8fbd3 to your computer and use it in GitHub Desktop.
[SmokeFunctionalTest] #php #symfony
<?php
namespace App\Tests;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class SmokeFunctionalTest extends WebTestCase
{
/**
* @dataProvider urlProvider
*/
public function testPageIsSuccessful($url)
{
$client = self::createClient();
$client->request('GET', $url);
$this->assertContains($client->getResponse()->getStatusCode(), [200, 302, 403, 400]);
}
public function urlProvider()
{
self::bootKernel();
$container = self::$kernel->getContainer();
foreach ($container->get('router')->getRouteCollection()->all() as $route) {
if (in_array('GET', $route->getMethods()) && !(bool)strpos($route->getPath(), '{')) {
yield [$route->getPath()];
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment