/usr/share/php/tests/Horde_Db/Horde/Db/StatementParserTest.php is in php-horde-db 2.0.4-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | <?php
class Horde_Db_StatementParserTest extends Horde_Test_Case
{
public function testParserFindsMultilineCreateStatement()
{
$expected = array(
'DROP TABLE IF EXISTS `exp_actions`',
'SET @saved_cs_client = @@character_set_client',
'SET character_set_client = utf8',
'CREATE TABLE `exp_actions` (
`action_id` int(4) unsigned NOT NULL auto_increment,
`class` varchar(50) NOT NULL,
`method` varchar(50) NOT NULL,
PRIMARY KEY (`action_id`)
) ENGINE=MyISAM AUTO_INCREMENT=20 DEFAULT CHARSET=latin1',
'SET character_set_client = @saved_cs_client',
);
$this->assertParser($expected, 'drop_create_table.sql');
}
public function assertParser(array $expectedStatements, $filename)
{
$file = new SplFileObject(__DIR__ . '/fixtures/' . $filename, 'r');
$parser = new Horde_Db_StatementParser($file);
foreach ($expectedStatements as $i => $expected) {
// Strip any whitespace before comparing the strings.
$this->assertEquals(preg_replace('/\s/', '', $expected),
preg_replace('/\s/', '', $parser->next()),
"Parser differs on statement #$i");
}
}
}
|