Created
October 19, 2012 08:57
-
-
Save nickvergessen/3917045 to your computer and use it in GitHub Desktop.
Update with math using new values?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* | |
* @package testing | |
* @copyright (c) 2012 phpBB Group | |
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 | |
* | |
*/ | |
require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; | |
class phpbb_dbal_update_math_test extends phpbb_database_test_case | |
{ | |
public function getDataSet() | |
{ | |
return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/update_math_test.xml'); | |
} | |
public function test_update_math() | |
{ | |
$db = $this->new_dbal(); | |
$sql = 'UPDATE phpbb_users | |
SET user_lastvisit = 8, | |
user_lastmark = 16, | |
user_lastpost_time = user_lastvisit + user_lastmark'; | |
$db->sql_query($sql); | |
$sql = 'SELECT user_lastpost_time | |
FROM phpbb_users'; | |
$result = $db->sql_query($sql); | |
$this->assertEquals(24, $db->sql_fetchfield('user_lastpost_time')); | |
$db->sql_freeresult($result); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8" ?> | |
<dataset> | |
<table name="phpbb_users"> | |
<column>user_id</column> | |
<column>user_lastvisit</column> | |
<column>user_lastmark</column> | |
<column>user_lastpost_time</column> | |
<column>user_permissions</column> | |
<column>user_sig</column> | |
<column>user_occ</column> | |
<column>user_interests</column> | |
<row> | |
<value>1</value> | |
<value>1</value> | |
<value>2</value> | |
<value>4</value> | |
<value></value> | |
<value></value> | |
<value></value> | |
<value></value> | |
</row> | |
</table> | |
</dataset> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment