I'm doing some unit testing (phpunit) for a Symfony2 Bundle and i want to test this method :
/**
* Set a flash notification
* @param array $message
*/
public function setFlashNotification(array $message) {
if (!isset($message['key'])) {
throw new \ErrorException("Message array must contains a key");
}
if (!isset($message['content'])) {
throw new \ErrorException("Message array must contains a content");
}
$this->container->get('session')->getFlashBag()->add(self::SESSION_KEY . $message['key'], $message['content']);
}
In my tests it seems i need Symfony2 service container to use the session, but how can i unit test this method without Symfony2 AppKernel.php dependency ?
Thanks