Add vim modelines to all files.
[htmlpurifier/bfroehle.git] / tests / HTMLPurifier / DefinitionCache / Decorator / CleanupTest.php
blobafcb0e39f9f062d27cb41f78e2d3884bd8a3bb06
1 <?php
3 generate_mock_once('HTMLPurifier_DefinitionCache');
5 class HTMLPurifier_DefinitionCache_Decorator_CleanupTest extends HTMLPurifier_DefinitionCache_DecoratorHarness
8 function setup() {
9 $this->cache = new HTMLPurifier_DefinitionCache_Decorator_Cleanup();
10 parent::setup();
13 function setupMockForSuccess($op) {
14 $this->mock->expectOnce($op, array($this->def, $this->config));
15 $this->mock->setReturnValue($op, true, array($this->def, $this->config));
16 $this->mock->expectNever('cleanup');
19 function setupMockForFailure($op) {
20 $this->mock->expectOnce($op, array($this->def, $this->config));
21 $this->mock->setReturnValue($op, false, array($this->def, $this->config));
22 $this->mock->expectOnce('cleanup', array($this->config));
25 function test_get() {
26 $this->mock->expectOnce('get', array($this->config));
27 $this->mock->setReturnValue('get', true, array($this->config));
28 $this->mock->expectNever('cleanup');
29 $this->assertEqual($this->cache->get($this->config), $this->def);
32 function test_get_failure() {
33 $this->mock->expectOnce('get', array($this->config));
34 $this->mock->setReturnValue('get', false, array($this->config));
35 $this->mock->expectOnce('cleanup', array($this->config));
36 $this->assertEqual($this->cache->get($this->config), false);
39 function test_set() {
40 $this->setupMockForSuccess('set');
41 $this->assertEqual($this->cache->set($this->def, $this->config), true);
44 function test_replace() {
45 $this->setupMockForSuccess('replace');
46 $this->assertEqual($this->cache->replace($this->def, $this->config), true);
49 function test_add() {
50 $this->setupMockForSuccess('add');
51 $this->assertEqual($this->cache->add($this->def, $this->config), true);
56 // vim: et sw=4 sts=4