3 class DatabaseTest
extends PHPUnit_Framework_TestCase
{
7 $this->db
= wfGetDB( DB_SLAVE
);
10 function testAddQuotesNull() {
13 $this->db
->addQuotes( NULL ) );
16 function testAddQuotesInt() {
17 # returning just "1234" should be ok too, though...
21 $this->db
->addQuotes( 1234 ) );
24 function testAddQuotesFloat() {
25 # returning just "1234.5678" would be ok too, though
28 $this->db
->addQuotes( 1234.5678 ) );
31 function testAddQuotesString() {
34 $this->db
->addQuotes( 'string' ) );
37 function testAddQuotesStringQuote() {
39 "'string\'s cause trouble'",
40 $this->db
->addQuotes( "string's cause trouble" ) );
43 function testFillPreparedEmpty() {
44 $sql = $this->db
->fillPrepared(
45 'SELECT * FROM interwiki', array() );
47 "SELECT * FROM interwiki",
51 function testFillPreparedQuestion() {
52 $sql = $this->db
->fillPrepared(
53 'SELECT * FROM cur WHERE cur_namespace=? AND cur_title=?',
54 array( 4, "Snicker's_paradox" ) );
56 "SELECT * FROM cur WHERE cur_namespace='4' AND cur_title='Snicker\'s_paradox'",
60 function testFillPreparedBang() {
61 $sql = $this->db
->fillPrepared(
62 'SELECT user_id FROM ! WHERE user_name=?',
63 array( '"user"', "Slash's Dot" ) );
65 "SELECT user_id FROM \"user\" WHERE user_name='Slash\'s Dot'",
69 function testFillPreparedRaw() {
70 $sql = $this->db
->fillPrepared(
71 "SELECT * FROM cur WHERE cur_title='This_\\&_that,_WTF\\?\\!'",
72 array( '"user"', "Slash's Dot" ) );
74 "SELECT * FROM cur WHERE cur_title='This_&_that,_WTF?!'",