2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * Test for PMA_getPHPDocLink, PMA_linkURL, PMA_includeJS from libraries/core.lib.php
6 * @package phpMyAdmin-test
12 require_once 'libraries/core.lib.php';
13 require_once 'libraries/url_generating.lib.php';
15 class PMA_getLinks_test
extends PHPUnit_Framework_TestCase
17 public function testPMA_getPHPDocLink()
19 $lang = _pgettext('PHP documentation language', 'en');
20 $this->assertEquals(PMA_getPHPDocLink('function'), 'http://php.net/manual/' . $lang . '/function');
23 public function providerLinkURL(){
25 array('http://wiki.phpmyadmin.net', './url.php?url=http%3A%2F%2Fwiki.phpmyadmin.net&lang=en'),
26 array('https://wiki.phpmyadmin.net', './url.php?url=https%3A%2F%2Fwiki.phpmyadmin.net&lang=en'),
27 array('wiki.phpmyadmin.net', 'wiki.phpmyadmin.net'),
28 array('index.php?db=phpmyadmin', 'index.php?db=phpmyadmin')
33 * @dataProvider providerLinkURL
35 public function testPMA_linkURL($link, $url){
36 $this->assertEquals(PMA_linkURL($link), $url);
39 public function testPMA_includeJS()
41 $filename = "common.js";
44 if (file_exists('./js/'.$filename)) {
45 $mod = filemtime('./js/'.$filename);
48 $this->fail("JS file doesn't exists.");
50 $this->assertEquals(PMA_includeJS($filename), '<script src="./js/'.$filename.'?ts='.$mod.'" type="text/javascript"></script>'. "\n");
52 $filename = '?file.js';
53 //$this->assertEquals(PMA_includeJS($filename), '<script src="./js/?file.js" type="text/javascript"></script>\n');
54 $this->assertEquals(PMA_includeJS($filename), '<script src="./js/'.$filename.'" type="text/javascript"></script>'."\n");
56 //$this->assertFalse(PMA_includeJS(null));