Merge branch 'master' of git://phpmyadmin.git.sourceforge.net/gitroot/phpmyadmin...
[phpmyadmin/thilanka.git] / test / libraries / core / PMA_warnMissingExtension_test.php
bloba0f15254fe2be16925a84e9c62b90c30806d4208
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Test for PMA_warnMissingExtension() from libraries/core.lib.php
5 * PMA_warnMissingExtension warns or fails on missing extension.
7 * @package phpMyAdmin-test
8 */
11 * Include to test.
13 require_once 'libraries/core.lib.php';
15 class PMA_warnMissingExtension_test extends PHPUnit_Framework_TestCase
18 function testMissingExtention(){
19 $ext = 'php_ext';
20 $this->setExpectedException('PHPUnit_Framework_Error',
21 'The [a@'.PMA_getPHPDocLink('book.' . $ext . '.php').'@Documentation][em]'.$ext.'[/em][/a] extension is missing. Please check your PHP configuration.');
22 PMA_warnMissingExtension($ext);
25 function testMissingExtentionFatal(){
26 $ext = 'php_ext';
27 $warn = 'The <a href="'.PMA_linkURL(PMA_getPHPDocLink('book.' . $ext . '.php')).'" target="Documentation"><em>'.$ext.'</em></a> extension is missing. Please check your PHP configuration.';
29 ob_start();
30 PMA_warnMissingExtension($ext,true);
31 $printed = ob_get_contents();
32 ob_end_clean();
34 $this->assertGreaterThan(0,strpos($printed,$warn));
37 function testMissingExtentionFatalWithExtra(){
38 $ext = 'php_ext';
39 $extra = 'Appended Extra String';
41 $warn = 'The <a href="'.PMA_linkURL(PMA_getPHPDocLink('book.' . $ext . '.php')).'" target="Documentation"><em>'.$ext.'</em></a> extension is missing. Please check your PHP configuration.'.' '.$extra;
43 ob_start();
44 PMA_warnMissingExtension($ext,true,$extra);
45 $printed = ob_get_contents();
46 ob_end_clean();
48 $this->assertGreaterThan(0,strpos($printed,$warn));
51 function testMissingExtentionWithExtra(){
52 $ext = 'php_ext';
53 $extra = 'Appended Extra String';
54 $this->setExpectedException('PHPUnit_Framework_Error',
55 'The [a@'.PMA_getPHPDocLink('book.' . $ext . '.php').'@Documentation][em]'.$ext.'[/em][/a] extension is missing. Please check your PHP configuration.'.' '.$extra);
56 PMA_warnMissingExtension($ext,false,$extra);
57 $this->assertTrue(true);