1 <?php
2 
3 // must be run within Dokuwiki
4 if (!defined('DOKU_INC')) die();
5 
6 /**
7  * Test cases for the move plugin
8  *
9  * @group plugin_move
10  * @group plugins
11  */
12 class plugin_move_cache_handling_test extends DokuWikiTest {
13 
14     function setUp(): void {
15         parent::setUpBeforeClass();
16         $this->pluginsEnabled[] = 'move';
17         parent::setUp();
18     }
19 
20     /**
21      * @group slow
22      */
23     function test_cache_handling() {
24         $testid = 'wiki:bar:test';
25         saveWikiText($testid,
26             '[[wiki:foo:]]', 'Test setup');
27         idx_addPage($testid);
28         saveWikiText('wiki:foo:start',
29             'bar', 'Test setup');
30         idx_addPage('wiki:foo:start');
31 
32         sleep(1); // wait in order to make sure that conditions with < give the right result.
33         p_wiki_xhtml($testid); // populate cache
34 
35         $cache = new cache_renderer($testid, wikiFN($testid), 'xhtml');
36         $this->assertTrue($cache->useCache());
37 
38         /** @var helper_plugin_move_op $move */
39         $move = plugin_load('helper', 'move_op');
40         $this->assertTrue($move->movePage('wiki:foo:start', 'wiki:foo2:start'));
41 
42         $cache = new cache_renderer($testid, wikiFN($testid), 'xhtml');
43         $this->assertFalse($cache->useCache());
44 
45     }
46 
47 }
48