Skip to content

Instantly share code, notes, and snippets.

@jmather
Forked from anonymous/gist:4320524
Created December 17, 2012 18:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmather/4320569 to your computer and use it in GitHub Desktop.
Save jmather/4320569 to your computer and use it in GitHub Desktop.
<?php
use Silex\WebTestCase;
use Silex\Application;
use Silex\Provider\SessionServiceProvider;
use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage;
class unitTest extends WebTestCase
{
public function testUn()
{
$client = $this->createClient();
$client->request('GET', '/');
$client->request('GET', '/');
}
public function createApplication()
{
$app = new Application('test');
$app->register(new SessionServiceProvider());
$app['session.storage'] = $app->share(function() {
return new MockArraySessionStorage();
});
$app['debug'] = true;
$app['exception_handler']->disable();
$app->get('/', function(Application $app) {
$app['session']->set('pif', 'paf');
return 'BOOM';
});
return $app;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment