1<?php
2
3
4/**
5 * Test cases for the move plugin
6 *
7 * @group plugin_move
8 * @group plugins
9 */
10class plugin_move_affectedPagesNS_test extends DokuWikiTest {
11
12    protected $pluginsEnabled = array('move',);
13
14    public function setUp(): void {
15        parent::setUp();
16        global $USERINFO;
17        global $conf;
18        $conf['useacl']    = 1;
19        $conf['superuser'] = 'john';
20        $_SERVER['REMOTE_USER'] = 'john'; //now it's testing as admin
21        $USERINFO['grps'] = array('admin','user');
22    }
23
24    /**
25     * @coversNothing
26     */
27    public function tearDown(): void {
28        /** @var helper_plugin_move_plan $plan  */
29        $plan = plugin_load('helper', 'move_plan');
30        $plan->abort();
31        parent::tearDown();
32    }
33
34    /**
35     * @covers helper_plugin_move_plan::findAffectedPages
36     * @uses Doku_Indexer
37     */
38    public function test_affectedPagesNS_Media() {
39
40        saveWikiText('oldns:start', '{{oldnsimage_missing.png}}', 'setup');
41        idx_addPage('oldns:start');
42
43        /** @var helper_plugin_move_plan $plan */
44        $plan = plugin_load('helper','move_plan');
45
46        $this->assertFalse($plan->inProgress());
47
48        $plan->addMediaNamespaceMove('oldns', 'newns');
49
50        $plan->commit();
51
52        $affected_file = file(TMP_DIR . '/data/meta/__move_affected');
53
54        $this->assertSame('oldns:start',trim($affected_file[0]));
55
56    }
57
58}
59