[DoctrineBridge][HttpFoundation] Refactored tests.

This commit is contained in:
Drak 2012-03-09 13:31:44 +05:45
parent 39526df67c
commit 7b36d0cc2b
2 changed files with 10 additions and 10 deletions

View File

@ -11,19 +11,19 @@
namespace Symfony\Bridge\Doctrine\HttpFoundation; namespace Symfony\Bridge\Doctrine\HttpFoundation;
use Symfony\Bridge\Doctrine\HttpFoundation\DbalSessionStorage; use Symfony\Bridge\Doctrine\HttpFoundation\DbalSessionHandler;
/** /**
* Test class for DbalSessionStorage. * Test class for DbalSessionStorage.
* *
* @author Drak <drak@zikula.org> * @author Drak <drak@zikula.org>
*/ */
class DbalSessionStorageTest extends \PHPUnit_Framework_TestCase class DbalSessionHandlerTest extends \PHPUnit_Framework_TestCase
{ {
public function test__Construct() public function test__Construct()
{ {
$this->connection = $this->getMock('Doctrine\DBAL\Driver\Connection'); $this->connection = $this->getMock('Doctrine\DBAL\Driver\Connection');
$mock = $this->getMockBuilder('Symfony\Bridge\Doctrine\HttpFoundation\DbalSessionStorage'); $mock = $this->getMockBuilder('Symfony\Bridge\Doctrine\HttpFoundation\DbalSessionHandler');
$mock->setConstructorArgs(array($this->connection)); $mock->setConstructorArgs(array($this->connection));
$this->driver = $mock->getMock(); $this->driver = $mock->getMock();
} }

View File

@ -9,11 +9,11 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
namespace Symfony\Tests\Component\HttpFoundation\Session\Storage; namespace Symfony\Tests\Component\HttpFoundation\Session\Storage\Handler;
use Symfony\Component\HttpFoundation\Session\Storage\PdoSessionStorage; use Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler;
class PdoSessionStorageTest extends \PHPUnit_Framework_TestCase class PdoSessionHandlerTest extends \PHPUnit_Framework_TestCase
{ {
private $pdo; private $pdo;
@ -26,16 +26,16 @@ class PdoSessionStorageTest extends \PHPUnit_Framework_TestCase
public function testMultipleInstances() public function testMultipleInstances()
{ {
$storage1 = new PdoSessionStorage($this->pdo, array('db_table' => 'sessions'), array()); $storage1 = new PdoSessionHandler($this->pdo, array('db_table' => 'sessions'), array());
$storage1->write('foo', 'bar'); $storage1->write('foo', 'bar');
$storage2 = new PdoSessionStorage($this->pdo, array('db_table' => 'sessions'), array()); $storage2 = new PdoSessionHandler($this->pdo, array('db_table' => 'sessions'), array());
$this->assertEquals('bar', $storage2->read('foo'), 'values persist between instances'); $this->assertEquals('bar', $storage2->read('foo'), 'values persist between instances');
} }
public function testSessionDestroy() public function testSessionDestroy()
{ {
$storage = new PdoSessionStorage($this->pdo, array('db_table' => 'sessions'), array()); $storage = new PdoSessionHandler($this->pdo, array('db_table' => 'sessions'), array());
$storage->write('foo', 'bar'); $storage->write('foo', 'bar');
$this->assertEquals(1, count($this->pdo->query('SELECT * FROM sessions')->fetchAll())); $this->assertEquals(1, count($this->pdo->query('SELECT * FROM sessions')->fetchAll()));
@ -46,7 +46,7 @@ class PdoSessionStorageTest extends \PHPUnit_Framework_TestCase
public function testSessionGC() public function testSessionGC()
{ {
$storage = new PdoSessionStorage($this->pdo, array('db_table' => 'sessions'), array()); $storage = new PdoSessionHandler($this->pdo, array('db_table' => 'sessions'), array());
$storage->write('foo', 'bar'); $storage->write('foo', 'bar');
$storage->write('baz', 'bar'); $storage->write('baz', 'bar');