Refactored ConfigFile class so that it is no longer a singleton
[phpmyadmin.git] / test / classes / PMA_Config_test.php
blob127a1469d1d096e75aea3ce7de1c64aa6ca75ea5
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Test for PMA_Config class
6 * @package PhpMyAdmin-test
7 * @group current
8 */
11 * Include to test.
13 require_once 'libraries/core.lib.php';
14 require_once 'libraries/Config.class.php';
15 require_once 'libraries/relation.lib.php';
16 require_once 'libraries/Theme.class.php';
17 require_once 'libraries/vendor_config.php';
18 require_once 'libraries/url_generating.lib.php';
19 require_once 'libraries/php-gettext/gettext.inc';
21 /**
22 * Tests behaviour of PMA_Config class
24 * @package PhpMyAdmin-test
26 class PMA_ConfigTest extends PHPUnit_Framework_TestCase
28 /**
29 * Turn off backup globals
31 protected $backupGlobals = false;
33 /**
34 * @var PMA_Config
36 protected $object;
38 /**
39 * Sets up the fixture, for example, opens a network connection.
40 * This method is called before a test is executed.
42 * @return void
44 protected function setUp()
46 $this->object = new PMA_Config;
47 $GLOBALS['server'] = 0;
48 $_SESSION['is_git_revision'] = true;
49 $GLOBALS['PMA_Config'] = new PMA_Config(CONFIG_FILE);
52 /**
53 * Tears down the fixture, for example, closes a network connection.
54 * This method is called after a test is executed.
56 * @return void
58 protected function tearDown()
62 /**
63 * Test for CheckSystem
65 * @return void
67 public function testCheckSystem()
69 $this->object->checkSystem();
71 $this->assertNotNull($this->object->get('PMA_VERSION'));
72 $this->assertNotEmpty($this->object->get('PMA_THEME_VERSION'));
73 $this->assertNotEmpty($this->object->get('PMA_THEME_GENERATION'));
76 /**
77 * Test for GetFontsizeForm
79 * @return void
81 public function testGetFontsizeForm()
83 $this->assertContains(
84 '<form name="form_fontsize_selection" id="form_fontsize_selection"',
85 PMA_Config::getFontsizeForm()
88 $this->assertContains(
89 '<label for="select_fontsize">',
90 PMA_Config::getFontsizeForm()
93 //test getFontsizeOptions for "em" unit
94 $fontsize = $GLOBALS['PMA_Config']->get('fontsize');
95 $GLOBALS['PMA_Config']->set('fontsize', '');
96 $_COOKIE['pma_fontsize'] = "10em";
97 $this->assertContains(
98 '<option value="7em"',
99 PMA_Config::getFontsizeForm()
101 $this->assertContains(
102 '<option value="8em"',
103 PMA_Config::getFontsizeForm()
106 //test getFontsizeOptions for "pt" unit
107 $_COOKIE['pma_fontsize'] = "10pt";
108 $this->assertContains(
109 '<option value="2pt"',
110 PMA_Config::getFontsizeForm()
112 $this->assertContains(
113 '<option value="4pt"',
114 PMA_Config::getFontsizeForm()
117 //test getFontsizeOptions for "px" unit
118 $_COOKIE['pma_fontsize'] = "10px";
119 $this->assertContains(
120 '<option value="5px"',
121 PMA_Config::getFontsizeForm()
123 $this->assertContains(
124 '<option value="6px"',
125 PMA_Config::getFontsizeForm()
128 //test getFontsizeOptions for unknown unit
129 $_COOKIE['pma_fontsize'] = "10abc";
130 $this->assertContains(
131 '<option value="7abc"',
132 PMA_Config::getFontsizeForm()
134 $this->assertContains(
135 '<option value="8abc"',
136 PMA_Config::getFontsizeForm()
138 unset($_COOKIE['pma_fontsize']);
139 //rollback the fontsize setting
140 $GLOBALS['PMA_Config']->set('fontsize', $fontsize);
144 * Test for checkOutputCompression
146 * @return void
148 public function testCheckOutputCompression()
151 $this->object->set('OBGzip', 'auto');
153 $this->object->set('PMA_USR_BROWSER_AGENT', 'IE');
154 $this->object->set('PMA_USR_BROWSER_VER', 6);
155 $this->object->checkOutputCompression();
156 $this->assertFalse($this->object->get("OBGzip"));
158 $this->object->set('OBGzip', 'auto');
159 $this->object->set('PMA_USR_BROWSER_AGENT', 'MOZILLA');
160 $this->object->set('PMA_USR_BROWSER_VER', 5);
161 $this->object->checkOutputCompression();
162 $this->assertTrue($this->object->get("OBGzip"));
166 * Tests client parsing code.
168 * @param string $agent User agent string
169 * @param string $os Expected parsed OS (or null if none)
170 * @param string $browser Expected parsed browser (or null if none)
171 * @param string $version Expected browser version (or null if none)
173 * @return void
175 * @dataProvider userAgentProvider
177 public function testCheckClient($agent, $os, $browser = null, $version = null)
179 $_SERVER['HTTP_USER_AGENT'] = $agent;
180 $this->object->checkClient();
181 $this->assertEquals($os, $this->object->get('PMA_USR_OS'));
182 if ($os != null) {
183 $this->assertEquals(
184 $browser,
185 $this->object->get('PMA_USR_BROWSER_AGENT')
188 if ($version != null) {
189 $this->assertEquals(
190 $version,
191 $this->object->get('PMA_USR_BROWSER_VER')
197 * user Agent Provider
199 * @return array
201 public function userAgentProvider()
203 return array(
204 array(
205 'Opera/9.80 (X11; Linux x86_64; U; pl) Presto/2.7.62 Version/11.00',
206 'Linux',
207 'OPERA',
208 '9.80',
210 array(
211 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US) AppleWebKit/'
212 . '528.16 OmniWeb/622.8.0.112941',
213 'Mac',
214 'OMNIWEB',
215 '622',
217 array(
218 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1)',
219 'Win',
220 'IE',
221 '8.0',
223 array(
224 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)',
225 'Win',
226 'IE',
227 '9.0',
229 array(
230 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Win64; x64; '
231 . 'Trident/6.0)',
232 'Win',
233 'IE',
234 '10.0',
236 array(
237 'Mozilla/5.0 (IE 11.0; Windows NT 6.3; Trident/7.0; .NET4.0E; '
238 . '.NET4.0C; rv:11.0) like Gecko',
239 'Win',
240 'IE',
241 '11.0',
243 array(
244 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.22 (KHTML, '
245 . 'like Gecko) Chrome/25.0.1364.172 Safari/537.22',
246 'Win',
247 'CHROME',
248 '25.0.1364.172',
250 array(
251 'Mozilla/5.0 (Unknown; U; Unix BSD/SYSV system; C -) '
252 . 'AppleWebKit/527+ (KHTML, like Gecko, Safari/419.3) Arora/0.10.2',
253 'Unix',
254 'SAFARI',
255 '5.0.419',
257 array(
258 'Mozilla/5.0 (Windows; U; Win95; en-US; rv:1.9b) Gecko/20031208',
259 'Win',
260 'GECKO',
261 '1.9',
263 array(
264 'Mozilla/5.0 (compatible; Konqueror/4.5; NetBSD 5.0.2; X11; '
265 . 'amd64; en_US) KHTML/4.5.4 (like Gecko)',
266 'Other',
267 'KONQUEROR',
269 array(
270 'Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20100101 Firefox/5.0',
271 'Linux',
272 'FIREFOX',
273 '5.0',
275 array(
276 'Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20100101 '
277 . 'Firefox/12.0',
278 'Linux',
279 'FIREFOX',
280 '12.0',
283 * @todo Is this version really expected?
285 array(
286 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.4+ (KHTML, like G'
287 . 'ecko) Version/5.0 Safari/535.4+ SUSE/12.1 (3.2.1) Epiphany/3.2.1',
288 'Linux',
289 'SAFARI',
290 '5.0',
298 * test for CheckGd2
300 * @return array
302 public function testCheckGd2()
304 $prevIsGb2Val = $this->object->get('PMA_IS_GD2');
306 $this->object->set('GD2Available', 'yes');
307 $this->object->checkGd2();
308 $this->assertEquals(1, $this->object->get('PMA_IS_GD2'));
310 $this->object->set('GD2Available', 'no');
311 $this->object->checkGd2();
312 $this->assertEquals(0, $this->object->get('PMA_IS_GD2'));
314 $this->object->set('GD2Available', $prevIsGb2Val);
316 if (!@function_exists('imagecreatetruecolor')) {
317 $this->object->checkGd2();
318 $this->assertEquals(
320 $this->object->get('PMA_IS_GD2'),
321 'imagecreatetruecolor does not exist, PMA_IS_GD2 should be 0'
325 if (@function_exists('gd_info')) {
326 $this->object->checkGd2();
327 $gd_nfo = gd_info();
328 if (strstr($gd_nfo["GD Version"], '2.')) {
329 $this->assertEquals(
331 $this->object->get('PMA_IS_GD2'),
332 'GD Version >= 2, PMA_IS_GD2 should be 1'
334 } else {
335 $this->assertEquals(
337 $this->object->get('PMA_IS_GD2'),
338 'GD Version < 2, PMA_IS_GD2 should be 0'
343 /* Get GD version string from phpinfo output */
344 ob_start();
345 phpinfo(INFO_MODULES); /* Only modules */
346 $a = strip_tags(ob_get_contents());
347 ob_end_clean();
349 if (preg_match('@GD Version[[:space:]]*\(.*\)@', $a, $v)) {
350 if (strstr($v, '2.')) {
351 $this->assertEquals(
353 $this->object->get('PMA_IS_GD2'),
354 'PMA_IS_GD2 should be 1'
356 } else {
357 $this->assertEquals(
359 $this->object->get('PMA_IS_GD2'),
360 'PMA_IS_GD2 should be 0'
367 * Web server detection test
369 * @param string $server Server indentification
370 * @param boolean $iis Whether server should be detected as IIS
372 * @return void
374 * @dataProvider serverNames
376 public function testCheckWebServer($server, $iis)
378 $_SERVER['SERVER_SOFTWARE'] = $server;
379 $this->object->checkWebServer();
380 $this->assertEquals($iis, $this->object->get('PMA_IS_IIS'));
381 unset($_SERVER['SERVER_SOFTWARE']);
386 * return server names
388 * @return array
390 public function serverNames()
392 return array(
393 array(
394 "Microsoft-IIS 7.0",
397 array(
398 "Apache/2.2.17",
406 * test for CheckWebServerOs
408 * @return array
410 public function testCheckWebServerOs()
412 $this->object->checkWebServerOs();
414 if (defined('PHP_OS')) {
415 if (stristr(PHP_OS, 'darwin')) {
416 $this->assertEquals(0, $this->object->get('PMA_IS_WINDOWS'));
417 } elseif (stristr(PHP_OS, 'win')) {
418 $this->assertEquals(1, $this->object->get('PMA_IS_WINDOWS'));
419 } elseif (stristr(PHP_OS, 'OS/2')) {
420 $this->assertEquals(1, $this->object->get('PMA_IS_WINDOWS'));
421 break;
422 } elseif (stristr(PHP_OS, 'Linux')) {
423 $this->assertEquals(0, $this->object->get('PMA_IS_WINDOWS'));
424 } else {
425 $this->markTestIncomplete('Not known PHP_OS: ' . PHP_OS);
427 } else {
428 $this->assertEquals(0, $this->object->get('PMA_IS_WINDOWS'));
430 define('PHP_OS', 'Windows');
431 $this->assertEquals(1, $this->object->get('PMA_IS_WINDOWS'));
436 * test for CheckPhpVersion
438 * @return array
440 public function testCheckPhpVersion()
442 $this->object->checkPhpVersion();
444 $php_int_ver = 0;
445 $php_str_ver = phpversion();
447 $match = array();
448 preg_match(
449 '@([0-9]{1,2}).([0-9]{1,2}).([0-9]{1,2})@',
450 phpversion(),
451 $match
453 if (isset($match) && ! empty($match[1])) {
454 if (! isset($match[2])) {
455 $match[2] = 0;
457 if (! isset($match[3])) {
458 $match[3] = 0;
460 $php_int_ver = (int) sprintf(
461 '%d%02d%02d',
462 $match[1],
463 $match[2],
464 $match[3]
466 } else {
467 $php_int_ver = 0;
470 $this->assertEquals(
471 $php_str_ver,
472 $this->object->get('PMA_PHP_STR_VERSION')
474 $this->assertEquals(
475 $php_int_ver,
476 $this->object->get('PMA_PHP_INT_VERSION')
481 * Tests loading of default values
483 * @return void
485 * @group large
487 public function testLoadDefaults()
489 $prevDefaultSource = $this->object->default_source;
491 $this->object->default_source = 'unexisted.file.php';
492 $this->assertFalse($this->object->loadDefaults());
494 $this->object->default_source = $prevDefaultSource;
496 include $this->object->default_source;
498 $loadedConf = $cfg;
499 unset($cfg);
501 $this->assertTrue($this->object->loadDefaults());
503 $this->assertEquals(
504 $this->object->default_source_mtime,
505 filemtime($prevDefaultSource)
507 $this->assertEquals(
508 $loadedConf['Servers'][1],
509 $this->object->default_server
512 unset($loadedConf['Servers']);
514 $this->assertEquals($loadedConf, $this->object->default);
516 $expectedSettings = PMA_arrayMergeRecursive(
517 $this->object->settings,
518 $loadedConf
521 $this->assertEquals(
522 $expectedSettings,
523 $this->object->settings,
524 'Settings loaded wrong'
527 $this->assertFalse($this->object->error_config_default_file);
531 * test for CheckConfigSource
533 * @return array
535 public function testCheckConfigSource()
537 $this->object->setSource('unexisted.config.php');
538 $this->assertFalse($this->object->checkConfigSource());
539 $this->assertEquals(0, $this->object->source_mtime);
541 $this->object->setSource('libraries/config.default.php');
543 $this->assertNotEmpty($this->object->getSource());
544 $this->assertTrue($this->object->checkConfigSource());
548 * Test getting and setting config values
550 * @return void
552 * @covers PMA_Config::get
553 * @covers PMA_Config::set
555 public function testGetAndSet()
557 $this->assertNull($this->object->get("unresisting_setting"));
559 $this->object->set('test_setting', 'test_value');
561 $this->assertEquals('test_value', $this->object->get('test_setting'));
565 * Tests setting configuration source
567 * @return void
569 * @covers PMA_Config::getSource
570 * @covers PMA_Config::setSource
572 public function testGetSetSource()
574 echo $this->object->getSource();
576 $this->assertEmpty($this->object->getSource(), "Source is null by default");
578 $this->object->setSource("config.sample.inc.php");
580 $this->assertEquals(
581 "config.sample.inc.php",
582 $this->object->getSource(),
583 "Cant set new source"
589 * test for CheckPmaAbsoluteUriEmpty
591 * @return array
593 public function testCheckPmaAbsoluteUriEmpty()
595 $this->object->set('PmaAbsoluteUri', '');
596 $this->assertFalse(
597 $this->object->checkPmaAbsoluteUri(),
598 'PmaAbsoluteUri is not set and should be error'
600 $this->assertTrue(
601 $this->object->error_pma_uri,
602 'PmaAbsoluteUri is not set and should be error'
607 * Checks correcting of absolute URI
609 * @param string $real Real URI received
610 * @param string $expected Expected corrected URI
612 * @return void
614 * @depends testCheckPmaAbsoluteUriEmpty
615 * @dataProvider absoluteUris
617 public function testCheckPmaAbsoluteUri($real, $expected)
619 $this->object->set('PmaAbsoluteUri', $real);
620 $this->object->checkPmaAbsoluteUri();
621 $this->assertEquals($expected, $this->object->get('PmaAbsoluteUri'));
625 * return absolute Uris
627 * @return array
629 public function absoluteUris()
631 return array(
632 array(
633 'http://localhost/phpmyadmin/',
634 'http://localhost/phpmyadmin/',
636 array(
637 'http://localhost/phpmyadmin',
638 'http://localhost/phpmyadmin/',
640 array(
641 'localhost/phpmyadmin/',
642 'http://localhost/phpmyadmin/',
644 array(
645 'http://user:pwd@localhost/phpmyadmin/index.php',
646 "http://user:pwd@localhost/phpmyadmin/index.php/",
648 array(
649 'https://user:pwd@localhost/phpmyadmin/index.php',
650 "https://user:pwd@localhost/phpmyadmin/index.php/",
656 * Test for absolute URI composition
658 * @return void
660 * @depends testCheckPmaAbsoluteUri
662 public function testCheckPmaAbsoluteUriScheme()
664 $_SERVER['HTTP_HOST'] = 'localhost';
665 $_SERVER['HTTP_SCHEME'] = 'http';
666 $_SERVER['HTTPS'] = 'off';
667 $GLOBALS['PMA_PHP_SELF'] = 'index.php';
669 $this->object->set('PmaAbsoluteUri', '');
671 $this->object->checkPmaAbsoluteUri();
672 $this->assertEquals(
673 "http://localhost/",
674 $this->object->get('PmaAbsoluteUri')
679 * test for CheckCollationConnection
681 * @return array
683 public function testCheckCollationConnection()
685 $_REQUEST['collation_connection'] = 'utf-8';
686 $this->object->checkCollationConnection();
688 $this->assertEquals(
689 $_REQUEST['collation_connection'],
690 $this->object->get('collation_connection')
695 * test for IsHttp
697 * @return array
699 public function testIsHttps()
701 $this->object->set('is_https', null);
702 $this->object->set('PmaAbsoluteUri', 'http://some_host.com/phpMyAdmin');
703 $this->assertFalse($this->object->isHttps());
705 $this->object->set('is_https', null);
706 $this->object->set('PmaAbsoluteUri', 'https://some_host.com/phpMyAdmin');
707 $this->assertTrue($this->object->isHttps());
711 * test for DetectHttps
713 * @return array
715 public function testDetectHttps()
717 unset($_SERVER['REQUEST_URI']);
718 unset($_SERVER['HTTP_SCHEME']);
719 unset($_SERVER['HTTPS']);
721 $this->assertFalse($this->object->detectHttps());
723 $_SERVER['REQUEST_URI'] = '/url:\this_is_not_url';
724 $this->assertFalse($this->object->detectHttps());
726 $_SERVER['REQUEST_URI'] = 'file://localhost/phpmyadmin/index.php';
727 $this->assertFalse($this->object->detectHttps());
729 $_ENV['REQUEST_URI'] = 'http://localhost/phpmyadmin/index.php';
730 $this->assertFalse($this->object->detectHttps());
732 $_SERVER['REQUEST_URI'] = 'https://localhost/phpmyadmin/index.php';
733 $this->assertTrue($this->object->detectHttps());
735 $_SERVER['REQUEST_URI'] = 'localhost/phpmyadmin/index.php';
736 $_SERVER['HTTP_SCHEME'] = 'https';
737 $_SERVER['HTTPS'] = 'on';
738 $this->assertTrue($this->object->detectHttps());
742 * Test for checking cookie path
744 * @return void
746 * @depends testDetectHttps
748 public function testCheckCookiePath()
750 $this->object->checkCookiePath();
751 echo $this->object->get('cookie_path');
752 $this->assertEquals('', $this->object->get('cookie_path'));
756 * Test for backward compatibility globals
758 * @return void
760 * @depends testCheckSystem
761 * @depends testCheckWebServer
762 * @depends testLoadDefaults
764 * @group large
766 public function testEnableBc()
768 $this->object->enableBc();
770 $defines = array(
771 'PMA_VERSION',
772 'PMA_THEME_VERSION',
773 'PMA_THEME_GENERATION',
774 'PMA_PHP_STR_VERSION',
775 'PMA_PHP_INT_VERSION',
776 'PMA_IS_WINDOWS',
777 'PMA_IS_IIS',
778 'PMA_IS_GD2',
779 'PMA_USR_OS',
780 'PMA_USR_BROWSER_VER',
781 'PMA_USR_BROWSER_AGENT'
784 foreach ($defines as $define) {
785 $this->assertTrue(defined($define));
786 $this->assertEquals(constant($define), $this->object->get($define));
791 * Test for getting cookie path
793 * @param string $absolute The absolute URL used for phpMyAdmin
794 * @param string $expected Expected cookie path
796 * @return void
798 * @dataProvider cookieUris
800 public function testGetCookiePath($absolute, $expected)
802 $this->object->set('PmaAbsoluteUri', $absolute);
803 $this->assertEquals($expected, $this->object->getCookiePath());
807 * Data provider for testGetCookiePath
809 * @return array data for testGetCookiePath
811 public function cookieUris()
813 return array(
814 array(
815 'http://example.net/phpmyadmin/',
816 '/phpmyadmin/',
818 array(
819 'http://example.net/',
820 '/',
826 * Tests loading of config file
828 * @param string $source File name of config to load
829 * @param boolean $result Expected result of loading
831 * @return void
833 * @dataProvider configPaths
835 public function testLoad($source, $result)
837 if ($result) {
838 $this->assertTrue($this->object->load($source));
839 } else {
840 $this->assertFalse($this->object->load($source));
845 * return of config Paths
847 * @return array
849 public function configPaths()
851 return array(
852 array(
853 './test/test_data/config.inc.php',
854 true,
856 array(
857 './test/test_data/config-nonexisting.inc.php',
858 false,
860 array(
861 './libraries/config.default.php',
862 true,
868 * Test for loading user preferences
870 * @return void
871 * @todo Test actualy preferences loading
873 public function testLoadUserPreferences()
875 $this->assertNull($this->object->loadUserPreferences());
879 * Test for setting user config value
881 * @return void
883 public function testSetUserValue()
885 $this->object->setUserValue(null, 'lang', 'cs', 'en');
886 $this->object->setUserValue("TEST_COOKIE_USER_VAL", '', 'cfg_val_1');
887 $this->assertEquals(
888 $this->object->getUserValue("TEST_COOKIE_USER_VAL", 'fail'),
889 'cfg_val_1'
894 * Test for getting user config value
896 * @return void
898 public function testGetUserValue()
900 $this->assertEquals($this->object->getUserValue('test_val', 'val'), 'val');
904 * Should test getting unique value for theme
906 * @return void
907 * @todo Implement testGetThemeUniqueValue().
909 public function testGetThemeUniqueValue()
912 $_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
914 $partial_sum = (
915 PHPUnit_Framework_Assert::readAttribute($this->object, 'source_mtime') +
916 PHPUnit_Framework_Assert::readAttribute(
917 $this->object,
918 'default_source_mtime'
920 $this->object->get('user_preferences_mtime') +
921 $_SESSION['PMA_Theme']->mtime_info +
922 $_SESSION['PMA_Theme']->filesize_info
925 $this->object->set('fontsize', 10);
926 $this->assertEquals(10 + $partial_sum, $this->object->getThemeUniqueValue());
927 $this->object->set('fontsize', null);
929 $_COOKIE['pma_fontsize'] = 20;
930 $this->assertEquals(20 + $partial_sum, $this->object->getThemeUniqueValue());
931 unset($_COOKIE['pma_fontsize']);
933 $this->assertEquals($partial_sum, $this->object->getThemeUniqueValue());
938 * Should test checking of config permissions
940 * @return void
941 * @todo Implement testCheckPermissions().
943 public function testCheckPermissions()
945 // Remove the following lines when you implement this test.
946 $this->markTestIncomplete(
947 'This test has not been implemented yet.'
953 * Test for setting cookies
955 * @return void
957 public function testSetCookie()
959 $this->assertFalse(
960 $this->object->setCookie(
961 'TEST_DEF_COOKIE',
962 'test_def_123',
963 'test_def_123'
967 $this->assertTrue(
968 $this->object->setCookie(
969 'TEST_CONFIG_COOKIE',
970 'test_val_123',
971 null,
972 3600
976 $this->assertTrue(
977 $this->object->setCookie(
978 'TEST_CONFIG_COOKIE',
980 'default_val'
984 $_COOKIE['TEST_MANUAL_COOKIE'] = 'some_test_val';
985 $this->assertTrue(
986 $this->object->setCookie(
987 'TEST_MANUAL_COOKIE',
988 'other',
989 'other'
996 * Test for isGitRevision
998 * @return void
1000 public function testIsGitRevision()
1002 $this->assertTrue(
1003 $this->object->isGitRevision()
1008 * Test for Check HTTP
1010 * @group medium
1012 * @return void
1014 public function testCheckHTTP()
1016 $this->assertTrue(
1017 $this->object->checkHTTP("http://www.phpmyadmin.net/test/data")
1019 $this->assertContains(
1020 "TEST DATA",
1021 $this->object->checkHTTP("http://www.phpmyadmin.net/test/data", true)
1023 $this->assertFalse(
1024 $this->object->checkHTTP("http://www.phpmyadmin.net/test/nothing")
1029 * Tests for rewriting URL to SSL variant
1031 * @param string $original Original URL
1032 * @param string $expected Expected URL rewritten to SSL
1034 * @return void
1036 * @dataProvider sslUris
1038 public function testSSLUri($original, $expected)
1040 $this->object->set('PmaAbsoluteUri', $original);
1041 $this->assertEquals($expected, $this->object->getSSLUri());
1046 * return of ssl Uris
1048 * @return array
1050 public function sslUris()
1052 return array(
1053 array(
1054 'http://server.foo/path/',
1055 'https://server.foo:443/path/'
1057 array(
1058 'http://server.foo:80/path/',
1059 'https://server.foo:443/path/'
1061 array(
1062 'http://server.foo.bar:123/path/',
1063 'https://server.foo.bar:443/path/'
1065 array(
1066 'http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/',
1067 'https://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:443/'