Skip to content

Commit

Permalink
Test for PMA_getPageName()
Browse files Browse the repository at this point in the history
Signed-off-by: Bimal Yashodha <kb.yashodha@gmail.com>
  • Loading branch information
kb-yashodha committed Jun 19, 2014
1 parent 6f7040f commit f470b2f
Showing 1 changed file with 35 additions and 2 deletions.
37 changes: 35 additions & 2 deletions test/libraries/PMA_PMD_common_test.php
Expand Up @@ -5,6 +5,10 @@
* @package PhpMyAdmin-test
*/

require_once 'libraries/database_interface.inc.php';
require_once 'libraries/Util.class.php';
require_once 'libraries/php-gettext/gettext.inc';

/**
* Tests for libraries/pmd_common.php
*
Expand All @@ -21,6 +25,7 @@ class PMA_PMD_CommonTest extends PHPUnit_Framework_TestCase
public function setup()
{
$GLOBALS['server'] = 1;
$GLOBALS['controllink'] = 2;
$_SESSION = array(
'relation' => array(
'1' => array(
Expand All @@ -34,8 +39,6 @@ public function setup()

require_once 'libraries/relation.lib.php';
require_once 'libraries/pmd_common.php';
require_once 'libraries/database_interface.inc.php';
require_once 'libraries/Util.class.php';
}


Expand Down Expand Up @@ -71,5 +74,35 @@ public function testGetTablePositions()

PMA_getTablePositions($pg);
}

/**
* Test for PMA_getPageName()
*
* @return void
*/
public function testGetPageName()
{
$pg = 1;
$pageName = 'pageName';

$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();

$dbi->expects($this->at(0))
->method('fetchResult')
->with("SELECT `page_descr` FROM `pmadb`.`pdf_pages` WHERE `page_nr` = " . $pg,
null,
null,
2,
PMA_DatabaseInterface::QUERY_STORE
)
->will($this->returnValue(array($pageName)));
$GLOBALS['dbi'] = $dbi;

$result = PMA_getPageName($pg);

$this->assertEquals($pageName, $result);
}
}
?>

0 comments on commit f470b2f

Please sign in to comment.