1<?php
2/**
3 * @group plugin_ajaxedit
4 * @group plugins
5 */
6class plugin_ajax_helper_test extends DokuWikiTest {
7
8    private $h = null;
9    public function setup() {
10        $this->pluginsEnabled[] = 'ajaxedit';
11        parent::setup();
12        $this->h = plugin_load('helper','ajaxedit');
13    }
14
15    public function test_get_wikiFile() {
16        global $INFO;
17        $_POST['pageid'] = 'wiki:dokuwiki';
18        $_POST['lastmod'] = @filemtime(wikiFn('wiki:dokuwiki'));
19        $wiki = $this->h->getWikiPage();
20        $this->assertContains('DokuWiki',$wiki);
21    }
22
23    public function test_get_wikiFile_oldlastmod() {
24        global $INFO;
25        $_POST['pageid'] = 'wiki:dokuwiki';
26        $_POST['lastmod'] = @filemtime(wikiFn('wiki:dokuwiki')) -1;
27
28        ob_start();
29        $this->h->getWikiPage();
30        $wiki = ob_get_contents();
31        ob_end_clean();
32        $this->assertContains('The page has just been edited',$wiki);
33    }
34}
35