[HttpFoundation] Increase test coverage.

This commit is contained in:
Drak 2012-02-14 21:10:15 +05:45
parent b80951c21c
commit cbb3e69b36
2 changed files with 27 additions and 0 deletions

View File

@ -64,6 +64,13 @@ class AttributeBagTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('test', $attributeBag->getStorageKey());
}
public function testGetSetName()
{
$this->assertEquals('attributes', $this->bag->getName());
$this->bag->setName('foo');
$this->assertEquals('foo', $this->bag->getName());
}
/**
* @dataProvider attributesProvider
*/

View File

@ -70,6 +70,16 @@ class SessionTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($value, $this->session->get($key));
}
/**
* @dataProvider setProvider
*/
public function testHas($key, $value)
{
$this->session->set($key, $value);
$this->assertTrue($this->session->has($key));
$this->assertFalse($this->session->has($key.'non_value'));
}
public function testReplace()
{
$this->session->replace(array('happiness' => 'be good', 'symfony' => 'awesome'));
@ -139,6 +149,11 @@ class SessionTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(333, $this->session->get('migrate'));
}
public function testSave()
{
$this->session->save();
}
public function testGetId()
{
$this->assertEquals('', $this->session->getId());
@ -146,6 +161,11 @@ class SessionTest extends \PHPUnit_Framework_TestCase
$this->assertNotEquals('', $this->session->getId());
}
public function testGetFlashBag()
{
$this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\Session\\Flash\\FlashBagInterface', $this->session->getFlashBag());
}
// deprecated since 2.1, will be removed from 2.3
public function testGetSetFlashes()