Skip to content

Commit

Permalink
[FrameworkBundle] Prove client insulation and non-insulation works in…
Browse files Browse the repository at this point in the history
… session tests.
  • Loading branch information
Drak committed Dec 16, 2011
1 parent ce66548 commit 9b8cdab
Showing 1 changed file with 22 additions and 8 deletions.
Expand Up @@ -17,12 +17,16 @@
class SessionTest extends WebTestCase
{
/**
* Tests session attributes persist.
*
* @dataProvider getConfigs
*/
public function testWelcome($config)
public function testWelcome($config, $insulate)
{
$client = $this->createClient(array('test_case' => 'Session', 'root_config' => $config));
$client->insulate();
if ($insulate) {
$client->insulate();
}

// no session
$crawler = $client->request('GET', '/session');
Expand All @@ -46,12 +50,16 @@ public function testWelcome($config)
}

/**
* Tests flash messages work in practice.
*
* @dataProvider getConfigs
*/
public function testFlash($config)
public function testFlash($config, $insulate)
{
$client = $this->createClient(array('test_case' => 'Session', 'root_config' => $config));
$client->insulate();
if ($insulate) {
$client->insulate();
}

// set flash
$crawler = $client->request('GET', '/session_setflash/Hello%20world.');
Expand All @@ -70,15 +78,19 @@ public function testFlash($config)
*
* @dataProvider getConfigs
*/
public function testTwoClients($config)
public function testTwoClients($config, $insulate)
{
// start first client
$client1 = $this->createClient(array('test_case' => 'Session', 'root_config' => $config));
$client1->insulate();
if ($insulate) {
$client1->insulate();
}

// start second client
$client2 = $this->createClient(array('test_case' => 'Session', 'root_config' => $config));
$client2->insulate();
if ($insulate) {
$client2->insulate();
}

// new session, so no name set.
$crawler1 = $client1->request('GET', '/session');
Expand Down Expand Up @@ -120,7 +132,9 @@ public function testTwoClients($config)
public function getConfigs()
{
return array(
array('config.yml'),
// configfile, insulate
array('config.yml', true),
array('config.yml', false),
);
}

Expand Down

0 comments on commit 9b8cdab

Please sign in to comment.