1# Test
2
3## Data Directory
4
5The [data](data) folder contains pages and images that are
6used for a visual control.
7
8There is a [script called copy_visuals](../copy_visuals.cmd)
9to copy this files from the dokuwiki data directory to this test directory.
10
11
12## Features
13
14TODO ? Use the visual page to test ?
15
16Example in a setUp function
17
18```php
19const DOKU_DATA_DIR = '/dokudata/pages';
20const DOKU_CACHE_DIR = '/dokudata/cache';
21
22// Otherwise the page are created in a tmp dir
23// ie C:\Users\gerard\AppData\Local\Temp/dwtests-1550072121.2716/data/
24// and we cannot visualize them
25// This is not on the savedir conf value level because it has no effect on the datadir value
26$conf['datadir'] = getcwd() . self::DOKU_DATA_DIR;
27// Create the dir
28if (!file_exists($conf['datadir'])) {
29    mkdir($conf['datadir'], $mode = 0777, $recursive = true);
30}
31$conf['cachetime'] = -1;
32$conf['allowdebug'] = 1; // log in cachedir+debug.log
33$conf['cachedir'] = getcwd() . self::DOKU_CACHE_DIR;
34if (!file_exists($conf['cachedir'])) {
35    mkdir($conf['cachedir'], $mode = 0777, $recursive = true);
36}
37```