application: refactor version checks, move to ApplicationUtils

Relates to 

Modifications:
 - move checkUpdate() to ApplicationUtils
 - reduce file I/O operations during version checks
 - apply coding conventions
 - add test coverage

Tools:
 - create a sandbox directory for tests

Signed-off-by: VirtualTam <virtualtam@flibidi.net>
This commit is contained in:
VirtualTam 2015-11-24 02:52:22 +01:00
parent 61873e3ded
commit 4bf35ba56b
8 changed files with 331 additions and 35 deletions

View file

@ -11,10 +11,10 @@ require_once 'application/Cache.php';
/**
* Unitary tests for cached pages
*/
class CachedTest extends PHPUnit_Framework_TestCase
class CacheTest extends PHPUnit_Framework_TestCase
{
// test cache directory
protected static $testCacheDir = 'tests/dummycache';
protected static $testCacheDir = 'sandbox/dummycache';
// dummy cached file names / content
protected static $pages = array('a', 'toto', 'd7b59c');
@ -56,7 +56,7 @@ class CachedTest extends PHPUnit_Framework_TestCase
public function testPurgeCachedPagesMissingDir()
{
$this->assertEquals(
'Cannot purge tests/dummycache_missing: no directory',
'Cannot purge sandbox/dummycache_missing: no directory',
purgeCachedPages(self::$testCacheDir.'_missing')
);
}