my fault, of course it is allowed to have more than one assert* in a test* method (it just stops executing on the first failed assert)
This commit is contained in:
@@ -45,47 +45,60 @@ class PMA_cache_test extends PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cacheExists test
|
* Test if cached data is available after set
|
||||||
*/
|
*/
|
||||||
public function testCacheExists()
|
public function testCacheExists()
|
||||||
{
|
{
|
||||||
$GLOBALS['server'] = 'server';
|
$GLOBALS['server'] = 'server';
|
||||||
PMA_cacheSet('test_data', 5, true);
|
PMA_cacheSet('test_data', 5, true);
|
||||||
|
PMA_cacheSet('test_data_2', 5, true);
|
||||||
|
|
||||||
$this->assertTrue(PMA_cacheExists('test_data', 'server'));
|
$this->assertTrue(PMA_cacheExists('test_data', true));
|
||||||
}
|
$this->assertTrue(PMA_cacheExists('test_data_2', 'server'));
|
||||||
|
|
||||||
/**
|
|
||||||
* cacheNotExists test
|
|
||||||
*/
|
|
||||||
public function testCacheNotExists()
|
|
||||||
{
|
|
||||||
$GLOBALS['server'] = 'server';
|
|
||||||
PMA_cacheSet('test_data', 5, true);
|
|
||||||
|
|
||||||
$this->assertFalse(PMA_cacheExists('fake_data_2', true));
|
$this->assertFalse(PMA_cacheExists('fake_data_2', true));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cacheGet test
|
* Test if cacheGet does not return data for non existing caache entries
|
||||||
|
*/
|
||||||
|
public function testCacheGet()
|
||||||
|
{
|
||||||
|
$GLOBALS['server'] = 'server';
|
||||||
|
PMA_cacheSet('test_data', 5, true);
|
||||||
|
PMA_cacheSet('test_data_2', 5, true);
|
||||||
|
|
||||||
|
$this->assertNotNull(PMA_cacheGet('test_data', true));
|
||||||
|
$this->assertNotNull(PMA_cacheGet('test_data_2', 'server'));
|
||||||
|
$this->assertNull(PMA_cacheGet('fake_data_2', true));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test retrieval of cached data
|
||||||
*/
|
*/
|
||||||
public function testCacheSetGet()
|
public function testCacheSetGet()
|
||||||
{
|
{
|
||||||
$GLOBALS['server'] = 'server';
|
$GLOBALS['server'] = 'server';
|
||||||
PMA_cacheSet('test_data', 25, true);
|
PMA_cacheSet('test_data', 25, true);
|
||||||
|
|
||||||
$this->assertNotNull(PMA_cacheGet('test_data', true));
|
PMA_cacheSet('test_data', 5, true);
|
||||||
|
$this->assertEquals(5, $_SESSION['cache']['server_server']['test_data']);
|
||||||
|
PMA_cacheSet('test_data_3', 3, true);
|
||||||
|
$this->assertEquals(3, $_SESSION['cache']['server_server']['test_data_3']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cacheUnset test
|
* Test clearing cached values
|
||||||
*/
|
*/
|
||||||
public function testCacheUnSet()
|
public function testCacheUnSet()
|
||||||
{
|
{
|
||||||
$GLOBALS['server'] = 'server';
|
$GLOBALS['server'] = 'server';
|
||||||
PMA_cacheSet('test_data', 25, true);
|
PMA_cacheSet('test_data', 25, true);
|
||||||
|
PMA_cacheSet('test_data_2', 25, true);
|
||||||
|
|
||||||
PMA_cacheUnset('test_data', true);
|
PMA_cacheUnset('test_data', true);
|
||||||
$this->assertFalse(PMA_cacheExists('test_data', true));
|
$this->assertArrayNotHasKey('test_data', $_SESSION['cache']['server_server']);
|
||||||
|
PMA_cacheUnset('test_data_2', true);
|
||||||
|
$this->assertArrayNotHasKey('test_data_2', $_SESSION['cache']['server_server']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@@ -92,7 +92,7 @@ class PMA_showHint_test extends PHPUnit_Framework_TestCase
|
|||||||
$nr = 1;
|
$nr = 1;
|
||||||
$instance = 1;
|
$instance = 1;
|
||||||
|
|
||||||
PMA_showHint('test', false, 'notice');
|
$this->assertEquals(sprintf('<sup class="footnotemarker" id="footnote_sup_%d_%d">%d</sup>', $nr, $instance, $nr), PMA_showHint('test', false, 'notice'));
|
||||||
|
|
||||||
$expArray = array(
|
$expArray = array(
|
||||||
'note' => 'test',
|
'note' => 'test',
|
||||||
@@ -113,7 +113,7 @@ class PMA_showHint_test extends PHPUnit_Framework_TestCase
|
|||||||
$nr = 1;
|
$nr = 1;
|
||||||
$instance = 1;
|
$instance = 1;
|
||||||
|
|
||||||
PMA_showHint('test', true, 'notice');
|
$this->assertEquals(sprintf('[sup]%d[/sup]', $nr), PMA_showHint('test', true, 'notice'));
|
||||||
|
|
||||||
$expArray = array(
|
$expArray = array(
|
||||||
'note' => 'test',
|
'note' => 'test',
|
||||||
@@ -160,7 +160,7 @@ class PMA_showHint_test extends PHPUnit_Framework_TestCase
|
|||||||
$oMock->setMessage('test');
|
$oMock->setMessage('test');
|
||||||
$oMock->setNumber($nr);
|
$oMock->setNumber($nr);
|
||||||
|
|
||||||
PMA_showHint($oMock, false);
|
$this->assertEquals(sprintf('<sup class="footnotemarker" id="footnote_sup_%d_%d">%d</sup>', $nr, $instance, $nr), PMA_showHint($oMock, false));
|
||||||
|
|
||||||
$key = $oMock->getHash();
|
$key = $oMock->getHash();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user