For anyone that wants to test anything session based in their WebTestCases
using the Client you've probably noticed that you can't with
ArraySessionStorage. Here's a little hack that lets you work around that,
setting the same session on every container. Now you can test session based
logins, etc.

https://gist.github.com/830331

<?php

class YourTestKernel extends \yourKernel
{
    protected $session;

    protected function initializeContainer()
    {
        parent::initializeContainer();

        // first use
        if ($this->session === null) {
            $this->session = $this->container->get('session');
        } else {
            $this->container->set('session', $this->session);
        }
    }
}


-- 
Πίστις, ἐλπίς, ἀγάπη

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en

Reply via email to