Fix two minor bugs, updating Phorum and removing unused $dir variable.
[htmlpurifier/darkodev.git] / tests / HTMLPurifier / DefinitionCacheTest.php
blob5ad2ff9cb98d8520d4a6dbbdb784fab907db37e3
1 <?php
3 class HTMLPurifier_DefinitionCacheTest extends HTMLPurifier_Harness
6 function test_isOld() {
7 // using null subclass because parent is abstract
8 $cache = new HTMLPurifier_DefinitionCache_Null('Test');
10 generate_mock_once('HTMLPurifier_Config');
11 $config = new HTMLPurifier_ConfigMock();
12 $config->version = '1.0.0'; // hopefully no conflicts
13 $config->setReturnValue('get', 10, array('Test.DefinitionRev'));
14 $config->setReturnValue('getBatchSerial', 'hash', array('Test'));
16 $this->assertIdentical($cache->isOld('1.0.0,hash,10', $config), false);
17 $this->assertIdentical($cache->isOld('1.5.0,hash,1', $config), true);
19 $this->assertIdentical($cache->isOld('0.9.0,hash,1', $config), true);
20 $this->assertIdentical($cache->isOld('1.0.0,hash,1', $config), true);
21 $this->assertIdentical($cache->isOld('1.0.0beta,hash,11', $config), true);
23 $this->assertIdentical($cache->isOld('0.9.0,hash2,1', $config), true);
24 $this->assertIdentical($cache->isOld('1.0.0,hash2,1', $config), false); // if hash is different, don't touch!
25 $this->assertIdentical($cache->isOld('1.0.0beta,hash2,11', $config), true);
26 $this->assertIdentical($cache->isOld('1.0.0-dev,hash2,11', $config), true);
32 // vim: et sw=4 sts=4