diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2010-03-26 16:41:19 +0100 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2010-03-26 16:41:19 +0100 |
commit | af654814f63e05be5236075f06943062be007072 (patch) | |
tree | 18b72e7817d2b73a78e93573ab3410539851ec10 /tests/dbal/dbal.php | |
parent | 94bc65e2038407b8b6d2b23c195b232e07208d22 (diff) | |
download | forums-af654814f63e05be5236075f06943062be007072.tar forums-af654814f63e05be5236075f06943062be007072.tar.gz forums-af654814f63e05be5236075f06943062be007072.tar.bz2 forums-af654814f63e05be5236075f06943062be007072.tar.xz forums-af654814f63e05be5236075f06943062be007072.zip |
[feature/dbal-tests] Added tests for dbal fetchrow and fetchfield.
Diffstat (limited to 'tests/dbal/dbal.php')
-rw-r--r-- | tests/dbal/dbal.php | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/dbal/dbal.php b/tests/dbal/dbal.php new file mode 100644 index 0000000000..a77279105f --- /dev/null +++ b/tests/dbal/dbal.php @@ -0,0 +1,43 @@ +<?php +/** +* +* @package testing +* @copyright (c) 2008 phpBB Group +* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* +*/ + +require_once 'test_framework/framework.php'; +require_once '../phpBB/includes/functions.php'; + +class phpbb_dbal_test extends phpbb_database_test_case +{ + public function getDataSet() + { + return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/two_users.xml'); + } + + public function test_select_row() + { + $db = $this->new_dbal(); + + $result = $db->sql_query('SELECT username_clean + FROM phpbb_users + WHERE user_id = 2'); + $row = $db->sql_fetchrow($result); + + $this->assertEquals(array('username_clean' => 'foobar'), $row); + } + + public function test_select_field() + { + $db = $this->new_dbal(); + + $result = $db->sql_query('SELECT username_clean + FROM phpbb_users + WHERE user_id = 2'); + + $this->assertEquals('foobar', $db->sql_fetchfield('username_clean')); + } +} + |