phpmyadmin/test/classes/PMA_File_test.php
Hugues Peccatte f0ba28fc1d Set namespace on Advisor, Config, Console and Util classes.
Set namespace on DbQbe.
Set namespace to 'DbSearch'.
Split Advisor.class.php file.
Change Advisor namespace.
Rename DbQbe class and file.
Set namespace on DisplayResults.
Set namespace on Error.
Use namespace for ErrorHandler.
Add class autoloader.
Change ErrorHandler filename.
Remove some require.
Update Config namespace path.
Update PMA_Util to PMA\libraries\Util.
Rename Font and File classes files.
Use namespace for Footer.
Set namespace in all libraries classes.
Namespace OutputBuffering.
Export SubPartition.
Rename Partition file.
Namespace PDF.
Namespace RecentFavoriteTable.
Replace PMA_Response by Response and PMA_Message by Message.
Update uses and calls.
Fix unit tests.
Fix SqlParser autoload.

Signed-off-by: Hugues Peccatte <hugues.peccatte@gmail.com>
2015-09-01 21:22:52 +02:00

73 lines
1.7 KiB
PHP

<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* tests for PMA\libraries\File class
*
* @package PhpMyAdmin-test
*/
/**
* tests for PMA\libraries\File class
*
* @package PhpMyAdmin-test
*/
class PMA_File_Test extends PHPUnit_Framework_TestCase
{
/**
* Setup function for test cases
*
* @return void
*/
public function setup()
{
$GLOBALS['cfg']['BZipDump'] = true;
$GLOBALS['cfg']['GZipDump'] = true;
$GLOBALS['cfg']['ZipDump'] = true;
$GLOBALS['charset_conversion'] = false;
}
/**
* Test for PMA\libraries\File::getCompression
*
* @param string $file file string
* @param string $mime expected mime
*
* @return void
* @dataProvider compressedFiles
*/
public function testMIME($file, $mime)
{
$arr = new PMA\libraries\File($file);
$this->assertEquals($mime, $arr->getCompression());
}
/**
* Test for PMA\libraries\File::getContent
*
* @param string $file file string
*
* @return void
* @dataProvider compressedFiles
*/
public function testBinaryContent($file)
{
$data = '0x' . bin2hex(file_get_contents($file));
$file = new PMA\libraries\File($file);
$this->assertEquals($data, $file->getContent());
}
/**
* Data provider for tests
*
* @return array Test data
*/
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'),
);
}
}