Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F9786118
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
10 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/tests/Framework/DB.php b/tests/Framework/DB.php
index b7a063841..42020f47a 100644
--- a/tests/Framework/DB.php
+++ b/tests/Framework/DB.php
@@ -1,20 +1,74 @@
<?php
/**
* Test class to test rcube_db class
*
* @package Tests
*/
class Framework_DB extends PHPUnit_Framework_TestCase
{
/**
- * Class constructor
+ * Class constructor test
*/
function test_class()
{
$object = new rcube_db('test');
$this->assertInstanceOf('rcube_db', $object, "Class constructor");
}
+
+ /**
+ * Test script execution and table_prefix replacements
+ */
+ function test_exec_script()
+ {
+ $db = new rcube_db_test_wrapper('test');
+ $db->set_option('table_prefix', 'prefix_');
+
+ $script = implode("\n", array(
+ "CREATE TABLE `xxx` (test int, INDEX xxx (test));",
+ "-- test comment",
+ "ALTER TABLE `xxx` CHANGE test test int;",
+ "TRUNCATE xxx;",
+ "DROP TABLE `vvv`;",
+ "CREATE TABLE `i` (test int CONSTRAINT `iii`
+ FOREIGN KEY (`test`) REFERENCES `xxx`(`test`) ON DELETE CASCADE ON UPDATE CASCADE);",
+ "INSERT INTO xxx test = 1;",
+ "SELECT test FROM xxx;",
+ ));
+ $output = implode("\n", array(
+ "CREATE TABLE `prefix_xxx` (test int, INDEX prefix_xxx (test));",
+ "ALTER TABLE `prefix_xxx` CHANGE test test int;",
+ "TRUNCATE prefix_xxx;",
+ "DROP TABLE `prefix_vvv`;",
+ "CREATE TABLE `prefix_i` (test int CONSTRAINT `prefix_iii`
+ FOREIGN KEY (`test`) REFERENCES `prefix_xxx`(`test`) ON DELETE CASCADE ON UPDATE CASCADE);",
+ "INSERT INTO prefix_xxx test = 1;",
+ "SELECT test FROM prefix_xxx;",
+ ));
+
+ $result = $db->exec_script($script);
+ $out = '';
+
+ foreach ($db->queries as $q) {
+ $out[] = $q[0];
+ }
+
+ $this->assertTrue($result, "Execute SQL script (result)");
+ $this->assertSame(implode("\n", $out), $output, "Execute SQL script (content)");
+ }
+}
+
+/**
+ * rcube_db wrapper to test some protected methods
+ */
+class rcube_db_test_wrapper extends rcube_db
+{
+ public $queries = array();
+
+ protected function _query($query, $offset, $numrows, $params)
+ {
+ $this->queries[] = array(trim($query), $offset, $numrows, $params);
+ }
}
diff --git a/tests/Framework/DBMssql.php b/tests/Framework/DBMssql.php
new file mode 100644
index 000000000..b88c95b28
--- /dev/null
+++ b/tests/Framework/DBMssql.php
@@ -0,0 +1,20 @@
+<?php
+
+/**
+ * Test class to test rcube_db_mssql class
+ *
+ * @package Tests
+ */
+class Framework_DBMssql extends PHPUnit_Framework_TestCase
+{
+
+ /**
+ * Class constructor
+ */
+ function test_class()
+ {
+ $object = new rcube_db_mssql('test');
+
+ $this->assertInstanceOf('rcube_db_mssql', $object, "Class constructor");
+ }
+}
diff --git a/tests/Framework/DBMysql.php b/tests/Framework/DBMysql.php
new file mode 100644
index 000000000..a3b8fda39
--- /dev/null
+++ b/tests/Framework/DBMysql.php
@@ -0,0 +1,20 @@
+<?php
+
+/**
+ * Test class to test rcube_db_mysql class
+ *
+ * @package Tests
+ */
+class Framework_DBMysql extends PHPUnit_Framework_TestCase
+{
+
+ /**
+ * Class constructor
+ */
+ function test_class()
+ {
+ $object = new rcube_db_mysql('test');
+
+ $this->assertInstanceOf('rcube_db_mysql', $object, "Class constructor");
+ }
+}
diff --git a/tests/Framework/DBPgsql.php b/tests/Framework/DBPgsql.php
new file mode 100644
index 000000000..67d1c4696
--- /dev/null
+++ b/tests/Framework/DBPgsql.php
@@ -0,0 +1,20 @@
+<?php
+
+/**
+ * Test class to test rcube_db_pgsql class
+ *
+ * @package Tests
+ */
+class Framework_DBPgsql extends PHPUnit_Framework_TestCase
+{
+
+ /**
+ * Class constructor
+ */
+ function test_class()
+ {
+ $object = new rcube_db_pgsql('test');
+
+ $this->assertInstanceOf('rcube_db_pgsql', $object, "Class constructor");
+ }
+}
diff --git a/tests/Framework/DBSqlite.php b/tests/Framework/DBSqlite.php
new file mode 100644
index 000000000..121bb7770
--- /dev/null
+++ b/tests/Framework/DBSqlite.php
@@ -0,0 +1,20 @@
+<?php
+
+/**
+ * Test class to test rcube_db_sqlite class
+ *
+ * @package Tests
+ */
+class Framework_DBSqlite extends PHPUnit_Framework_TestCase
+{
+
+ /**
+ * Class constructor
+ */
+ function test_class()
+ {
+ $object = new rcube_db_sqlite('test');
+
+ $this->assertInstanceOf('rcube_db_sqlite', $object, "Class constructor");
+ }
+}
diff --git a/tests/Framework/DBSqlsrv.php b/tests/Framework/DBSqlsrv.php
new file mode 100644
index 000000000..6272ef5d7
--- /dev/null
+++ b/tests/Framework/DBSqlsrv.php
@@ -0,0 +1,20 @@
+<?php
+
+/**
+ * Test class to test rcube_db_sqlsrv class
+ *
+ * @package Tests
+ */
+class Framework_DBSqlsrv extends PHPUnit_Framework_TestCase
+{
+
+ /**
+ * Class constructor
+ */
+ function test_class()
+ {
+ $object = new rcube_db_sqlsrv('test');
+
+ $this->assertInstanceOf('rcube_db_sqlsrv', $object, "Class constructor");
+ }
+}
diff --git a/tests/phpunit.xml b/tests/phpunit.xml
index c2874fd07..cee3434c1 100644
--- a/tests/phpunit.xml
+++ b/tests/phpunit.xml
@@ -1,80 +1,85 @@
<phpunit backupGlobals="false"
bootstrap="bootstrap.php"
colors="true">
<testsuites>
<testsuite name="All Tests">
<file>Framework/BaseReplacer.php</file>
<file>Framework/Bootstrap.php</file>
<file>Framework/Browser.php</file>
<file>Framework/Cache.php</file>
<file>Framework/CacheShared.php</file>
<file>Framework/Charset.php</file>
<file>Framework/Contacts.php</file>
<file>Framework/ContentFilter.php</file>
<file>Framework/Csv2vcard.php</file>
<file>Framework/DB.php</file>
+ <file>Framework/DBMssql.php</file>
+ <file>Framework/DBMysql.php</file>
+ <file>Framework/DBPgsql.php</file>
+ <file>Framework/DBSqlite.php</file>
+ <file>Framework/DBSqlsrv.php</file>
<file>Framework/Enriched.php</file>
<file>Framework/Html.php</file>
<file>Framework/Html2text.php</file>
<file>Framework/Imap.php</file>
<file>Framework/ImapCache.php</file>
<file>Framework/ImapGeneric.php</file>
<file>Framework/Image.php</file>
<file>Framework/LdapGeneric.php</file>
<file>Framework/MessageHeader.php</file>
<file>Framework/MessagePart.php</file>
<file>Framework/Mime.php</file>
<file>Framework/Rcube.php</file>
<file>Framework/ResultIndex.php</file>
<file>Framework/ResultSet.php</file>
<file>Framework/ResultThread.php</file>
<file>Framework/Smtp.php</file>
<file>Framework/SpellcheckAtd.php</file>
<file>Framework/SpellcheckEnchant.php</file>
<file>Framework/SpellcheckGoogie.php</file>
<file>Framework/SpellcheckPspell.php</file>
<file>Framework/Spellchecker.php</file>
<file>Framework/StringReplacer.php</file>
<file>Framework/User.php</file>
<file>Framework/Utils.php</file>
<file>Framework/VCard.php</file>
<file>Framework/Washtml.php</file>
<file>MailFunc.php</file>
</testsuite>
<testsuite name="Plugins Tests">
<file>./../plugins/acl/tests/Acl.php</file>
<file>./../plugins/additional_message_headers/tests/AdditionalMessageHeaders.php</file>
<file>./../plugins/archive/tests/Archive.php</file>
<file>./../plugins/autologon/tests/Autologon.php</file>
<file>./../plugins/database_attachments/tests/DatabaseAttachments.php</file>
<file>./../plugins/debug_logger/tests/DebugLogger.php</file>
<file>./../plugins/emoticons/tests/Emoticons.php</file>
<file>./../plugins/enigma/tests/Enigma.php</file>
<file>./../plugins/example_addressbook/tests/ExampleAddressbook.php</file>
<file>./../plugins/filesystem_attachments/tests/FilesystemAttachments.php</file>
<file>./../plugins/help/tests/Help.php</file>
<file>./../plugins/hide_blockquote/tests/HideBlockquote.php</file>
<file>./../plugins/http_authentication/tests/HttpAuthentication.php</file>
<file>./../plugins/identity_select/tests/IdentitySelect.php</file>
<file>./../plugins/jqueryui/tests/Jqueryui.php</file>
<file>./../plugins/legacy_browser/tests/LegacyBrowser.php</file>
<file>./../plugins/managesieve/tests/Managesieve.php</file>
<file>./../plugins/managesieve/tests/Parser.php</file>
<file>./../plugins/managesieve/tests/Tokenizer.php</file>
<file>./../plugins/markasjunk/tests/Markasjunk.php</file>
<file>./../plugins/new_user_dialog/tests/NewUserDialog.php</file>
<file>./../plugins/new_user_identity/tests/NewUserIdentity.php</file>
<file>./../plugins/newmail_notifier/tests/NewmailNotifier.php</file>
<file>./../plugins/password/tests/Password.php</file>
<file>./../plugins/redundant_attachments/tests/RedundantAttachments.php</file>
<file>./../plugins/show_additional_headers/tests/ShowAdditionalHeaders.php</file>
<file>./../plugins/squirrelmail_usercopy/tests/Squirrelmail_usercopy.php</file>
<file>./../plugins/subscriptions_option/tests/SubscriptionsOption.php</file>
<file>./../plugins/userinfo/tests/Userinfo.php</file>
<file>./../plugins/vcard_attachments/tests/VcardAttachments.php</file>
<file>./../plugins/virtuser_file/tests/VirtuserFile.php</file>
<file>./../plugins/virtuser_query/tests/VirtuserQuery.php</file>
<file>./../plugins/zipdownload/tests/Zipdownload.php</file>
</testsuite>
</testsuites>
</phpunit>
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Tue, Aug 18, 4:51 AM (1 d, 18 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1261854
Default Alt Text
(10 KB)
Attached To
Mode
R3 roundcubemail
Attached
Detach File
Event Timeline
Log In to Comment