Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F56347370
MySQLDatabaseTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
MySQLDatabaseTest.php
View Options
<?php
/**
* _, __, _, _ __, _ _, _, _
* / \ |_) (_ | | \ | /_\ |\ |
* \ / |_) , ) | |_/ | | | | \|
* ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
*
* Unit testing — MysqlDatabaseTest class
*
* @package ObsidianWorkspaces
* @subpackage Tests
* @author Sébastien Santoro aka Dereckson <dereckson@espace-win.org>
* @license http://www.opensource.org/licenses/bsd-license.php BSD
* @filesource
*/
//require '../includes/database/MysqlDatabase.php';
/**
* Tests DatabaseTest
*/
class
MySQLDatabaseTest
extends
PHPUnit_Framework_TestCase
{
/**
* @var MysqlDatabase
*/
private
$db
;
/**
* Creates the objects against which we will test.
*/
public
function
setUp
()
{
$this
->
db
=
new
MySQLDatabase
(
UNITTESTING_MYSQL_HOST
,
UNITTESTING_MYSQL_USERNAME
,
UNITTESTING_MYSQL_PASSWORD
,
UNITTESTING_MYSQL_DATABASE
);
}
/**
* Tests string escape
*
* @covers SQLiteCollection::escape
*/
public
function
testEscape
()
{
$toEscapeExpressions
=
[
""
,
"Lorem ipsum dolor"
,
"L'arbre"
,
"''"
,
"cœur"
];
$escapedExpressions
=
[
""
,
"Lorem ipsum dolor"
,
"L
\\
'arbre"
,
"
\\
'
\\
'"
,
"cœur"
];
for
(
$i
=
0
;
$i
<
count
(
$toEscapeExpressions
)
;
$i
++)
{
$this
->
assertEquals
(
$escapedExpressions
[
$i
],
$this
->
db
->
escape
(
$toEscapeExpressions
[
$i
]),
"The following string isn't properly escaped: '$toEscapeExpressions[$i]'"
);
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Nov 7, 07:05 (12 h, 54 m ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4226357
Default Alt Text
MySQLDatabaseTest.php (1 KB)
Attached To
Mode
rOBSIDIAN Obsidian Workspaces
Attached
Detach File
Event Timeline
Log In to Comment