summaryrefslogtreecommitdiffstats
path: root/Tests/Http
diff options
context:
space:
mode:
authorFabien Potencier <fabien.potencier@gmail.com>2013-02-07 17:43:41 +0100
committerFabien Potencier <fabien.potencier@gmail.com>2013-02-07 17:43:41 +0100
commit4b78c06d5461d28884ca4181383bfa7b960426b6 (patch)
tree42c5d8918cf0014123fff8349b1c4da4ca1f25bb /Tests/Http
parent49f2eb420b3835d1032dbad4c52e1caa70930cf5 (diff)
parentb570b85dcdea40e070678c08af85d94083111fd4 (diff)
downloadsymfony-security-4b78c06d5461d28884ca4181383bfa7b960426b6.zip
symfony-security-4b78c06d5461d28884ca4181383bfa7b960426b6.tar.gz
symfony-security-4b78c06d5461d28884ca4181383bfa7b960426b6.tar.bz2
Merge branch '2.2'
* 2.2: [HttpFoundation] fixed Request::create() method [HttpKernel] fixed the creation of the Profiler directory [HttpKernel] fixed the hinclude fragment renderer when the template is empty bumped Symfony version to 2.2.0-RC2-DEV [DependencyInjection] enhanced some error messages [FrameworkBundle] fixed typo fixed typo tweaked previous merge [Security] fixed interface implementation (closes #6974) Add "'property_path' => false" deprecation message for forms fixed CS Added BCrypt password encoder. updated VERSION for 2.2.0-RC1 Removed underscores from test method names to be consistent with other components. [Security] fixed session creation when none is needed (closes #6917) [FrameworkBundle] removed obsolete comment (see 2e356c1) Micro-optimization [FrameworkBundle] removed extra whitespaces [Security] renamed Constraint namespace to Constraints for validator classes in order to be consistent with the whole current validator API. [FrameworkBundle] fixed wrong indentation on route debug output
Diffstat (limited to 'Tests/Http')
-rw-r--r--Tests/Http/Firewall/ContextListenerTest.php58
1 files changed, 30 insertions, 28 deletions
diff --git a/Tests/Http/Firewall/ContextListenerTest.php b/Tests/Http/Firewall/ContextListenerTest.php
index 620aa29..2a8a28e 100644
--- a/Tests/Http/Firewall/ContextListenerTest.php
+++ b/Tests/Http/Firewall/ContextListenerTest.php
@@ -82,36 +82,12 @@ class ContextListenerTest extends \PHPUnit_Framework_TestCase
$this->assertFalse($session->has('_security_session'));
}
- protected function runSessionOnKernelResponse($newToken, $original = null)
- {
- $session = new Session(new MockArraySessionStorage());
-
- if ($original !== null) {
- $session->set('_security_session', $original);
- }
-
- $this->securityContext->setToken($newToken);
-
- $request = new Request();
- $request->setSession($session);
-
- $event = new FilterResponseEvent(
- $this->getMock('Symfony\Component\HttpKernel\HttpKernelInterface'),
- $request,
- HttpKernelInterface::MASTER_REQUEST,
- new Response()
- );
-
- $listener = new ContextListener($this->securityContext, array(), 'session');
- $listener->onKernelResponse($event);
-
- return $session;
- }
-
public function testOnKernelResponseWithoutSession()
{
$this->securityContext->setToken(new UsernamePasswordToken('test1', 'pass1', 'phpunit'));
$request = new Request();
+ $session = new Session(new MockArraySessionStorage());
+ $request->setSession($session);
$event = new FilterResponseEvent(
$this->getMock('Symfony\Component\HttpKernel\HttpKernelInterface'),
@@ -123,7 +99,7 @@ class ContextListenerTest extends \PHPUnit_Framework_TestCase
$listener = new ContextListener($this->securityContext, array(), 'session');
$listener->onKernelResponse($event);
- $this->assertFalse($request->hasSession());
+ $this->assertFalse($session->isStarted());
}
/**
@@ -168,4 +144,30 @@ class ContextListenerTest extends \PHPUnit_Framework_TestCase
array(null),
);
}
-}
+
+ protected function runSessionOnKernelResponse($newToken, $original = null)
+ {
+ $session = new Session(new MockArraySessionStorage());
+
+ if ($original !== null) {
+ $session->set('_security_session', $original);
+ }
+
+ $this->securityContext->setToken($newToken);
+
+ $request = new Request();
+ $request->setSession($session);
+ $request->cookies->set('MOCKSESSID', true);
+
+ $event = new FilterResponseEvent(
+ $this->getMock('Symfony\Component\HttpKernel\HttpKernelInterface'),
+ $request,
+ HttpKernelInterface::MASTER_REQUEST,
+ new Response()
+ );
+
+ $listener = new ContextListener($this->securityContext, array(), 'session');
+ $listener->onKernelResponse($event);
+
+ return $session;
+ }}