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:
Sebastian Mendel
2008-12-10 13:07:24 +00:00
parent 6d00fcb4ba
commit ce1d25289d
2 changed files with 32 additions and 19 deletions

View File

@@ -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()
{
$GLOBALS['server'] = 'server';
PMA_cacheSet('test_data', 5, true);
PMA_cacheSet('test_data_2', 5, true);
$this->assertTrue(PMA_cacheExists('test_data', 'server'));
}
/**
* cacheNotExists test
*/
public function testCacheNotExists()
{
$GLOBALS['server'] = 'server';
PMA_cacheSet('test_data', 5, true);
$this->assertTrue(PMA_cacheExists('test_data', true));
$this->assertTrue(PMA_cacheExists('test_data_2', 'server'));
$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()
{
$GLOBALS['server'] = 'server';
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()
{
$GLOBALS['server'] = 'server';
PMA_cacheSet('test_data', 25, true);
PMA_cacheSet('test_data_2', 25, 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']);
}
}
?>

View File

@@ -92,7 +92,7 @@ class PMA_showHint_test extends PHPUnit_Framework_TestCase
$nr = 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(
'note' => 'test',
@@ -113,7 +113,7 @@ class PMA_showHint_test extends PHPUnit_Framework_TestCase
$nr = 1;
$instance = 1;
PMA_showHint('test', true, 'notice');
$this->assertEquals(sprintf('[sup]%d[/sup]', $nr), PMA_showHint('test', true, 'notice'));
$expArray = array(
'note' => 'test',
@@ -160,7 +160,7 @@ class PMA_showHint_test extends PHPUnit_Framework_TestCase
$oMock->setMessage('test');
$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();