Translation update done using Pootle.
[phpmyadmin/ammaryasirr.git] / test / libraries / core / PMA_getLinks_test.php
blob59aac3e24015b4aa2ea457ebe6dc40f3a12d7984
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Test for PMA_getPHPDocLink, PMA_linkURL, PMA_includeJS from libraries/core.lib.php
6 * @package phpMyAdmin-test
7 */
9 /*
10 * Include to 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(){
24 return array(
25 array('http://wiki.phpmyadmin.net', './url.php?url=http%3A%2F%2Fwiki.phpmyadmin.net&amp;lang=en'),
26 array('https://wiki.phpmyadmin.net', './url.php?url=https%3A%2F%2Fwiki.phpmyadmin.net&amp;lang=en'),
27 array('wiki.phpmyadmin.net', 'wiki.phpmyadmin.net'),
28 array('index.php?db=phpmyadmin', 'index.php?db=phpmyadmin')
32 /**
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";
42 $mod = 0;
44 if (file_exists('./js/'.$filename)) {
45 $mod = filemtime('./js/'.$filename);
47 else{
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));