[HttpFoundation] added unit test
This commit is contained in:
parent
362b7264d1
commit
4d5db59e1e
@ -11,6 +11,12 @@
|
||||
|
||||
namespace Symfony\Tests\Component\HttpFoundation;
|
||||
|
||||
use Symfony\Component\HttpFoundation\HeaderBag;
|
||||
|
||||
use Symfony\Component\HttpFoundation\SessionStorage\ArraySessionStorage;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Session;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
class RequestTest extends \PHPUnit_Framework_TestCase
|
||||
@ -721,4 +727,24 @@ class RequestTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertTrue($request->isSecure());
|
||||
$this->assertEquals(443, $request->getPort());
|
||||
}
|
||||
|
||||
public function testHasSession()
|
||||
{
|
||||
$request = new Request;
|
||||
|
||||
$this->assertFalse($request->hasSession());
|
||||
$request->setSession(new Session(new ArraySessionStorage()));
|
||||
$this->assertTrue($request->hasSession());
|
||||
}
|
||||
|
||||
public function testHasPreviousSession()
|
||||
{
|
||||
$request = new Request;
|
||||
|
||||
$this->assertFalse($request->hasPreviousSession());
|
||||
$request->cookies->set(session_name(), 'foo');
|
||||
$this->assertFalse($request->hasPreviousSession());
|
||||
$request->setSession(new Session(new ArraySessionStorage()));
|
||||
$this->assertTrue($request->hasPreviousSession());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user