Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[DoctrineBridge][HttpFoundation] Refactored tests.
  • Loading branch information
Drak committed Mar 14, 2012
1 parent 39526df commit 7b36d0c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Expand Up @@ -11,19 +11,19 @@

namespace Symfony\Bridge\Doctrine\HttpFoundation;

use Symfony\Bridge\Doctrine\HttpFoundation\DbalSessionStorage;
use Symfony\Bridge\Doctrine\HttpFoundation\DbalSessionHandler;

/**
* Test class for DbalSessionStorage.
*
* @author Drak <drak@zikula.org>
*/
class DbalSessionStorageTest extends \PHPUnit_Framework_TestCase
class DbalSessionHandlerTest extends \PHPUnit_Framework_TestCase
{
public function test__Construct()
{
$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));
$this->driver = $mock->getMock();
}
Expand Down
Expand Up @@ -9,11 +9,11 @@
* 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;

Expand All @@ -26,16 +26,16 @@ protected function setUp()

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');

$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');
}

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');
$this->assertEquals(1, count($this->pdo->query('SELECT * FROM sessions')->fetchAll()));

Expand All @@ -46,7 +46,7 @@ public function testSessionDestroy()

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('baz', 'bar');
Expand Down

0 comments on commit 7b36d0c

Please sign in to comment.