diff --git a/src/Lunr/Core/SessionDAO.php b/src/Lunr/Core/SessionDAO.php
new file mode 100644
index 0000000000000000000000000000000000000000..e7005b85d0fb7e59773eecf8371eba56e4b5e477
--- /dev/null
+++ b/src/Lunr/Core/SessionDAO.php
@@ -0,0 +1,174 @@
+<?php
+
+/**
+ * This file contains the DAO for storing php session information
+ * in the database
+ *
+ * PHP Version 5.3
+ *
+ * @category   DAO
+ * @package    Core
+ * @subpackage DAO
+ * @author     Heinz Wiesinger <heinz@m2mobi.com>
+ * @copyright  2010-2012, M2Mobi BV, Amsterdam, The Netherlands
+ * @license    http://lunr.nl/LICENSE MIT License
+ */
+
+namespace Lunr\Core;
+
+use Lunr\DataAccess\DatabaseAccessObject;
+
+/**
+ * Core Session DAO
+ *
+ * @category   DAO
+ * @package    Core
+ * @subpackage DAO
+ * @author     Heinz Wiesinger <heinz@m2mobi.com>
+ */
+class SessionDAO extends DatabaseAccessObject
+{
+
+    /**
+     * Constructor.
+     *
+     * @param DatabaseConnection     $connection Shared instance of a database connection class
+     * @param DatabaseConnectionPool $pool       Shared instance of a database connection pool, NULL by default
+     */
+    public function __construct($connection, $pool = NULL)
+    {
+        parent::__construct($connection, $pool);
+    }
+
+    /**
+     * Destructor.
+     */
+    public function __destruct()
+    {
+        parent::__destruct();
+    }
+
+    /**
+     * Read session data from the database.
+     *
+     * @param String $id Session ID
+     *
+     * @return mixed The Session Data on success, False on failure
+     */
+    public function read_session_data($id)
+    {
+        $builder = $this->db->get_new_dml_query_builder_object();
+        $builder->select($builder->result_column('sessionData'));
+        $builder->from($builder->table('user_sessions'));
+        $builder->where($builder->column('sessionID'), $builder->value($id));
+        $builder->where($builder->column('expires'), $builder->intvalue(time()), '>');
+
+        $query  = $this->db->query($builder->get_select_query());
+        $result = $this->result_cell($query, 'sessionData');
+        if($result != FALSE)
+        {
+            return base64_decode($result);
+        }
+        else
+        {
+            return FALSE;
+        }
+    }
+
+    /**
+     * Save session data into the database.
+     *
+     * @param String  $id           Session ID
+     * @param String  $session_data Session data
+     * @param Integer $time         expiration timestamp
+     *
+     * @return void
+     */
+    public function write_session_data($id, $session_data, $time)
+    {
+        $builder = $this->db->get_new_dml_query_builder_object();
+        $this->db->begin_transaction();
+        $builder->from($builder->table('user_sessions'));
+        $builder->where($builder->column('sessionID'), $builder->value($id));
+        $builder->lock_mode('FOR UPDATE');
+
+        $query = $this->db->query($builder->get_select_query());
+        if ($query->has_failed())
+        {
+            $this->db->rollback();
+        }
+        else
+        {
+            $builder = $this->db->get_new_dml_query_builder_object();
+            $builder->into('user_sessions');
+            $data = array(
+                $builder->column('sessionID')   => $builder->value($id),
+                $builder->column('sessionData') => $builder->value(base64_encode($session_data)),
+                $builder->column('expires')     => $builder->value($time)
+            );
+            $builder->set($data);
+
+            $query = $this->db->query($builder->get_replace_query());
+            $this->db->commit();
+        }
+
+        $this->db->end_transaction();
+    }
+
+    /**
+     * Remove a no-longer active session.
+     *
+     * @param String $id Session ID
+     *
+     * @return void
+     */
+    public function delete_session($id)
+    {
+        $builder = $this->db->get_new_dml_query_builder_object();
+        $this->db->begin_transaction();
+        $builder->from($builder->table('user_sessions'));
+        $builder->where($builder->column('sessionID'), $builder->value($id));
+        $builder->lock_mode('FOR UPDATE');
+
+        $query = $this->db->query($builder->get_select_query());
+        if ($query->has_failed())
+        {
+            $this->db->rollback();
+        }
+        else
+        {
+            if ($query->number_of_rows() > 0)
+            {
+                $builder = $this->db->get_new_dml_query_builder_object();
+                $builder->from($builder->table('user_sessions'));
+                $builder->where($builder->column('sessionID'), $builder->value($id));
+
+                $query = $this->db->query($builder->get_delete_query());
+                $this->db->commit();
+            }
+            else
+            {
+                $this->db->rollback();
+            }
+        }
+
+        $this->db->end_transaction();
+    }
+
+    /**
+     * Remove expired sessions.
+     *
+     * @return void
+     */
+    public function session_gc()
+    {
+        $builder = $this->db->get_new_dml_query_builder_object();
+        $builder->from($builder->table('user_sessions'));
+        $builder->where($builder->column('expires'), $builder->intvalue(time()), '<');
+
+        $this->db->query($builder->get_delete_query());
+    }
+
+}
+
+?>
diff --git a/src/Lunr/Core/SessionModel.php b/src/Lunr/Core/SessionModel.php
deleted file mode 100644
index 0e2f35d20c597c642e20da841eb6d31dc708dbfa..0000000000000000000000000000000000000000
--- a/src/Lunr/Core/SessionModel.php
+++ /dev/null
@@ -1,161 +0,0 @@
-<?php
-
-/**
- * This file contains the model for storing php session information
- * in the database
- *
- * PHP Version 5.3
- *
- * @category   Models
- * @package    Core
- * @subpackage Models
- * @author     Heinz Wiesinger <heinz@m2mobi.com>
- * @copyright  2010-2012, M2Mobi BV, Amsterdam, The Netherlands
- * @license    http://lunr.nl/LICENSE MIT License
- */
-
-namespace Lunr\Core;
-
-use Lunr\Core\Model;
-
-/**
- * Core Session Model
- *
- * @category   Models
- * @package    Core
- * @subpackage Models
- * @author     Heinz Wiesinger <heinz@m2mobi.com>
- */
-class SessionModel extends Model
-{
-
-    /**
-     * Constructor.
-     */
-    public function __construct()
-    {
-        global $db;
-        parent::__construct($db);
-        $this->get_write_access();
-    }
-
-    /**
-     * Destructor.
-     */
-    public function __destruct()
-    {
-        parent::__destruct();
-    }
-
-    /**
-     * Read session data from the database.
-     *
-     * @param String $id Session ID
-     *
-     * @return mixed The Session Data on success, False on failure
-     */
-    public function read_session_data($id)
-    {
-        $this->db->select('sessionData');
-        $this->db->where('sessionID', $id);
-        $this->db->where('expires', time(), '>');
-        $query = $this->db->get('user_sessions');
-        if ($query)
-        {
-            if ($query->num_rows() > 0)
-            {
-                return base64_decode($query->field('sessionData'));
-            }
-            else
-            {
-                return '';
-            }
-        }
-        else
-        {
-            return FALSE;
-        }
-    }
-
-    /**
-     * Save session data into the database.
-     *
-     * @param String  $id           Session ID
-     * @param String  $session_data Session data
-     * @param Integer $time         expiration timestamp
-     *
-     * @return void
-     */
-    public function write_session_data($id, $session_data, $time)
-    {
-        $this->db->begin_transaction();
-        $this->db->select_for_update('*', FALSE);
-        $this->db->where('sessionID', $id);
-        $query = $this->db->get('user_sessions');
-        if ($query)
-        {
-            $data = array(
-                'sessionID'   => $id,
-                'sessionData' => base64_encode($session_data),
-                'expires'     => $time
-            );
-
-            $this->db->replace('user_sessions', $data);
-            $this->db->commit();
-        }
-        else
-        {
-            $this->db->rollback();
-        }
-
-        $this->db->end_transaction();
-    }
-
-    /**
-     * Remove a no-longer active session.
-     *
-     * @param String $id Session ID
-     *
-     * @return void
-     */
-    public function delete_session($id)
-    {
-        $this->db->begin_transaction();
-        $this->db->select_for_update('*', FALSE);
-        $this->db->where('sessionID', $id);
-        $query = $this->db->get('user_sessions');
-        if ($query)
-        {
-            if ($query->num_rows() > 0)
-            {
-                $this->db->where('sessionID', $id);
-                $this->db->delete('user_sessions');
-                $this->db->commit();
-            }
-            else
-            {
-                $this->db->rollback();
-            }
-        }
-        else
-        {
-            $this->db->rollback();
-        }
-
-        $this->db->end_transaction();
-    }
-
-    /**
-     * Remove expired sessions.
-     *
-     * @return void
-     */
-    public function session_gc()
-    {
-        $this->db->where('expires', time(), '<');
-        $this->db->delete('user_sessions');
-    }
-
-}
-
-?>
diff --git a/src/Lunr/Core/Tests/DatabaseSessionHandlerTest.php b/src/Lunr/Core/Tests/DatabaseSessionHandlerTest.php
index 975bc3b0b32f102d49ae996f386a48f968372fcf..64b9aea98aea3bf141107cc12fa6aebb6823fbc7 100644
--- a/src/Lunr/Core/Tests/DatabaseSessionHandlerTest.php
+++ b/src/Lunr/Core/Tests/DatabaseSessionHandlerTest.php
@@ -56,7 +56,7 @@ abstract class DatabaseSessionHandlerTest extends PHPUnit_Framework_TestCase
      */
     public function setUp()
     {
-        $this->sdao = $this->getMockBuilder('Lunr\Core\SessionModel')
+        $this->sdao = $this->getMockBuilder('Lunr\Core\SessionDAO')
                            ->disableOriginalConstructor()
                            ->getMock();
 
diff --git a/src/Lunr/Core/Tests/SessionDAOTest.php b/src/Lunr/Core/Tests/SessionDAOTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..9da804f8f5991ac6de76c08e9604aba77cca18bd
--- /dev/null
+++ b/src/Lunr/Core/Tests/SessionDAOTest.php
@@ -0,0 +1,553 @@
+<?php
+
+/**
+ * This file contains the SessionDAOTest class.
+ *
+ * PHP Version 5.4
+ *
+ * @category   Libraries
+ * @package    Core
+ * @subpackage Tests
+ * @author     Felipe Martinez <felipe@m2mobi.com>
+ * @copyright  2012, M2Mobi BV, Amsterdam, The Netherlands
+ * @license    http://lunr.nl/LICENSE MIT License
+ */
+
+namespace Lunr\Core\Tests;
+
+use PHPUnit_Framework_TestCase;
+use ReflectionClass;
+use stdClass;
+use Lunr\Core\SessionDAO;
+
+/**
+ * This class contains common setup routines, providers
+ * and shared attributes for testing the SessionDAO class.
+ *
+ * @category   Libraries
+ * @package    Core
+ * @subpackage Tests
+ * @author     Felipe Martinez <felipe@m2mobi.com>
+ * @covers     Lunr\Core\SessionDAO
+ */
+class SessionDAOTest extends PHPUnit_Framework_TestCase
+{
+
+    /**
+     * Mock instance of the Configuration class.
+     * @var Configuration
+     */
+    private $configuration;
+
+    /**
+     * Mock instance of the Logger class.
+     * @var Logger
+     */
+    private $logger;
+
+    /**
+     * Mock instance of the DatabaseConnection class.
+     * @var DatabaseConnection
+     */
+    private $db;
+
+    /**
+     * Mock instance of the DatabaseConnection class.
+     * @var MySQLDMLQueryBuilder
+     */
+    private $query_builder;
+
+    /**
+     * Mock instance of the DatabaseConnection class.
+     * @var DatabaseQueryResultInterface
+     */
+    private $query_result;
+
+    /**
+     * Instance of the SessionDAO class.
+     * @var SessionDAO
+     */
+    private $session_dao;
+
+    /**
+     * Reflection instance of the SessionDAO class.
+     * @var ReflectionClass
+     */
+    private $session_dao_reflection;
+
+    /**
+     * TestCase Constructor.
+     */
+    public function setUp()
+    {
+        $this->configuration = $this->getMock('Lunr\Core\Configuration');
+
+        $this->logger = $this->getMockBuilder('Lunr\Core\Logger')
+                             ->disableOriginalConstructor()
+                             ->getMock();
+
+        $this->db = $this->getMockBuilder('Lunr\DataAccess\DatabaseConnection')
+                         ->setConstructorArgs(array(&$this->configuration, &$this->logger))
+                         ->getMockForAbstractClass();
+
+        $this->query_builder = $this->getMockBuilder('Lunr\DataAccess\MySQLDMLQueryBuilder')
+                         ->setConstructorArgs(array(&$this->db))
+                         ->getMock();
+
+        $this->query_result = $this->getMock('Lunr\DataAccess\DatabaseQueryResultInterface');
+
+        $this->session_dao            = new SessionDAO($this->db);
+        $this->session_dao_reflection = new ReflectionClass('Lunr\Core\SessionDAO');
+
+    }
+
+    /**
+     * TestCase Destructor.
+     */
+    public function tearDown()
+    {
+        unset($this->configuration);
+        unset($this->logger);
+        unset($this->db);
+        unset($this->query_builder);
+        unset($this->query_result);
+        unset($this->session_dao);
+        unset($this->session_dao_reflection);
+
+    }
+
+    /**
+     * Test that Read Session Data returns false if there is no session.
+     *
+     * @covers     Lunr\Core\SessionDAO::read_session_data
+     */
+    public function testReadSessionDataReturnsFalseIfSessionNotExists()
+    {
+        $this->db->expects($this->once())
+                 ->method('get_new_dml_query_builder_object')
+                 ->will($this->returnValue($this->query_builder));
+
+        $this->query_builder->expects($this->once())
+                 ->method('result_column')
+                 ->will($this->returnValue('column1'));
+        $this->query_builder->expects($this->once())
+                 ->method('select')
+                 ->with($this->equalTo('column1'));
+
+        $this->query_builder->expects($this->once())
+                 ->method('table')
+                 ->with($this->equalTo('user_sessions'));
+        $this->query_builder->expects($this->once())
+                 ->method('from');
+        //         $this->query_builder->expects($this->at(0))
+        //                  ->method('column')
+        //                  ->with($this->equalTo('sessionID'));
+        //         $this->query_builder->expects($this->at(1))
+        //                  ->method('column')
+        //                  ->with($this->equalTo('expires'));
+        //I believe this is an issue with phpunit, the line below works, the ones above don't
+        $this->query_builder->expects($this->exactly(2))
+                 ->method('column');
+
+        $this->query_builder->expects($this->once())
+                 ->method('value')
+                 ->with($this->equalTo('myId'));
+        $this->query_builder->expects($this->exactly(2))
+                 ->method('where');
+
+        $this->query_builder->expects($this->once())
+                 ->method('get_select_query');
+        $this->db->expects($this->once())
+                 ->method('query')
+                 ->will($this->returnValue($this->query_result));
+
+        $this->query_result->expects($this->once())
+                 ->method('has_failed')
+                 ->will($this->returnValue(TRUE));
+
+        $this->assertFalse($this->session_dao->read_session_data('myId'));
+
+    }
+
+    /**
+     * Test that Read Session Data returns Session.
+     *
+     * @covers     Lunr\Core\SessionDAO::read_session_data
+     */
+    public function testReadSessionDataReturnsSession()
+    {
+        $this->db->expects($this->once())
+                 ->method('get_new_dml_query_builder_object')
+                 ->will($this->returnValue($this->query_builder));
+
+        $this->query_builder->expects($this->once())
+                 ->method('result_column')
+                 ->will($this->returnValue('column1'));
+        $this->query_builder->expects($this->once())
+                 ->method('select')
+                 ->with($this->equalTo('column1'));
+
+        $this->query_builder->expects($this->once())
+                 ->method('table')
+                 ->with($this->equalTo('user_sessions'));
+        $this->query_builder->expects($this->once())
+                 ->method('from');
+        //         $this->query_builder->expects($this->at(0))
+        //                  ->method('column')
+        //                  ->with($this->equalTo('sessionID'));
+        //         $this->query_builder->expects($this->at(1))
+        //                  ->method('column')
+        //                  ->with($this->equalTo('expires'));
+        // I believe this is an issue with phpunit, the line below works, the ones above don't
+        $this->query_builder->expects($this->exactly(2))
+                 ->method('column');
+
+        $this->query_builder->expects($this->once())
+                 ->method('value')
+                 ->with($this->equalTo('myId'));
+        $this->query_builder->expects($this->exactly(2))
+                 ->method('where');
+
+        $this->query_builder->expects($this->once())
+                 ->method('get_select_query');
+        $this->db->expects($this->once())
+                 ->method('query')
+                 ->will($this->returnValue($this->query_result));
+
+        $this->query_result->expects($this->once())
+                 ->method('has_failed')
+                 ->will($this->returnValue(FALSE));
+        $this->query_result->expects($this->once())
+                 ->method('number_of_rows')
+                 ->will($this->returnValue(1));
+        $this->query_result->expects($this->once())
+                 ->method('result_cell')
+                 ->will($this->returnValue(base64_encode('mySession')));
+
+        $this->assertEquals($this->session_dao->read_session_data('myId'), 'mySession');
+
+    }
+
+    /**
+     * Test that Write Session Data rollsback if there is no session.
+     *
+     * @covers     Lunr\Core\SessionDAO::write_session_data
+     */
+    public function testWriteSessionDataRollsBackIfNoSession()
+    {
+        $this->db->expects($this->once())
+                 ->method('get_new_dml_query_builder_object')
+                 ->will($this->returnValue($this->query_builder));
+        $this->db->expects($this->once())
+                 ->method('begin_transaction');
+
+        $this->query_builder->expects($this->once())
+                 ->method('lock_mode')
+                 ->with($this->equalTo('FOR UPDATE'));
+
+        $this->query_builder->expects($this->once())
+                 ->method('table')
+                 ->with($this->equalTo('user_sessions'));
+        $this->query_builder->expects($this->once())
+                 ->method('from');
+
+        $this->query_builder->expects($this->once())
+                 ->method('column')
+                 ->with($this->equalTo('sessionID'));
+        $this->query_builder->expects($this->once())
+                 ->method('value')
+                 ->with($this->equalTo('myId'));
+        $this->query_builder->expects($this->once())
+                 ->method('where');
+
+        $this->query_builder->expects($this->once())
+                 ->method('get_select_query');
+        $this->db->expects($this->once())
+                 ->method('query')
+                 ->will($this->returnValue($this->query_result));
+
+        $this->query_result->expects($this->once())
+                 ->method('has_failed')
+                 ->will($this->returnValue(TRUE));
+
+        $this->db->expects($this->once())
+                 ->method('rollback');
+        $this->db->expects($this->once())
+                 ->method('end_transaction');
+
+        $this->session_dao->write_session_data('myId', 'myData', time());
+    }
+
+    /**
+     * Test that Write Session Data.
+     *
+     * @covers     Lunr\Core\SessionDAO::write_session_data
+     */
+    public function testWriteSessionData()
+    {
+        $this->db->expects($this->exactly(2))
+                 ->method('get_new_dml_query_builder_object')
+                 ->will($this->returnValue($this->query_builder));
+        $this->db->expects($this->once())
+                 ->method('begin_transaction');
+
+        $this->query_builder->expects($this->once())
+                 ->method('lock_mode')
+                 ->with($this->equalTo('FOR UPDATE'));
+
+        $this->query_builder->expects($this->once())
+                 ->method('table')
+                 ->with($this->equalTo('user_sessions'));
+        $this->query_builder->expects($this->once())
+                 ->method('from');
+
+        $time       = time();
+        $map_column = array(
+            array('sessionID', '', 'sessionID'),
+            array('sessionData', '', 'sessionData'),
+            array('expires', '', 'expires'),
+        );
+        $map_value  = array(
+            array('myId', '', '', 'myId'),
+            array(base64_encode('myData'), '', '', base64_encode('myData')),
+            array($time, '', '', $time),
+        );
+        $this->query_builder->expects($this->exactly(4))
+                 ->method('column')
+                 ->will($this->returnValueMap($map_column));
+        $this->query_builder->expects($this->exactly(4))
+                 ->method('value')
+                 ->will($this->returnValueMap($map_value));;
+        $this->query_builder->expects($this->once())
+                 ->method('where');
+
+        $this->query_builder->expects($this->once())
+                 ->method('get_select_query');
+        $this->db->expects($this->exactly(2))
+                 ->method('query')
+                 ->will($this->returnValue($this->query_result));
+
+        $this->query_result->expects($this->once())
+                 ->method('has_failed')
+                 ->will($this->returnValue(FALSE));
+
+        $this->query_builder->expects($this->once())
+                 ->method('into')
+                 ->with($this->equalTo('user_sessions'));
+        $data = array(
+            'sessionID'   => 'myId',
+            'sessionData' => base64_encode('myData'),
+            'expires'     => $time
+        );
+        $this->query_builder->expects($this->once())
+                 ->method('set')
+                 ->with($this->equalTo($data));
+        $this->query_builder->expects($this->once())
+                 ->method('get_replace_query');
+
+        $this->db->expects($this->once())
+                 ->method('commit');
+        $this->db->expects($this->once())
+                 ->method('end_transaction');
+
+        $this->session_dao->write_session_data('myId', 'myData', $time);
+    }
+
+    /**
+     * Test that Delete Session rollsback if there is no session.
+     *
+     * @covers     Lunr\Core\SessionDAO::delete_session
+     */
+    public function testDeleteSessionRollsBackIfQueryFails()
+    {
+        $this->db->expects($this->once())
+                 ->method('get_new_dml_query_builder_object')
+                 ->will($this->returnValue($this->query_builder));
+        $this->db->expects($this->once())
+                 ->method('begin_transaction');
+
+        $this->query_builder->expects($this->once())
+                 ->method('lock_mode')
+                 ->with($this->equalTo('FOR UPDATE'));
+
+        $this->query_builder->expects($this->once())
+                 ->method('table')
+                 ->with($this->equalTo('user_sessions'));
+        $this->query_builder->expects($this->once())
+                 ->method('from');
+
+        $this->query_builder->expects($this->once())
+                 ->method('column')
+                 ->with($this->equalTo('sessionID'));
+        $this->query_builder->expects($this->once())
+                 ->method('value')
+                 ->with($this->equalTo('myId'));
+        $this->query_builder->expects($this->once())
+                 ->method('where');
+
+        $this->query_builder->expects($this->once())
+                 ->method('get_select_query');
+        $this->db->expects($this->once())
+                 ->method('query')
+                 ->will($this->returnValue($this->query_result));
+
+        $this->query_result->expects($this->once())
+                 ->method('has_failed')
+                 ->will($this->returnValue(TRUE));
+
+        $this->db->expects($this->once())
+                 ->method('rollback');
+        $this->db->expects($this->once())
+                 ->method('end_transaction');
+
+        $this->session_dao->delete_session('myId');
+    }
+
+    /**
+     * Test that Delete Session rollsback if there is no session.
+     *
+     * @covers     Lunr\Core\SessionDAO::delete_session
+     */
+    public function testDeleteSessionRollsBackIfQueryHasNoResults()
+    {
+        $this->db->expects($this->once())
+                 ->method('get_new_dml_query_builder_object')
+                 ->will($this->returnValue($this->query_builder));
+        $this->db->expects($this->once())
+                 ->method('begin_transaction');
+
+        $this->query_builder->expects($this->once())
+                 ->method('lock_mode')
+                 ->with($this->equalTo('FOR UPDATE'));
+
+        $this->query_builder->expects($this->once())
+                 ->method('table')
+                 ->with($this->equalTo('user_sessions'));
+        $this->query_builder->expects($this->once())
+                 ->method('from');
+
+        $this->query_builder->expects($this->once())
+                 ->method('column')
+                 ->with($this->equalTo('sessionID'));
+        $this->query_builder->expects($this->once())
+                 ->method('value')
+                 ->with($this->equalTo('myId'));
+        $this->query_builder->expects($this->once())
+                 ->method('where');
+
+        $this->query_builder->expects($this->once())
+                 ->method('get_select_query');
+        $this->db->expects($this->once())
+                 ->method('query')
+                 ->will($this->returnValue($this->query_result));
+
+        $this->query_result->expects($this->once())
+                 ->method('has_failed')
+                 ->will($this->returnValue(FALSE));
+        $this->query_result->expects($this->once())
+                 ->method('number_of_rows')
+                 ->will($this->returnValue(0));
+
+        $this->db->expects($this->once())
+                 ->method('rollback');
+        $this->db->expects($this->once())
+                 ->method('end_transaction');
+
+        $this->session_dao->delete_session('myId');
+    }
+
+    /**
+     * Test Delete Session.
+     *
+     * @covers     Lunr\Core\SessionDAO::delete_session
+     */
+    public function testDeleteSession()
+    {
+        $this->db->expects($this->exactly(2))
+                 ->method('get_new_dml_query_builder_object')
+                 ->will($this->returnValue($this->query_builder));
+        $this->db->expects($this->once())
+                 ->method('begin_transaction');
+
+        $this->query_builder->expects($this->once())
+                 ->method('lock_mode')
+                 ->with($this->equalTo('FOR UPDATE'));
+
+        $this->query_builder->expects($this->exactly(2))
+                 ->method('table')
+                 ->with($this->equalTo('user_sessions'));
+        $this->query_builder->expects($this->exactly(2))
+                 ->method('from');
+
+        $this->query_builder->expects($this->exactly(2))
+                 ->method('column')
+                 ->with($this->equalTo('sessionID'));
+        $this->query_builder->expects($this->exactly(2))
+                 ->method('value')
+                 ->with($this->equalTo('myId'));
+        $this->query_builder->expects($this->exactly(2))
+                 ->method('where');
+
+        $this->query_builder->expects($this->once())
+                 ->method('get_select_query');
+        $this->db->expects($this->exactly(2))
+                 ->method('query')
+                 ->will($this->returnValue($this->query_result));
+
+        $this->query_result->expects($this->once())
+                 ->method('has_failed')
+                 ->will($this->returnValue(FALSE));
+        $this->query_result->expects($this->once())
+                 ->method('number_of_rows')
+                 ->will($this->returnValue(1));
+
+        $this->query_builder->expects($this->once())
+                 ->method('get_delete_query');
+
+        $this->db->expects($this->once())
+                 ->method('commit');
+        $this->db->expects($this->once())
+                 ->method('end_transaction');
+
+        $this->session_dao->delete_session('myId');
+    }
+
+    /**
+     * Test Session GC.
+     *
+     * @covers     Lunr\Core\SessionDAO::session_gc
+     */
+    public function testSessionGC()
+    {
+        $this->db->expects($this->once())
+                 ->method('get_new_dml_query_builder_object')
+                 ->will($this->returnValue($this->query_builder));
+
+        $this->query_builder->expects($this->once())
+                 ->method('table')
+                 ->with($this->equalTo('user_sessions'));
+        $this->query_builder->expects($this->once())
+                 ->method('from');
+
+        runkit_function_redefine('time', '', 'return 10;');
+
+        $this->query_builder->expects($this->once())
+                 ->method('column')
+                 ->with($this->equalTo('expires'));
+        $this->query_builder->expects($this->once())
+                 ->method('intvalue')
+                 ->with($this->equalTo('10'));
+        $this->query_builder->expects($this->once())
+                 ->method('where');
+
+        $this->query_builder->expects($this->once())
+                 ->method('get_delete_query');
+        $this->db->expects($this->once())
+                 ->method('query');
+
+        $this->session_dao->session_gc();
+    }
+
+}
+
+?>
diff --git a/tests/phpunit.xml b/tests/phpunit.xml
index 27832d4b78dea945724c82918955adf44de672ac..edb18c0b47cb63af65b898916baf717f54e7647c 100644
--- a/tests/phpunit.xml
+++ b/tests/phpunit.xml
@@ -50,6 +50,7 @@
             <file>src/Lunr/Core/Tests/MailSendTest.php</file>
             <file>src/Lunr/Core/Tests/SessionTest.php</file>
             <file>src/Lunr/Core/Tests/SessionBaseTest.php</file>
+            <file>src/Lunr/Core/Tests/SessionDAOTest.php</file>
             <file>src/Lunr/L10n/Tests/L10nTest.php</file>
             <file>src/Lunr/L10n/Tests/L10nProviderBaseTest.php</file>
             <file>src/Lunr/L10n/Tests/GettextL10nProviderBaseTest.php</file>
