moved Request/Response/User classes to a new HttpFoundation component

The HttpFoundation component holds classes that wrap PHP native global arrays.

The following classes has been moved:

 * Symfony\Components\HttpKernel\Response -> Symfony\Components\HttpFoundation\Response
 * Symfony\Components\HttpKernel\Request -> Symfony\Components\HttpFoundation\Request
 * Symfony\Framework\FoundationBundle\User ->  Symfony\Components\HttpFoundation\Session
 * Symfony\Framework\FoundationBundle\Session\* ->  Symfony\Components\HttpFoundation\SessionStorage\*Storage

The web:user DI configuration has been moved to kernel:session.

The user helper has been renamed to session.
This commit is contained in:
Fabien Potencier 2010-07-09 09:26:22 +02:00
parent e63ff6e04b
commit 9133b9e5e4
45 changed files with 362 additions and 278 deletions

View File

@ -1,6 +1,6 @@
<?php
namespace Symfony\Components\HttpKernel;
namespace Symfony\Components\HttpFoundation;
/*
* This file is part of the Symfony framework.
@ -18,7 +18,7 @@ namespace Symfony\Components\HttpKernel;
* (and those that only apply to requests or responses).
*
* @package Symfony
* @subpackage Components_HttpKernel
* @subpackage Components_HttpFoundation
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
*/
class CacheControl

View File

@ -1,6 +1,6 @@
<?php
namespace Symfony\Components\HttpKernel;
namespace Symfony\Components\HttpFoundation;
/*
* This file is part of the Symfony package.
@ -15,7 +15,7 @@ namespace Symfony\Components\HttpKernel;
* HeaderBag is a container for HTTP headers.
*
* @package Symfony
* @subpackage Components_HttpKernel
* @subpackage Components_HttpFoundation
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
*/
class HeaderBag

View File

@ -1,6 +1,6 @@
<?php
namespace Symfony\Components\HttpKernel;
namespace Symfony\Components\HttpFoundation;
/*
* This file is part of the Symfony package.
@ -15,7 +15,7 @@ namespace Symfony\Components\HttpKernel;
* ParameterBag is a container for key/value pairs.
*
* @package Symfony
* @subpackage Components_HttpKernel
* @subpackage Components_HttpFoundation
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
*/
class ParameterBag

View File

@ -1,6 +1,8 @@
<?php
namespace Symfony\Components\HttpKernel;
namespace Symfony\Components\HttpFoundation;
use Symfony\Components\HttpFoundation\SessionStorage\NativeSessionStorage;
/*
* This file is part of the Symfony package.
@ -15,7 +17,7 @@ namespace Symfony\Components\HttpKernel;
* Request represents an HTTP request.
*
* @package Symfony
* @subpackage Components_HttpKernel
* @subpackage Components_HttpFoundation
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
*/
class Request
@ -37,6 +39,7 @@ class Request
protected $basePath;
protected $method;
protected $format;
protected $session;
static protected $formats;
@ -210,6 +213,26 @@ class Request
return $this->query->get($key, $this->path->get($key, $this->request->get($key, $default)));
}
public function getSession()
{
if (null === $this->session) {
$this->session = new Session(new NativeSessionStorage());
}
$this->session->start();
return $this->session;
}
public function hasSession()
{
return '' !== session_id();
}
public function setSession(Session $session)
{
$this->session = $session;
}
/**
* Returns current script name.
*

View File

@ -1,6 +1,6 @@
<?php
namespace Symfony\Components\HttpKernel;
namespace Symfony\Components\HttpFoundation;
/*
* This file is part of the Symfony package.
@ -15,7 +15,7 @@ namespace Symfony\Components\HttpKernel;
* Response represents an HTTP response.
*
* @package Symfony
* @subpackage Components_HttpKernel
* @subpackage Components_HttpFoundation
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
*/
class Response

View File

@ -1,10 +1,8 @@
<?php
namespace Symfony\Framework\FoundationBundle;
namespace Symfony\Components\HttpFoundation;
use Symfony\Components\EventDispatcher\EventDispatcher;
use Symfony\Components\EventDispatcher\Event;
use Symfony\Framework\FoundationBundle\Session\SessionInterface;
use Symfony\Components\HttpFoundation\SessionStorage\SessionStorageInterface;
/*
* This file is part of the Symfony framework.
@ -16,42 +14,57 @@ use Symfony\Framework\FoundationBundle\Session\SessionInterface;
*/
/**
* User.
* Session.
*
* @package Symfony
* @subpackage Framework_FoundationBundle
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
*/
class User
class Session
{
protected $session;
protected $storage;
protected $locale;
protected $attributes;
protected $oldFlashes;
protected $started;
protected $options;
/**
* Initialize the user class
* Constructor.
*
* @param EventDispatcher $dispatcher A EventDispatcher instance
* @param SessionInterface $session A SessionInterface instance
* @param array $options An array of options
* @param SessionStorageInterface $session A SessionStorageInterface instance
* @param array $options An array of options
*/
public function __construct(EventDispatcher $dispatcher, SessionInterface $session, $options = array())
public function __construct(SessionStorageInterface $storage, $options = array())
{
$this->dispatcher = $dispatcher;
$this->session = $session;
$this->storage = $storage;
$this->options = $options;
}
$this->setAttributes($session->read('_user', array(
/**
* Starts the session storage.
*/
public function start()
{
if (true === $this->started) {
return;
}
$this->storage->start();
$this->setAttributes($this->storage->read('_symfony2', array(
'_flash' => array(),
'_locale' => isset($options['default_locale']) ? $options['default_locale'] : 'en',
'_locale' => isset($this->options['default_locale']) ? $this->options['default_locale'] : 'en',
)));
// flag current flash to be removed at shutdown
$this->oldFlashes = array_flip(array_keys($this->getFlashMessages()));
$this->started = true;
}
/**
* Returns a user attribute
* Returns an attribute
*
* @param string $name The attribute name
* @param mixed $default The default value
@ -64,7 +77,7 @@ class User
}
/**
* Sets an user attribute.
* Sets an attribute.
*
* @param string $name
* @param mixed $value
@ -75,9 +88,9 @@ class User
}
/**
* Returns user attributes
* Returns attributes.
*
* @return array User attributes
* @return array Attributes
*/
public function getAttributes()
{
@ -85,7 +98,7 @@ class User
}
/**
* Sets user attributes
* Sets attributes
*
* @param array $attributes Attributes
*/
@ -95,7 +108,7 @@ class User
}
/**
* Returns the user locale
* Returns the locale
*
* @return string
*/
@ -105,7 +118,7 @@ class User
}
/**
* Sets the user locale.
* Sets the locale.
*
* @param string $locale
*/
@ -113,8 +126,6 @@ class User
{
if ($this->locale != $locale) {
$this->setAttribute('_locale', $locale);
$this->dispatcher->notify(new Event($this, 'user.change_locale', array('locale' => $locale)));
}
}
@ -146,8 +157,10 @@ class User
public function __destruct()
{
$this->attributes['_flash'] = array_diff_key($this->attributes['_flash'], $this->oldFlashes);
if (true === $this->started) {
$this->attributes['_flash'] = array_diff_key($this->attributes['_flash'], $this->oldFlashes);
$this->session->write('_user', $this->attributes);
$this->storage->write('_symfony2', $this->attributes);
}
}
}

View File

@ -1,6 +1,6 @@
<?php
namespace Symfony\Framework\FoundationBundle\Session;
namespace Symfony\Components\HttpFoundation\SessionStorage;
/*
* This file is part of the Symfony framework.
@ -12,13 +12,13 @@ namespace Symfony\Framework\FoundationBundle\Session;
*/
/**
* NativeSession.
* NativeSessionStorage.
*
* @package Symfony
* @subpackage Framework_FoundationBundle
* @subpackage Components_HttpFoundation
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
*/
class NativeSession implements SessionInterface
class NativeSessionStorage implements SessionStorageInterface
{
static protected $sessionIdRegenerated = false;
static protected $sessionStarted = false;
@ -30,7 +30,6 @@ class NativeSession implements SessionInterface
*
* * session_name: The cookie name (symfony by default)
* * session_id: The session id (null by default)
* * auto_start: Whether to start the session (true by default)
* * session_cookie_lifetime: Cookie lifetime
* * session_cookie_path: Cookie path
* * session_cookie_domain: Cookie domain
@ -48,7 +47,6 @@ class NativeSession implements SessionInterface
$this->options = array_merge(array(
'session_name' => 'SYMFONY_SESSION',
'auto_start' => true,
'session_cookie_lifetime' => $cookieDefaults['lifetime'],
'session_cookie_path' => $cookieDefaults['path'],
'session_cookie_domain' => $cookieDefaults['domain'],
@ -56,31 +54,37 @@ class NativeSession implements SessionInterface
'session_cookie_httponly' => isset($cookieDefaults['httponly']) ? $cookieDefaults['httponly'] : false,
'session_cache_limiter' => 'none',
), $options);
}
// set session name
$sessionName = $this->options['session_name'];
session_name($sessionName);
if (!(boolean) ini_get('session.use_cookies') && $sessionId = $this->options['session_id']) {
session_id($sessionId);
/**
* Starts the session.
*/
public function start()
{
if (self::$sessionStarted) {
return;
}
$lifetime = $this->options['session_cookie_lifetime'];
$path = $this->options['session_cookie_path'];
$domain = $this->options['session_cookie_domain'];
$secure = $this->options['session_cookie_secure'];
$httpOnly = $this->options['session_cookie_httponly'];
session_set_cookie_params($lifetime, $path, $domain, $secure, $httpOnly);
session_set_cookie_params(
$this->options['session_cookie_lifetime'],
$this->options['session_cookie_path'],
$this->options['session_cookie_domain'],
$this->options['session_cookie_secure'],
$this->options['session_cookie_httponly']
);
session_name($this->options['session_name']);
if (null !== $this->options['session_cache_limiter']) {
session_cache_limiter($this->options['session_cache_limiter']);
}
if ($this->options['auto_start'] && !self::$sessionStarted) {
session_start();
self::$sessionStarted = true;
if (!ini_get('session.use_cookies') && $this->options['session_id'] && $this->options['session_id'] != session_id()) {
session_id($this->options['session_id']);
}
session_start();
self::$sessionStarted = true;
}
/**

View File

@ -1,6 +1,6 @@
<?php
namespace Symfony\Framework\FoundationBundle\Session;
namespace Symfony\Components\HttpFoundation\SessionStorage;
/*
* This file is part of the Symfony framework.
@ -12,13 +12,13 @@ namespace Symfony\Framework\FoundationBundle\Session;
*/
/**
* PdoSession.
* PdoSessionStorage.
*
* @package Symfony
* @subpackage Framework_FoundationBundle
* @subpackage Components_HttpFoundation
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
*/
class PdoSession extends NativeSession
class PdoSessionStorage extends NativeSessionStorage
{
protected $db;
@ -34,26 +34,33 @@ class PdoSession extends NativeSession
'db_time_col' => 'sess_time',
), $options);
// disable auto_start
$options['auto_start'] = false;
if (!array_key_exists('db_table', $options)) {
throw new \InvalidArgumentException('You must provide the "db_table" option for a PdoSessionStorage.');
}
// initialize the parent
parent::__construct($options);
}
if (!array_key_exists('db_table', $this->options)) {
throw new \InvalidArgumentException('You must provide a "db_table" option to PdoSession.');
/**
* Starts the session.
*/
public function start()
{
if (self::$sessionStarted) {
return;
}
// use this object as the session handler
session_set_save_handler(array($this, 'sessionOpen'),
array($this, 'sessionClose'),
array($this, 'sessionRead'),
array($this, 'sessionWrite'),
array($this, 'sessionDestroy'),
array($this, 'sessionGC'));
session_set_save_handler(
array($this, 'sessionOpen'),
array($this, 'sessionClose'),
array($this, 'sessionRead'),
array($this, 'sessionWrite'),
array($this, 'sessionDestroy'),
array($this, 'sessionGC')
);
// start our session
session_start();
parent::start();
}
/**

View File

@ -1,6 +1,6 @@
<?php
namespace Symfony\Framework\FoundationBundle\Session;
namespace Symfony\Components\HttpFoundation\SessionStorage;
/*
* This file is part of the Symfony framework.
@ -12,14 +12,19 @@ namespace Symfony\Framework\FoundationBundle\Session;
*/
/**
* SessionInterface.
* SessionStorageInterface.
*
* @package Symfony
* @subpackage Framework_FoundationBundle
* @subpackage Components_HttpFoundation
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
*/
interface SessionInterface
interface SessionStorageInterface
{
/**
* Starts the session.
*/
public function start();
/**
* Reads data from this storage.
*

View File

@ -3,8 +3,8 @@
namespace Symfony\Components\HttpKernel\Cache;
use Symfony\Components\HttpKernel\HttpKernelInterface;
use Symfony\Components\HttpKernel\Request;
use Symfony\Components\HttpKernel\Response;
use Symfony\Components\HttpFoundation\Request;
use Symfony\Components\HttpFoundation\Response;
/*
* This file is part of the Symfony framework.
@ -122,7 +122,7 @@ class Cache implements HttpKernelInterface
/**
* Gets the Request instance associated with the master request.
*
* @return Symfony\Components\HttpKernel\Request A Request instance
* @return Symfony\Components\HttpFoundation\Request A Request instance
*/
public function getRequest()
{
@ -132,11 +132,11 @@ class Cache implements HttpKernelInterface
/**
* Handles a Request.
*
* @param Symfony\Components\HttpKernel\Request $request A Request instance
* @param Symfony\Components\HttpFoundation\Request $request A Request instance
* @param integer $type The type of the request (one of HttpKernelInterface::MASTER_REQUEST, HttpKernelInterface::FORWARDED_REQUEST, or HttpKernelInterface::EMBEDDED_REQUEST)
* @param Boolean $raw Whether to catch exceptions or not (this is NOT used in this context)
*
* @return Symfony\Components\HttpKernel\Response A Response instance
* @return Symfony\Components\HttpFoundation\Response A Response instance
*/
public function handle(Request $request = null, $type = HttpKernelInterface::MASTER_REQUEST, $raw = false)
{
@ -178,9 +178,9 @@ class Cache implements HttpKernelInterface
/**
* Forwards the Request to the backend without storing the Response in the cache.
*
* @param Symfony\Components\HttpKernel\Request $request A Request instance
* @param Symfony\Components\HttpFoundation\Request $request A Request instance
*
* @return Symfony\Components\HttpKernel\Response A Response instance
* @return Symfony\Components\HttpFoundation\Response A Response instance
*/
protected function pass(Request $request)
{
@ -192,9 +192,9 @@ class Cache implements HttpKernelInterface
/**
* Invalidates non-safe methods (like POST, PUT, and DELETE).
*
* @param Symfony\Components\HttpKernel\Request $request A Request instance
* @param Symfony\Components\HttpFoundation\Request $request A Request instance
*
* @return Symfony\Components\HttpKernel\Response A Response instance
* @return Symfony\Components\HttpFoundation\Response A Response instance
*
* @see RFC2616 13.10
*/
@ -229,9 +229,9 @@ class Cache implements HttpKernelInterface
* the backend using conditional GET. When no matching cache entry is found,
* it triggers "miss" processing.
*
* @param Symfony\Components\HttpKernel\Request $request A Request instance
* @param Symfony\Components\HttpFoundation\Request $request A Request instance
*
* @return Symfony\Components\HttpKernel\Response A Response instance
* @return Symfony\Components\HttpFoundation\Response A Response instance
*/
protected function lookup(Request $request)
{
@ -278,10 +278,10 @@ class Cache implements HttpKernelInterface
* The original request is used as a template for a conditional
* GET request with the backend.
*
* @param Symfony\Components\HttpKernel\Request $request A Request instance
* @param Symfony\Components\HttpKernel\Response $entry A Response instance to validate
* @param Symfony\Components\HttpFoundation\Request $request A Request instance
* @param Symfony\Components\HttpFoundation\Response $entry A Response instance to validate
*
* @return Symfony\Components\HttpKernel\Response A Response instance
* @return Symfony\Components\HttpFoundation\Response A Response instance
*/
protected function validate(Request $request, $entry)
{
@ -338,9 +338,9 @@ class Cache implements HttpKernelInterface
*
* This methods is trigered when the cache missed or a reload is required.
*
* @param Symfony\Components\HttpKernel\Request $request A Request instance
* @param Symfony\Components\HttpFoundation\Request $request A Request instance
*
* @return Symfony\Components\HttpKernel\Response A Response instance
* @return Symfony\Components\HttpFoundation\Response A Response instance
*/
protected function fetch(Request $request)
{
@ -371,11 +371,11 @@ class Cache implements HttpKernelInterface
/**
* Forwards the Request to the backend and returns the Response.
*
* @param Symfony\Components\HttpKernel\Request $request A Request instance
* @param Symfony\Components\HttpFoundation\Request $request A Request instance
* @param Boolean $raw Whether to catch exceptions or not
* @param Symfony\Components\HttpKernel\Response $response A Response instance (the stale entry if present, null otherwise)
* @param Symfony\Components\HttpFoundation\Response $response A Response instance (the stale entry if present, null otherwise)
*
* @return Symfony\Components\HttpKernel\Response A Response instance
* @return Symfony\Components\HttpFoundation\Response A Response instance
*/
protected function forward(Request $request, $raw = false, Response $entry = null)
{
@ -408,8 +408,8 @@ class Cache implements HttpKernelInterface
/**
* Checks whether the cache entry is "fresh enough" to satisfy the Request.
*
* @param Symfony\Components\HttpKernel\Request $request A Request instance
* @param Symfony\Components\HttpKernel\Response $entry A Response instance
* @param Symfony\Components\HttpFoundation\Request $request A Request instance
* @param Symfony\Components\HttpFoundation\Response $entry A Response instance
*
* @return Boolean true if the cache entry if fresh enough, false otherwise
*/
@ -429,8 +429,8 @@ class Cache implements HttpKernelInterface
/**
* Locks a Request during the call to the backend.
*
* @param Symfony\Components\HttpKernel\Request $request A Request instance
* @param Symfony\Components\HttpKernel\Response $entry A Response instance
* @param Symfony\Components\HttpFoundation\Request $request A Request instance
* @param Symfony\Components\HttpFoundation\Response $entry A Response instance
*
* @return Boolean true if the cache entry can be returned even if it is staled, false otherwise
*/
@ -486,8 +486,8 @@ class Cache implements HttpKernelInterface
/**
* Writes the Response to the cache.
*
* @param Symfony\Components\HttpKernel\Request $request A Request instance
* @param Symfony\Components\HttpKernel\Response $response A Response instance
* @param Symfony\Components\HttpFoundation\Request $request A Request instance
* @param Symfony\Components\HttpFoundation\Response $response A Response instance
*/
protected function store(Request $request, Response $response)
{
@ -512,9 +512,9 @@ class Cache implements HttpKernelInterface
/**
* Restores the Response body.
*
* @param Symfony\Components\HttpKernel\Response $response A Response instance
* @param Symfony\Components\HttpFoundation\Response $response A Response instance
*
* @return Symfony\Components\HttpKernel\Response A Response instance
* @return Symfony\Components\HttpFoundation\Response A Response instance
*/
protected function restoreResponseBody(Response $response)
{
@ -553,7 +553,7 @@ class Cache implements HttpKernelInterface
* Checks if the Request includes authorization or other sensitive information
* that should cause the Response to be considered private by default.
*
* @param Symfony\Components\HttpKernel\Request $request A Request instance
* @param Symfony\Components\HttpFoundation\Request $request A Request instance
*
* @return Boolean true if the Request is private, false otherwise
*/

View File

@ -2,8 +2,8 @@
namespace Symfony\Components\HttpKernel\Cache;
use Symfony\Components\HttpKernel\Request;
use Symfony\Components\HttpKernel\Response;
use Symfony\Components\HttpFoundation\Request;
use Symfony\Components\HttpFoundation\Response;
use Symfony\Components\HttpKernel\HttpKernelInterface;
/*
@ -46,7 +46,7 @@ class Esi
/**
* Checks that at least one surrogate has ESI/1.0 capability.
*
* @param Symfony\Components\HttpKernel\Request $request A Request instance
* @param Symfony\Components\HttpFoundation\Request $request A Request instance
*
* @return Boolean true if one surrogate has ESI/1.0 capability, false otherwise
*/
@ -62,7 +62,7 @@ class Esi
/**
* Adds ESI/1.0 capability to the given Request.
*
* @param Symfony\Components\HttpKernel\Request $request A Request instance
* @param Symfony\Components\HttpFoundation\Request $request A Request instance
*/
public function addSurrogateEsiCapability(Request $request)
{
@ -77,7 +77,7 @@ class Esi
*
* This method only adds an ESI HTTP header if the Response has some ESI tags.
*
* @param Symfony\Components\HttpKernel\Response $response A Response instance
* @param Symfony\Components\HttpFoundation\Response $response A Response instance
*/
public function addSurrogateControl(Response $response)
{
@ -89,7 +89,7 @@ class Esi
/**
* Checks that the Response needs to be parsed for ESI tags.
*
* @param Symfony\Components\HttpKernel\Response $response A Response instance
* @param Symfony\Components\HttpFoundation\Response $response A Response instance
*
* @return Boolean true if the Response needs to be parsed, false otherwise
*/
@ -128,8 +128,8 @@ class Esi
/**
* Replaces a Response ESI tags with the included resource content.
*
* @param Symfony\Components\HttpKernel\Request $request A Request instance
* @param Symfony\Components\HttpKernel\Response $response A Response instance
* @param Symfony\Components\HttpFoundation\Request $request A Request instance
* @param Symfony\Components\HttpFoundation\Response $response A Response instance
*/
public function process(Request $request, Response $response)
{

View File

@ -2,7 +2,7 @@
namespace Symfony\Components\HttpKernel\Cache;
use Symfony\Components\HttpKernel\Response;
use Symfony\Components\HttpFoundation\Response;
use Symfony\Components\HttpKernel\HttpKernelInterface;
use Symfony\Components\EventDispatcher\EventDispatcher;
@ -54,7 +54,7 @@ class EsiListener
* Filters the Response.
*
* @param Symfony\Components\EventDispatcher\Event $event An Event instance
* @param Symfony\Components\HttpKernel\Response $response A Response instance
* @param Symfony\Components\HttpFoundation\Response $response A Response instance
*/
public function filter($event, Response $response)
{

View File

@ -2,9 +2,9 @@
namespace Symfony\Components\HttpKernel\Cache;
use Symfony\Components\HttpKernel\Request;
use Symfony\Components\HttpKernel\Response;
use Symfony\Components\HttpKernel\HeaderBag;
use Symfony\Components\HttpFoundation\Request;
use Symfony\Components\HttpFoundation\Response;
use Symfony\Components\HttpFoundation\HeaderBag;
/*
* This file is part of the Symfony framework.
@ -65,7 +65,7 @@ class Store
/**
* Locks the cache for a given Request.
*
* @param Symfony\Components\HttpKernel\Request $request A Request instance
* @param Symfony\Components\HttpFoundation\Request $request A Request instance
*
* @return Boolean|string true if the lock is acquired, the path to the current lock otherwise
*/
@ -85,7 +85,7 @@ class Store
/**
* Releases the lock for the given Request.
*
* @param Symfony\Components\HttpKernel\Request $request A Request instance
* @param Symfony\Components\HttpFoundation\Request $request A Request instance
*/
public function unlock(Request $request)
{
@ -95,9 +95,9 @@ class Store
/**
* Locates a cached Response for the Request provided.
*
* @param Symfony\Components\HttpKernel\Request $request A Request instance
* @param Symfony\Components\HttpFoundation\Request $request A Request instance
*
* @return Symfony\Components\HttpKernel\Response|null A Response instance, or null if no cache entry was found
* @return Symfony\Components\HttpFoundation\Response|null A Response instance, or null if no cache entry was found
*/
public function lookup(Request $request)
{
@ -139,8 +139,8 @@ class Store
* Existing entries are read and any that match the response are removed. This
* method calls write with the new list of cache entries.
*
* @param Symfony\Components\HttpKernel\Request $request A Request instance
* @param Symfony\Components\HttpKernel\Response $response A Response instance
* @param Symfony\Components\HttpFoundation\Request $request A Request instance
* @param Symfony\Components\HttpFoundation\Response $response A Response instance
*
* @return string The key under which the response is stored
*/
@ -192,7 +192,7 @@ class Store
/**
* Invalidates all cache entries that match the request.
*
* @param Symfony\Components\HttpKernel\Request $request A Request instance
* @param Symfony\Components\HttpFoundation\Request $request A Request instance
*/
public function invalidate(Request $request)
{
@ -342,7 +342,7 @@ class Store
/**
* Returns a cache key for the given Request.
*
* @param Symfony\Components\HttpKernel\Request $request A Request instance
* @param Symfony\Components\HttpFoundation\Request $request A Request instance
*
* @return string A key for the given Request
*/
@ -358,7 +358,7 @@ class Store
/**
* Persists the Request HTTP headers.
*
* @param Symfony\Components\HttpKernel\Request $request A Request instance
* @param Symfony\Components\HttpFoundation\Request $request A Request instance
*
* @return array An array of HTTP headers
*/
@ -370,7 +370,7 @@ class Store
/**
* Persists the Response HTTP headers.
*
* @param Symfony\Components\HttpKernel\Response $response A Response instance
* @param Symfony\Components\HttpFoundation\Response $response A Response instance
*
* @return array An array of HTTP headers
*/

View File

@ -3,7 +3,7 @@
namespace Symfony\Components\HttpKernel;
use Symfony\Components\HttpKernel\HttpKernelInterface;
use Symfony\Components\HttpKernel\Request;
use Symfony\Components\HttpFoundation\Request;
use Symfony\Components\BrowserKit\Client as BaseClient;
use Symfony\Components\BrowserKit\Request as DomRequest;
use Symfony\Components\BrowserKit\Response as DomResponse;
@ -50,9 +50,9 @@ class Client extends BaseClient
/**
* Makes a request.
*
* @param Symfony\Components\HttpKernel\Request $request A Request instance
* @param Symfony\Components\HttpFoundation\Request $request A Request instance
*
* @param Symfony\Components\HttpKernel\Response $response A Response instance
* @param Symfony\Components\HttpFoundation\Response $response A Response instance
*/
protected function doRequest($request)
{
@ -62,7 +62,7 @@ class Client extends BaseClient
/**
* Returns the script to execute when the request must be insulated.
*
* @param Symfony\Components\HttpKernel\Request $request A Request instance
* @param Symfony\Components\HttpFoundation\Request $request A Request instance
*/
protected function getScript($request)
{
@ -93,7 +93,7 @@ EOF;
*
* @param Symfony\Components\BrowserKit\Request $request A Request instance
*
* @return Symfony\Components\HttpKernel\Request A Request instance
* @return Symfony\Components\HttpFoundation\Request A Request instance
*/
protected function filterRequest(DomRequest $request)
{
@ -108,7 +108,7 @@ EOF;
/**
* Converts the HttpKernel response to a BrowserKit response.
*
* @param Symfony\Components\HttpKernel\Response $response A Response instance
* @param Symfony\Components\HttpFoundation\Response $response A Response instance
*
* @return Symfony\Components\BrowserKit\Response A Response instance
*/

View File

@ -5,6 +5,8 @@ namespace Symfony\Components\HttpKernel;
use Symfony\Components\EventDispatcher\Event;
use Symfony\Components\EventDispatcher\EventDispatcher;
use Symfony\Components\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Components\HttpFoundation\Request;
use Symfony\Components\HttpFoundation\Response;
/*
* This file is part of the Symfony package.

View File

@ -2,6 +2,8 @@
namespace Symfony\Components\HttpKernel;
use Symfony\Components\HttpFoundation\Request;
/*
* This file is part of the Symfony package.
*

View File

@ -2,7 +2,7 @@
namespace Symfony\Components\HttpKernel\Profiler;
use Symfony\Components\HttpKernel\Response;
use Symfony\Components\HttpFoundation\Response;
use Symfony\Components\HttpKernel\Profiler\ProfilerStorage;
use Symfony\Components\HttpKernel\Profiler\DataCollector\DataCollectorInterface;
use Symfony\Components\HttpKernel\LoggerInterface;
@ -48,7 +48,7 @@ class Profiler implements \ArrayAccess
/**
* Returns a new Profiler for the given Response.
*
* @param Symfony\Components\HttpKernel\Response $response A Response instance
* @param Symfony\Components\HttpFoundation\Response $response A Response instance
*
* @return Symfony\Components\HttpKernel\Profiler\Profiler A new Profiler instance
*/
@ -80,7 +80,7 @@ class Profiler implements \ArrayAccess
/**
* Collects data for the given Response.
*
* @param Symfony\Components\HttpKernel\Response $response A Response instance
* @param Symfony\Components\HttpFoundation\Response $response A Response instance
*/
public function collect(Response $response)
{
@ -133,7 +133,7 @@ class Profiler implements \ArrayAccess
/**
* Gets the Response.
*
* @return Symfony\Components\HttpKernel\Response A Response instance
* @return Symfony\Components\HttpFoundation\Response A Response instance
*/
public function getResponse()
{

View File

@ -4,7 +4,7 @@ namespace Symfony\Components\HttpKernel\Profiler;
use Symfony\Components\EventDispatcher\EventDispatcher;
use Symfony\Components\EventDispatcher\Event;
use Symfony\Components\HttpKernel\Response;
use Symfony\Components\HttpFoundation\Response;
use Symfony\Components\HttpKernel\HttpKernelInterface;
/*

View File

@ -4,8 +4,8 @@ namespace Symfony\Components\HttpKernel\Profiler;
use Symfony\Components\EventDispatcher\EventDispatcher;
use Symfony\Components\EventDispatcher\Event;
use Symfony\Components\HttpKernel\Request;
use Symfony\Components\HttpKernel\Response;
use Symfony\Components\HttpFoundation\Request;
use Symfony\Components\HttpFoundation\Response;
use Symfony\Components\HttpKernel\HttpKernelInterface;
/*

View File

@ -4,6 +4,7 @@ namespace Symfony\Components\HttpKernel;
use Symfony\Components\EventDispatcher\EventDispatcher;
use Symfony\Components\EventDispatcher\Event;
use Symfony\Components\HttpFoundation\Response;
/*
* This file is part of the Symfony framework.
@ -37,7 +38,7 @@ class ResponseListener
* Filters the Response.
*
* @param Symfony\Components\EventDispatcher\Event $event An Event instance
* @param Symfony\Components\HttpKernel\Response $response A Response instance
* @param Symfony\Components\HttpFoundation\Response $response A Response instance
*/
public function filter(Event $event, Response $response)
{

View File

@ -6,8 +6,8 @@ use Symfony\Components\HttpKernel\HttpKernelInterface;
use Symfony\Components\HttpKernel\Cache\Cache as BaseCache;
use Symfony\Components\HttpKernel\Cache\Esi;
use Symfony\Components\HttpKernel\Cache\Store;
use Symfony\Components\HttpKernel\Request;
use Symfony\Components\HttpKernel\Response;
use Symfony\Components\HttpFoundation\Response;
use Symfony\Components\HttpFoundation\Response;
/*
* This file is part of the Symfony package.
@ -42,11 +42,11 @@ abstract class Cache extends BaseCache
/**
* Forwards the Request to the backend and returns the Response.
*
* @param Symfony\Components\HttpKernel\Request $request A Request instance
* @param Symfony\Components\HttpFoundation\Response $request A Request instance
* @param Boolean $raw Whether to catch exceptions or not
* @param Symfony\Components\HttpKernel\Response $response A Response instance (the stale entry if present, null otherwise)
* @param Symfony\Components\HttpFoundation\Response $response A Response instance (the stale entry if present, null otherwise)
*
* @return Symfony\Components\HttpKernel\Response A Response instance
* @return Symfony\Components\HttpFoundation\Response A Response instance
*/
protected function forward(Request $request, $raw = false, Response $entry = null)
{

View File

@ -79,9 +79,9 @@ class Client extends BaseClient
/**
* Makes a request.
*
* @param Symfony\Components\HttpKernel\Request $request A Request instance
* @param Symfony\Components\HttpFoundation\Response $request A Request instance
*
* @param Symfony\Components\HttpKernel\Response $response A Response instance
* @param Symfony\Components\HttpFoundation\Response $response A Response instance
*/
protected function doRequest($request)
{
@ -93,7 +93,7 @@ class Client extends BaseClient
/**
* Returns the script to execute when the request must be insulated.
*
* @param Symfony\Components\HttpKernel\Request $request A Request instance
* @param Symfony\Components\HttpFoundation\Response $request A Request instance
*/
protected function getScript($request)
{

View File

@ -35,6 +35,47 @@ class KernelExtension extends LoaderExtension
return $configuration;
}
/**
* Loads the session configuration.
*
* @param array $config A configuration array
* @param BuilderConfiguration $configuration A BuilderConfiguration instance
*
* @return BuilderConfiguration A BuilderConfiguration instance
*/
public function sessionLoad($config, BuilderConfiguration $configuration)
{
if (!$configuration->hasDefinition('session')) {
$loader = new XmlFileLoader(array(__DIR__.'/../Resources/config', __DIR__.'/Resources/config'));
$configuration->merge($loader->load('session.xml'));
}
if (isset($config['default_locale'])) {
$configuration->setParameter('session.default_locale', $config['default_locale']);
}
if (isset($config['class'])) {
$configuration->setParameter('session.class', $config['class']);
}
foreach (array('name', 'auto_start', 'lifetime', 'path', 'domain', 'secure', 'httponly', 'cache_limiter', 'pdo.db_table') as $name) {
if (isset($config['session'][$name])) {
$configuration->setParameter('session.options.'.$name, $config['session'][$name]);
}
}
if (isset($config['session']['class'])) {
$class = $config['session']['class'];
if (in_array($class, array('Native', 'Pdo'))) {
$class = 'Symfony\\Framework\\FoundationBundle\\SessionStorage\\'.$class.'SessionStorage';
}
$configuration->setParameter('session.session', 'session.session.'.strtolower($class));
}
return $configuration;
}
public function configLoad($config)
{
$configuration = new BuilderConfiguration();

View File

@ -8,7 +8,7 @@ use Symfony\Components\DependencyInjection\BuilderConfiguration;
use Symfony\Components\DependencyInjection\Dumper\PhpDumper;
use Symfony\Components\DependencyInjection\Resource\FileResource;
use Symfony\Components\DependencyInjection\ParameterBag\ParameterBag;
use Symfony\Components\HttpKernel\Request;
use Symfony\Components\HttpFoundation\Request;
use Symfony\Components\HttpKernel\HttpKernelInterface;
/*

View File

@ -7,8 +7,8 @@
<parameters>
<parameter key="event_dispatcher.class">Symfony\Foundation\EventDispatcher</parameter>
<parameter key="http_kernel.class">Symfony\Components\HttpKernel\HttpKernel</parameter>
<parameter key="request.class">Symfony\Components\HttpKernel\Request</parameter>
<parameter key="response.class">Symfony\Components\HttpKernel\Response</parameter>
<parameter key="request.class">Symfony\Components\HttpFoundation\Request</parameter>
<parameter key="response.class">Symfony\Components\HttpFoundation\Response</parameter>
<parameter key="error_handler.class">Symfony\Foundation\Debug\ErrorHandler</parameter>
<parameter key="error_handler.level">null</parameter>
<parameter key="error_handler.enable">true</parameter>
@ -31,7 +31,11 @@
<argument type="service" id="event_dispatcher" />
</service>
<service id="request" class="%request.class%" />
<service id="request" class="%request.class%">
<call method="setSession">
<argument type="service" id="session" on-invalid="ignore"></argument>
</call>
</service>
<service id="response" class="%response.class%" shared="false" />
</services>

View File

@ -5,10 +5,10 @@
xsi:schemaLocation="http://www.symfony-project.org/schema/dic/services http://www.symfony-project.org/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="user.class">Symfony\Framework\FoundationBundle\User</parameter>
<parameter key="user.default_locale">en</parameter>
<parameter key="user.session.class">Symfony\Framework\FoundationBundle\Session\NativeSession</parameter>
<parameter key="user.session.pdo.class">Symfony\Framework\FoundationBundle\Session\PdoSession</parameter>
<parameter key="session.class">Symfony\Components\HttpFoundation\Session</parameter>
<parameter key="session.default_locale">en</parameter>
<parameter key="session.storage.class">Symfony\Components\HttpFoundation\SessionStorage\NativeSessionStorage</parameter>
<parameter key="session.storage.pdo.class">Symfony\Components\HttpFoundation\SessionStorage\PdoSessionStorage</parameter>
<parameter key="session.options.name">SYMFONY_SESSION</parameter>
<parameter key="session.options.auto_start">true</parameter>
<parameter key="session.options.lifetime">false</parameter>
@ -21,15 +21,14 @@
</parameters>
<services>
<service id="user" class="%user.class%">
<argument type="service" id="event_dispatcher" />
<argument type="service" id="user.session" />
<service id="session" class="%session.class%">
<argument type="service" id="session.storage" />
<argument type="collection">
<argument key="default_locale">%user.default_locale%</argument>
<argument key="default_locale">%session.default_locale%</argument>
</argument>
</service>
<service id="user.session.native" class="%user.session.class%">
<service id="session.storage.native" class="%session.storage.class%">
<argument type="collection">
<argument key="session_name">%session.options.name%</argument>
<argument key="session_cookie_lifetime">%session.options.lifetime%</argument>
@ -41,7 +40,7 @@
</argument>
</service>
<service id="user.session.pdo" class="%user.session.pdo.class%">
<service id="session.storage.pdo" class="%session.storage.pdo.class%">
<argument type="service" id="pdo_connection" />
<argument type="collection">
<argument key="session_name">%session.options.name%</argument>
@ -55,6 +54,6 @@
</argument>
</service>
<service id="user.session" alias="user.session.native" />
<service id="session.storage" alias="session.storage.native" />
</services>
</container>

View File

@ -194,6 +194,40 @@ class KernelExtension extends LoaderExtension
return $configuration;
}
public function sessionLoad($config, BuilderConfiguration $configuration)
{
if (!$configuration->hasDefinition('session')) {
$loader = new XmlFileLoader(array(__DIR__.'/../Resources/config', __DIR__.'/Resources/config'));
$configuration->merge($loader->load('session.xml'));
}
if (isset($config['default_locale'])) {
$configuration->setParameter('session.default_locale', $config['default_locale']);
}
if (isset($config['class'])) {
$configuration->setParameter('session.class', $config['class']);
}
foreach (array('name', 'auto_start', 'lifetime', 'path', 'domain', 'secure', 'httponly', 'cache_limiter', 'pdo.db_table') as $name) {
if (isset($config['session'][$name])) {
$configuration->setParameter('session.options.'.$name, $config['session'][$name]);
}
}
if (isset($config['session']['class'])) {
$class = $config['session']['class'];
if (in_array($class, array('Native', 'Pdo'))) {
$class = 'Symfony\\Framework\\FoundationBundle\\SessionStorage\\'.$class.'SessionStorage';
}
$configuration->setParameter('session.session', 'session.session.'.strtolower($class));
}
return $configuration;
}
public function configLoad($config)
{
$configuration = new BuilderConfiguration();

View File

@ -3,8 +3,8 @@
namespace Symfony\Framework\FoundationBundle;
use Symfony\Components\DependencyInjection\ContainerInterface;
use Symfony\Components\HttpKernel\Request;
use Symfony\Components\HttpKernel\Response;
use Symfony\Components\HttpFoundation\Request;
use Symfony\Components\HttpFoundation\Response;
use Symfony\Components\HttpKernel\HttpKernelInterface;
/*

View File

@ -5,7 +5,7 @@ namespace Symfony\Framework\FoundationBundle\Controller;
use Symfony\Components\HttpKernel\LoggerInterface;
use Symfony\Components\DependencyInjection\ContainerInterface;
use Symfony\Components\HttpKernel\HttpKernelInterface;
use Symfony\Components\HttpKernel\Request;
use Symfony\Components\HttpFoundation\Request;
/*
* This file is part of the Symfony framework.

View File

@ -4,8 +4,8 @@ namespace Symfony\Framework\FoundationBundle\Controller;
use Symfony\Framework\FoundationBundle\Controller;
use Symfony\Framework\FoundationBundle\Debug\ExceptionFormatter;
use Symfony\Components\HttpKernel\Request;
use Symfony\Components\HttpKernel\Response;
use Symfony\Components\HttpFoundation\Request;
use Symfony\Components\HttpFoundation\Response;
use Symfony\Components\HttpKernel\Exception\HttpException;
/*

View File

@ -30,7 +30,6 @@ class WebExtension extends LoaderExtension
protected $resources = array(
'templating' => 'templating.xml',
'web' => 'web.xml',
'user' => 'user.xml',
// validation.xml conflicts with the naming convention for XML
// validation mapping files, so call it validator.xml
'validation' => 'validator.xml',
@ -171,47 +170,6 @@ class WebExtension extends LoaderExtension
return $configuration;
}
/**
* Loads the user configuration.
*
* @param array $config A configuration array
* @param BuilderConfiguration $configuration A BuilderConfiguration instance
*
* @return BuilderConfiguration A BuilderConfiguration instance
*/
public function userLoad($config, BuilderConfiguration $configuration)
{
if (!$configuration->hasDefinition('user')) {
$loader = new XmlFileLoader(__DIR__.'/../Resources/config');
$configuration->merge($loader->load($this->resources['user']));
}
if (isset($config['default_locale'])) {
$configuration->setParameter('user.default_locale', $config['default_locale']);
}
if (isset($config['class'])) {
$configuration->setParameter('user.class', $config['class']);
}
foreach (array('name', 'auto_start', 'lifetime', 'path', 'domain', 'secure', 'httponly', 'cache_limiter', 'pdo.db_table') as $name) {
if (isset($config['session'][$name])) {
$configuration->setParameter('session.options.'.$name, $config['session'][$name]);
}
}
if (isset($config['session']['class'])) {
$class = $config['session']['class'];
if (in_array($class, array('Native', 'Pdo'))) {
$class = 'Symfony\\Framework\\FoundationBundle\\Session\\'.$class.'Session';
}
$configuration->setParameter('user.session', 'user.session.'.strtolower($class));
}
return $configuration;
}
/**
* Loads the templating configuration.
*

View File

@ -16,7 +16,7 @@
<parameter key="templating.helper.actions.class">Symfony\Framework\FoundationBundle\Templating\Helper\ActionsHelper</parameter>
<parameter key="templating.helper.router.class">Symfony\Framework\FoundationBundle\Templating\Helper\RouterHelper</parameter>
<parameter key="templating.helper.request.class">Symfony\Framework\FoundationBundle\Templating\Helper\RequestHelper</parameter>
<parameter key="templating.helper.user.class">Symfony\Framework\FoundationBundle\Templating\Helper\UserHelper</parameter>
<parameter key="templating.helper.session.class">Symfony\Framework\FoundationBundle\Templating\Helper\SessionHelper</parameter>
<parameter key="templating.output_escaper">false</parameter>
<parameter key="templating.assets.version">null</parameter>
</parameters>
@ -71,9 +71,9 @@
<argument type="service" id="request" />
</service>
<service id="templating.helper.user" class="%templating.helper.user.class%">
<annotation name="templating.helper" alias="user" />
<argument type="service" id="user" />
<service id="templating.helper.session" class="%templating.helper.session.class%">
<annotation name="templating.helper" alias="session" />
<argument type="service" id="request" />
</service>
<service id="templating.helper.router" class="%templating.helper.router.class%">

View File

@ -2,7 +2,7 @@
namespace Symfony\Framework\FoundationBundle\Templating\Helper;
use Symfony\Components\HttpKernel\Request;
use Symfony\Components\HttpFoundation\Request;
use Symfony\Components\Templating\Helper\AssetsHelper as BaseAssetsHelper;
/*
@ -26,9 +26,9 @@ class AssetsHelper extends BaseAssetsHelper
/**
* Constructor.
*
* @param Symfony\Components\HttpKernel\Request $request A Request instance
* @param string|array $baseURLs The domain URL or an array of domain URLs
* @param string $version The version
* @param Symfony\Components\HttpFoundation\Request $request A Request instance
* @param string|array $baseURLs The domain URL or an array of domain URLs
* @param string $version The version
*/
public function __construct(Request $request, $baseURLs = array(), $version = null)
{

View File

@ -3,7 +3,7 @@
namespace Symfony\Framework\FoundationBundle\Templating\Helper;
use Symfony\Components\Templating\Helper\Helper;
use Symfony\Components\HttpKernel\Request;
use Symfony\Components\HttpFoundation\Request;
/*
* This file is part of the Symfony framework.

View File

@ -3,7 +3,7 @@
namespace Symfony\Framework\FoundationBundle\Templating\Helper;
use Symfony\Components\Templating\Helper\Helper;
use Symfony\Framework\FoundationBundle\User;
use Symfony\Components\HttpFoundation\Request;
/*
* This file is part of the Symfony framework.
@ -15,28 +15,28 @@ use Symfony\Framework\FoundationBundle\User;
*/
/**
* UserHelper.
* SessionHelper.
*
* @package Symfony
* @subpackage Framework_FoundationBundle
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
*/
class UserHelper extends Helper
class SessionHelper extends Helper
{
protected $user;
protected $session;
/**
* Constructor.
*
* @param Request $request A Request instance
*/
public function __construct(User $user)
public function __construct(Request $request)
{
$this->user = $user;
$this->session = $request->getSession();
}
/**
* Returns a user attribute
* Returns an attribute
*
* @param string $name The attribute name
* @param mixed $default The default value
@ -45,27 +45,27 @@ class UserHelper extends Helper
*/
public function getAttribute($name, $default = null)
{
return $this->user->getAttribute($name, $default);
return $this->session->getAttribute($name, $default);
}
/**
* Returns the user locale
* Returns the locale
*
* @return string
*/
public function getLocale()
{
return $this->user->getLocale();
return $this->session->getLocale();
}
public function getFlash($name, $default = null)
{
return $this->user->getFlash($name, $default);
return $this->session->getFlash($name, $default);
}
public function hasFlash($name)
{
return $this->user->hasFlash($name);
return $this->session->hasFlash($name);
}
/**
@ -75,6 +75,6 @@ class UserHelper extends Helper
*/
public function getName()
{
return 'user';
return 'session';
}
}

View File

@ -4,7 +4,7 @@ namespace Symfony\Framework\FoundationBundle\Test;
use Symfony\Foundation\Test\WebTestCase as BaseWebTestCase;
use Symfony\Components\Finder\Finder;
use Symfony\Components\HttpKernel\Response;
use Symfony\Components\HttpFoundation\Response;
/*
* This file is part of the Symfony package.

View File

@ -36,15 +36,6 @@ class WebExtensionTest extends TestCase
$this->assertEquals('Symfony\\Components\\HttpKernel\\Profiler\\WebDebugToolbarListener', $configuration->getParameter('debug.toolbar.class'), '->configLoad() loads the collectors.xml file if the toolbar option is given');
}
public function testUserLoad()
{
$configuration = new BuilderConfiguration();
$loader = $this->getWebExtension();
$configuration = $loader->userLoad(array(), $configuration);
$this->assertEquals('Symfony\\Framework\\FoundationBundle\\User', $configuration->getParameter('user.class'), '->userLoad() loads the user.xml file if not already loaded');
}
public function testTemplatingLoad()
{
$configuration = new BuilderConfiguration();

View File

@ -9,14 +9,14 @@
* file that was distributed with this source code.
*/
namespace Symfony\Tests\Components\HttpKernel;
namespace Symfony\Tests\Components\HttpFoundation;
use Symfony\Components\HttpKernel\ParameterBag;
use Symfony\Components\HttpFoundation\ParameterBag;
class ParameterBagTest extends \PHPUnit_Framework_TestCase
{
/**
* @covers Symfony\Components\HttpKernel\ParameterBag::__construct
* @covers Symfony\Components\HttpFoundation\ParameterBag::__construct
*/
public function testConstructor()
{
@ -24,7 +24,7 @@ class ParameterBagTest extends \PHPUnit_Framework_TestCase
}
/**
* @covers Symfony\Components\HttpKernel\ParameterBag::all
* @covers Symfony\Components\HttpFoundation\ParameterBag::all
*/
public function testAll()
{
@ -33,7 +33,7 @@ class ParameterBagTest extends \PHPUnit_Framework_TestCase
}
/**
* @covers Symfony\Components\HttpKernel\ParameterBag::replace
* @covers Symfony\Components\HttpFoundation\ParameterBag::replace
*/
public function testReplace()
{
@ -45,7 +45,7 @@ class ParameterBagTest extends \PHPUnit_Framework_TestCase
}
/**
* @covers Symfony\Components\HttpKernel\ParameterBag::get
* @covers Symfony\Components\HttpFoundation\ParameterBag::get
*/
public function testGet()
{
@ -57,7 +57,7 @@ class ParameterBagTest extends \PHPUnit_Framework_TestCase
}
/**
* @covers Symfony\Components\HttpKernel\ParameterBag::set
* @covers Symfony\Components\HttpFoundation\ParameterBag::set
*/
public function testSet()
{
@ -71,7 +71,7 @@ class ParameterBagTest extends \PHPUnit_Framework_TestCase
}
/**
* @covers Symfony\Components\HttpKernel\ParameterBag::has
* @covers Symfony\Components\HttpFoundation\ParameterBag::has
*/
public function testHas()
{
@ -82,7 +82,7 @@ class ParameterBagTest extends \PHPUnit_Framework_TestCase
}
/**
* @covers Symfony\Components\HttpKernel\ParameterBag::getAlpha
* @covers Symfony\Components\HttpFoundation\ParameterBag::getAlpha
*/
public function testGetAlpha()
{
@ -93,7 +93,7 @@ class ParameterBagTest extends \PHPUnit_Framework_TestCase
}
/**
* @covers Symfony\Components\HttpKernel\ParameterBag::getAlnum
* @covers Symfony\Components\HttpFoundation\ParameterBag::getAlnum
*/
public function testGetAlnum()
{
@ -104,7 +104,7 @@ class ParameterBagTest extends \PHPUnit_Framework_TestCase
}
/**
* @covers Symfony\Components\HttpKernel\ParameterBag::getDigits
* @covers Symfony\Components\HttpFoundation\ParameterBag::getDigits
*/
public function testGetDigits()
{
@ -115,7 +115,7 @@ class ParameterBagTest extends \PHPUnit_Framework_TestCase
}
/**
* @covers Symfony\Components\HttpKernel\ParameterBag::getInt
* @covers Symfony\Components\HttpFoundation\ParameterBag::getInt
*/
public function testGetInt()
{

View File

@ -9,14 +9,14 @@
* file that was distributed with this source code.
*/
namespace Symfony\Tests\Components\HttpKernel;
namespace Symfony\Tests\Components\HttpFoundation;
use Symfony\Components\HttpKernel\Request;
use Symfony\Components\HttpFoundation\Request;
class RequestTest extends \PHPUnit_Framework_TestCase
{
/**
* @covers Symfony\Components\HttpKernel\Request::__construct
* @covers Symfony\Components\HttpFoundation\Request::__construct
*/
public function testConstructor()
{
@ -24,7 +24,7 @@ class RequestTest extends \PHPUnit_Framework_TestCase
}
/**
* @covers Symfony\Components\HttpKernel\Request::initialize
* @covers Symfony\Components\HttpFoundation\Request::initialize
*/
public function testInitialize()
{
@ -44,7 +44,7 @@ class RequestTest extends \PHPUnit_Framework_TestCase
}
/**
* @covers Symfony\Components\HttpKernel\Request::duplicate
* @covers Symfony\Components\HttpFoundation\Request::duplicate
*/
public function testDuplicate()
{
@ -65,7 +65,7 @@ class RequestTest extends \PHPUnit_Framework_TestCase
}
/**
* @covers Symfony\Components\HttpKernel\Request::getFormat
* @covers Symfony\Components\HttpFoundation\Request::getFormat
*/
public function testGetFormat()
{

View File

@ -9,9 +9,9 @@
* file that was distributed with this source code.
*/
namespace Symfony\Tests\Components\HttpKernel;
namespace Symfony\Tests\Components\HttpFoundation;
use Symfony\Components\HttpKernel\Response;
use Symfony\Components\HttpFoundation\Response;
class ResponseTest extends \PHPUnit_Framework_TestCase
{

View File

@ -13,7 +13,7 @@ namespace Symfony\Tests\Components\HttpKernel\Cache;
require_once __DIR__.'/TestHttpKernel.php';
use Symfony\Components\HttpKernel\Request;
use Symfony\Components\HttpFoundation\Request;
use Symfony\Components\HttpKernel\Cache\Cache;
use Symfony\Components\HttpKernel\Cache\Store;

View File

@ -13,8 +13,8 @@ namespace Symfony\Tests\Components\HttpKernel\Cache;
require_once __DIR__.'/CacheTestCase.php';
use Symfony\Components\HttpKernel\Request;
use Symfony\Components\HttpKernel\Response;
use Symfony\Components\HttpFoundation\Request;
use Symfony\Components\HttpFoundation\Response;
use Symfony\Components\HttpKernel\Cache\Store;
use Symfony\Tests\Components\HttpKernel\Cache\CacheTestCase;
@ -78,7 +78,7 @@ class CacheStoreTest extends \PHPUnit_Framework_TestCase
$response = $this->store->lookup($this->request);
$this->assertNotNull($response);
$this->assertInstanceOf('Symfony\Components\HttpKernel\Response', $response);
$this->assertInstanceOf('Symfony\Components\HttpFoundation\Response', $response);
}
public function testDoesNotFindAnEntryWithLookupWhenNoneExists()
@ -127,7 +127,7 @@ class CacheStoreTest extends \PHPUnit_Framework_TestCase
$this->storeSimpleEntry();
$this->store->invalidate($this->request);
$response = $this->store->lookup($this->request);
$this->assertInstanceOf('Symfony\Components\HttpKernel\Response', $response);
$this->assertInstanceOf('Symfony\Components\HttpFoundation\Response', $response);
$this->assertFalse($response->isFresh());
}

View File

@ -12,8 +12,8 @@
namespace Symfony\Tests\Components\HttpKernel\Cache;
use Symfony\Components\HttpKernel\HttpKernel;
use Symfony\Components\HttpKernel\Request;
use Symfony\Components\HttpKernel\Response;
use Symfony\Components\HttpFoundation\Request;
use Symfony\Components\HttpFoundation\Response;
use Symfony\Components\EventDispatcher\EventDispatcher;
use Symfony\Components\EventDispatcher\Event;

View File

@ -13,8 +13,8 @@ namespace Symfony\Tests\Components\HttpKernel;
use Symfony\Components\HttpKernel\Client;
use Symfony\Components\HttpKernel\HttpKernel;
use Symfony\Components\HttpKernel\Request;
use Symfony\Components\HttpKernel\Response;
use Symfony\Components\HttpFoundation\Request;
use Symfony\Components\HttpFoundation\Response;
use Symfony\Components\EventDispatcher\EventDispatcher;
use Symfony\Components\EventDispatcher\Event;

View File

@ -12,8 +12,8 @@
namespace Symfony\Tests\Components\HttpKernel;
use Symfony\Components\HttpKernel\HttpKernel;
use Symfony\Components\HttpKernel\Request;
use Symfony\Components\HttpKernel\Response;
use Symfony\Components\HttpFoundation\Request;
use Symfony\Components\HttpFoundation\Response;
use Symfony\Components\EventDispatcher\EventDispatcher;
use Symfony\Components\EventDispatcher\Event;