The branch, master has been updated
       via  096d06eda002b6f47a455e4d144538355ce66274 (commit)
       via  f1e2897da00c035c6ec9c725cac8817f719f9606 (commit)
       via  2df16b3187c06272e2b82e63e59ba91e36ceb091 (commit)
      from  d180636168ee95d4b4629b71b18875aba3c6adeb (commit)


- Log -----------------------------------------------------------------
commit 096d06eda002b6f47a455e4d144538355ce66274
Author: Michal Čihař <[email protected]>
Date:   Wed Aug 10 10:06:54 2011 +0200

    Move class tests to test/classes

commit f1e2897da00c035c6ec9c725cac8817f719f9606
Author: Michal Čihař <[email protected]>
Date:   Wed Aug 10 10:04:17 2011 +0200

    Return true on succsess

commit 2df16b3187c06272e2b82e63e59ba91e36ceb091
Author: Michal Čihař <[email protected]>
Date:   Wed Aug 10 09:48:42 2011 +0200

    Start testcases for PMA_File class

-----------------------------------------------------------------------

Summary of changes:
 libraries/File.class.php                           |    2 +-
 test/classes/PMA_File_test.php                     |   59 ++++++++++++++++++++
 .../PMA_List_Database_test.php                     |    0
 .../PMA_Theme_Manager_test.php                     |    0
 test/test_data/test.bz2                            |  Bin 0 -> 49 bytes
 test/test_data/test.file                           |    1 +
 test/test_data/test.gz                             |  Bin 0 -> 40 bytes
 test/test_data/test.zip                            |  Bin 0 -> 178 bytes
 8 files changed, 61 insertions(+), 1 deletions(-)
 create mode 100644 test/classes/PMA_File_test.php
 rename test/{libraries => classes}/PMA_List_Database_test.php (100%)
 rename test/{libraries => classes}/PMA_Theme_Manager_test.php (100%)
 create mode 100644 test/test_data/test.bz2
 create mode 100644 test/test_data/test.file
 create mode 100644 test/test_data/test.gz
 create mode 100644 test/test_data/test.zip

diff --git a/libraries/File.class.php b/libraries/File.class.php
index 5a6d59f..332c8ea 100644
--- a/libraries/File.class.php
+++ b/libraries/File.class.php
@@ -643,7 +643,7 @@ class PMA_File
                 break;
         }
 
-
+        return true;
     }
 
     function getCharset()
diff --git a/test/classes/PMA_File_test.php b/test/classes/PMA_File_test.php
new file mode 100644
index 0000000..b43135c
--- /dev/null
+++ b/test/classes/PMA_File_test.php
@@ -0,0 +1,59 @@
+
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * tests for PMA_File class
+ *
+ * @package phpMyAdmin-test
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/common.lib.php';
+require_once 'libraries/File.class.php';
+
+class PMA_File_test extends PHPUnit_Framework_TestCase
+{
+    public function setup()
+    {
+        $GLOBALS['cfg']['BZipDump'] = true;
+        $GLOBALS['cfg']['GZipDump'] = true;
+        $GLOBALS['cfg']['ZipDump'] = true;
+        $GLOBALS['charset_conversion'] = false;
+    }
+
+    /**
+     * @dataProvider compressedFiles
+     */
+    public function testMIME($file, $mime)
+    {
+        $arr = new PMA_File($file);
+        $this->assertEquals($mime, $arr->getCompression());
+    }
+
+    /**
+     * @dataProvider compressedFiles
+     */
+    public function testContent($file, $mime)
+    {
+        $orig = file_get_contents('./test/test_data/test.file');
+        $file = new PMA_File($file);
+        $file->setDecompressContent(true);
+        $this->assertTrue($file->open());
+        if ($mime == 'application/zip') {
+            $this->assertEquals($orig, $file->content_uncompressed);
+        } else {
+            $this->assertEquals($orig, $file->getNextChunk());
+        }
+    }
+
+    public function compressedFiles() {
+        return array(
+            array('./test/test_data/test.gz', 'application/gzip'),
+            array('./test/test_data/test.bz2', 'application/bzip2'),
+            array('./test/test_data/test.zip', 'application/zip'),
+            );
+    }
+}
+?>
diff --git a/test/libraries/PMA_List_Database_test.php 
b/test/classes/PMA_List_Database_test.php
similarity index 100%
rename from test/libraries/PMA_List_Database_test.php
rename to test/classes/PMA_List_Database_test.php
diff --git a/test/libraries/PMA_Theme_Manager_test.php 
b/test/classes/PMA_Theme_Manager_test.php
similarity index 100%
rename from test/libraries/PMA_Theme_Manager_test.php
rename to test/classes/PMA_Theme_Manager_test.php
diff --git a/test/test_data/test.bz2 b/test/test_data/test.bz2
new file mode 100644
index 0000000..971a078
Binary files /dev/null and b/test/test_data/test.bz2 differ
diff --git a/test/test_data/test.file b/test/test_data/test.file
new file mode 100644
index 0000000..fafd745
--- /dev/null
+++ b/test/test_data/test.file
@@ -0,0 +1 @@
+TEST FILE
diff --git a/test/test_data/test.gz b/test/test_data/test.gz
new file mode 100644
index 0000000..6d25ca8
Binary files /dev/null and b/test/test_data/test.gz differ
diff --git a/test/test_data/test.zip b/test/test_data/test.zip
new file mode 100644
index 0000000..bee8c35
Binary files /dev/null and b/test/test_data/test.zip differ


hooks/post-receive
-- 
phpMyAdmin

------------------------------------------------------------------------------
uberSVN's rich system and user administration capabilities and model 
configuration take the hassle out of deploying and managing Subversion and 
the tools developers use with it. Learn more about uberSVN and get a free 
download at:  http://p.sf.net/sfu/wandisco-dev2dev
_______________________________________________
Phpmyadmin-git mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/phpmyadmin-git

Reply via email to