there can be only ONE assert*() method in each test*() method

This commit is contained in:
Sebastian Mendel
2008-12-10 10:27:55 +00:00
parent 210265e75c
commit 71b933b7a7

View File

@@ -26,79 +26,66 @@ class PMA_cache_test extends PHPUnit_Framework_TestCase
{ {
/** /**
* temporary variable for globals array * @var array temporary variable for globals array
*/ */
protected $tmpGlobals; protected $tmpGlobals;
/** /**
* temporary variable for session array * @var array temporary variable for session array
*/ */
protected $tmpSession; protected $tmpSession;
/** /**
* storing globals and session * storing globals and session
*/ */
public function setUp() { public function setUp()
{
$this->tmpGlobals = $GLOBALS; $this->tmpGlobals = $GLOBALS;
$this->tmpSession = $_SESSION; $this->tmpSession = $_SESSION;
} }
/** /**
* cacheExists test * cacheExists test
*/ */
public function testCacheExists()
public function testCacheExists() { {
$GLOBALS['server'] = 'server'; $GLOBALS['server'] = 'server';
$_SESSION['cache']['server_server'] = array('test_data'=>1, 'test_data_2'=>2); PMA_cacheSet('test_data', 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)); $this->assertFalse(PMA_cacheExists('fake_data_2', true));
} }
/** /**
* cacheGet test * cacheGet test
*/ */
public function testCacheSetGet()
public function testCacheGet() { {
$GLOBALS['server'] = 'server'; $GLOBALS['server'] = 'server';
$_SESSION['cache']['server_server'] = array('test_data'=>1, 'test_data_2'=>2); PMA_cacheSet('test_data', 25, true);
$this->assertNotNull(PMA_cacheGet('test_data', true)); $this->assertNotNull(PMA_cacheGet('test_data', true));
$this->assertNotNull(PMA_cacheGet('test_data_2', 'server'));
$this->assertNull(PMA_cacheGet('fake_data_2', true));
}
/**
* cacheSet test
*/
public function testCacheSet() {
$GLOBALS['server'] = 'server';
$_SESSION['cache']['server_server'] = array('test_data'=>1, 'test_data_2'=>2);
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 * cacheUnset test
*/ */
public function testCacheUnSet()
public function testCacheUnSet() { {
$GLOBALS['server'] = 'server'; $GLOBALS['server'] = 'server';
$_SESSION['cache']['server_server'] = array('test_data'=>1, 'test_data_2'=>2); PMA_cacheSet('test_data', 25, true);
PMA_cacheUnset('test_data', true); PMA_cacheUnset('test_data', true);
$this->assertNull($_SESSION['cache']['server_server']['test_data']); $this->assertFalse(PMA_cacheExists('test_data', true));
PMA_cacheUnset('test_data_2', true);
$this->assertNull($_SESSION['cache']['server_server']['test_data_2']);
} }
} }
?> ?>