3

I am trying to call 'router:debug' Command from within a WebTestCase to validate all static routes automatically.

class RoutesTest extends WebTestCase
{
  public function setUp() 
   {
     $command = self::getApplication()->find('router:debug');
     $input = new ArrayInput(array());
     $returnCode = $command->run($input, $output);
     if($returnCode == 0) {
        var_dump($output);
     }
   }
} 

But I get a

PHP Fatal error: Call to undefined method MyApplication\MyBundle\Tests\Controller\RoutesTest::getApplication() in /data/www/symfony/src/Prexem/UserBundle/Tests/Controller/DefaultControllerTest.php

Pierre de LESPINAY
  • 44,700
  • 57
  • 210
  • 307
wid
  • 341
  • 2
  • 5

1 Answers1

0

I thought that self::getApplication() was a member of WebTestCase because I saw snipplet with this method.

But actually I have to implement it like in this one: Best way to create a test database and load fixtures on Symfony 2 WebTestCase?

Community
  • 1
  • 1
wid
  • 341
  • 2
  • 5