3 * Tests for displaying results
5 * @package PhpMyAdmin-test
12 require_once 'libraries/zip_extension.lib.php';
13 require_once 'libraries/php-gettext/gettext.inc';
15 class PMA_zip_extension_test
extends PHPUnit_Framework_TestCase
18 * Test zip file content
20 * @param string $file zip file
21 * @param string $specific_entry regular expression to match a file
22 * @param mixed $output expected output
24 * @dataProvider providerForTestGetZipContents
27 public function testGetZipContents($file, $specific_entry, $output)
30 PMA_getZipContents($file, $specific_entry),
36 * Provider for testGetZipContents
40 public function providerForTestGetZipContents()
44 './test/test_data/test.zip',
48 'data' => 'TEST FILE'. "\n"
52 './test/test_data/test.zip',
55 'error' => 'Error in ZIP archive: Could not find "test"',
63 * Test Find file in Zip Archive
65 * @param string $file_regexp regular expression for the file name to match
66 * @param string $file zip archive
67 * @param mixed $output expected output
69 * @dataProvider providerForTestFindFileFromZipArchive
72 public function testFindFileFromZipArchive($file_regexp, $file, $output)
75 PMA_findFileFromZipArchive($file_regexp, $file),
81 * Provider for testFindFileFromZipArchive
85 public function providerForTestFindFileFromZipArchive()
90 './test/test_data/test.zip',
97 * Test for PMA_getNoOfFilesInZip
101 public function testGetNoOfFilesInZip()
104 PMA_getNoOfFilesInZip('./test/test_data/test.zip'),
110 * Test for PMA_zipExtract
114 public function testZipExtract()
118 './test/test_data/test.zip', './test/test_data/', 'wrongName'
125 * Test for PMA_getZipError
127 * @param int $code error code
128 * @param mixed $output expected output
130 * @dataProvider providerForTestGetZipError
133 public function testGetZipError($code, $output)
136 PMA_getZipError($code),
142 * Provider for testGetZipError
146 public function providerForTestGetZipError()
151 'Multi-disk zip archives not supported'
167 'Zip archive inconsistent'