Skip to content

Commit

Permalink
Standardize test structure in cache storage ctests
Browse files Browse the repository at this point in the history
  • Loading branch information
mbabker committed Sep 17, 2014
1 parent 854d07f commit 3c18872
Show file tree
Hide file tree
Showing 11 changed files with 879 additions and 435 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,67 +13,64 @@
*
* @package Joomla.UnitTest
* @subpackage Cache
*
* @since 11.1
*/
class JCacheStorageApcTest extends PHPUnit_Framework_TestCase
{
/**
* @var JCacheStorageApc
* @access protected
*/
protected $object;

/**
* @var apcAvailable
* @access protected
* @var boolean
*/
protected $apcAvailable;
protected $extensionAvailable;

/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*
* @return void
* @return void
*/
protected function setUp()
{
parent::setUp();

include_once JPATH_PLATFORM . '/joomla/cache/storage.php';
include_once JPATH_PLATFORM . '/joomla/cache/storage/apc.php';
$this->extensionAvailable = extension_loaded('apc');

$this->object = JCacheStorage::getInstance('apc');
$this->apcAvailable = extension_loaded('apc');
if ($this->extensionAvailable)
{
$this->object = JCacheStorage::getInstance('apc');
}
else
{
$this->markTestSkipped('This caching method is not supported on this system.');
}
}

/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
* Test...
*
* @todo Implement testGet().
*
* @return void
*/
protected function tearDown()
public function testGet()
{
$this->markTestIncomplete('This test has not been implemented yet.');
}

/**
* Test...
*
* @todo Implement testGet().
* @todo Implement testGetAll().
*
* @return void
*/
public function testGet()
public function testGetAll()
{
if ($this->apcAvailable)
{
$this->markTestIncomplete('This test has not been implemented yet.');
}
else
{
$this->markTestSkipped('This caching method is not supported on this system.');
}
$this->markTestIncomplete('This test has not been implemented yet.');
}

/**
Expand All @@ -85,14 +82,7 @@ public function testGet()
*/
public function testStore()
{
if ($this->apcAvailable)
{
$this->markTestIncomplete('This test has not been implemented yet.');
}
else
{
$this->markTestSkipped('This caching method is not supported on this system.');
}
$this->markTestIncomplete('This test has not been implemented yet.');
}

/**
Expand All @@ -104,14 +94,7 @@ public function testStore()
*/
public function testRemove()
{
if ($this->apcAvailable)
{
$this->markTestIncomplete('This test has not been implemented yet.');
}
else
{
$this->markTestSkipped('This caching method is not supported on this system.');
}
$this->markTestIncomplete('This test has not been implemented yet.');
}

/**
Expand All @@ -123,47 +106,57 @@ public function testRemove()
*/
public function testClean()
{
if ($this->apcAvailable)
{
$this->markTestIncomplete('This test has not been implemented yet.');
}
else
{
$this->markTestSkipped('This caching method is not supported on this system.');
}
$this->markTestIncomplete('This test has not been implemented yet.');
}

/**
* Testing isSupported().
* Test...
*
* @todo Implement testGc().
*
* @return void
*/
public function testGc()
{
$this->markTestIncomplete('This test has not been implemented yet.');
}

/**
* Testing isSupported().
*
* @return void
*/
public function testIsSupported()
{
$this->assertThat(
$this->assertEquals(
$this->extensionAvailable,
$this->object->isSupported(),
$this->equalTo($this->apcAvailable),
'Claims APC is not loaded.'
);
}

/**
* Test...
*
* @todo Implement test_setExpire().
* @todo Implement testLock().
*
* @return void
*/
public function testSetExpire()
public function testLock()
{
if ($this->apcAvailable)
{
$this->markTestIncomplete('This test has not been implemented yet.');
}
else
{
$this->markTestSkipped('This caching method is not supported on this system.');
}
$this->markTestIncomplete('This test has not been implemented yet.');
}

/**
* Test...
*
* @todo Implement testUnlock().
*
* @return void
*/
public function testUnlock()
{
$this->markTestIncomplete('This test has not been implemented yet.');
}

/**
Expand All @@ -175,13 +168,6 @@ public function testSetExpire()
*/
public function testGetCacheId()
{
if ($this->apcAvailable)
{
$this->markTestIncomplete('This test has not been implemented yet.');
}
else
{
$this->markTestSkipped('This caching method is not supported on this system.');
}
$this->markTestIncomplete('This test has not been implemented yet.');
}
}
Loading

0 comments on commit 3c18872

Please sign in to comment.