3 * ApplicationUtils' tests
6 require_once 'application/ApplicationUtils.php';
10 * Unitary tests for Shaarli utilities
12 class ApplicationUtilsTest
extends PHPUnit_Framework_TestCase
15 * Checks resource permissions for the current Shaarli installation
17 public function testCheckCurrentResourcePermissions()
20 'CACHEDIR' => 'cache',
21 'CONFIG_FILE' => 'data/config.php',
23 'DATASTORE' => 'data/datastore.php',
24 'IPBANS_FILENAME' => 'data/ipbans.php',
25 'LOG_FILE' => 'data/log.txt',
26 'PAGECACHE' => 'pagecache',
27 'RAINTPL_TMP' => 'tmp',
28 'RAINTPL_TPL' => 'tpl',
29 'UPDATECHECK_FILENAME' => 'data/lastupdatecheck.txt'
33 ApplicationUtils
::checkResourcePermissions($config)
38 * Checks resource permissions for a non-existent Shaarli installation
40 public function testCheckCurrentResourcePermissionsErrors()
43 'CACHEDIR' => 'null/cache',
44 'CONFIG_FILE' => 'null/data/config.php',
45 'DATADIR' => 'null/data',
46 'DATASTORE' => 'null/data/store.php',
47 'IPBANS_FILENAME' => 'null/data/ipbans.php',
48 'LOG_FILE' => 'null/data/log.txt',
49 'PAGECACHE' => 'null/pagecache',
50 'RAINTPL_TMP' => 'null/tmp',
51 'RAINTPL_TPL' => 'null/tpl',
52 'UPDATECHECK_FILENAME' => 'null/data/lastupdatecheck.txt'
56 '"null/tpl" directory is not readable',
57 '"null/cache" directory is not readable',
58 '"null/cache" directory is not writable',
59 '"null/data" directory is not readable',
60 '"null/data" directory is not writable',
61 '"null/pagecache" directory is not readable',
62 '"null/pagecache" directory is not writable',
63 '"null/tmp" directory is not readable',
64 '"null/tmp" directory is not writable'
66 ApplicationUtils
::checkResourcePermissions($config)