diff --git a/best_practices/tests.rst b/best_practices/tests.rst index 0bbcbd665de..56f0581816e 100644 --- a/best_practices/tests.rst +++ b/best_practices/tests.rst @@ -30,25 +30,35 @@ A functional test can be as easy as this: .. code-block:: php - /** @dataProvider provideUrls */ - public function testPageIsSuccessful($url) - { - $client = self::createClient(); - $client->request('GET', $url); + // src/AppBundle/Tests/ApplicationAvailabilityFunctionalTest.php + namespace AppBundle\Tests; - $this->assertTrue($client->getResponse()->isSuccessful()); - } + use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; - public function provideUrls() + class ApplicationAvailabilityFunctionalTest extends WebTestCase { - return array( - array('/'), - array('/posts'), - array('/post/fixture-post-1'), - array('/blog/category/fixture-category'), - array('/archives'), - // ... - ); + /** + * @dataProvider urlProvider + */ + public function testPageIsSuccessful($url) + { + $client = self::createClient(); + $client->request('GET', $url); + + $this->assertTrue($client->getResponse()->isSuccessful()); + } + + public function urlProvider() + { + return array( + array('/'), + array('/posts'), + array('/post/fixture-post-1'), + array('/blog/category/fixture-category'), + array('/archives'), + // ... + ); + } } This code checks that all the given URLs load successfully, which means that
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: