mardi 3 février 2015

Get container in test class Symfony2

how I can get container to be able getting mys services in tests classes. I found the solution to require_once dir(__FILE__). '/...../AppKernel.php;, But when I go into WebTestCase class and found



protected static function createClient(array $options = array(), array $server = array())
{
static::bootKernel($options);

$client = static::$kernel->getContainer()->get('test.client');
$client->setServerParameters($server);

return $client;
}


Where Kernel booting, and another class KernelTestCase so I want to know I need to require_once AppKernel file or there is exist some more flexible and better method to get service container? Thanks!


Aucun commentaire:

Enregistrer un commentaire