From 2e28269baed195d58bbe169841eed176b171db76 Mon Sep 17 00:00:00 2001 From: VirtualTam Date: Wed, 11 Nov 2015 22:49:58 +0100 Subject: install: check file/directory permissions for Shaarli resources Relates to #40 Relates to #372 Additions: - FileUtils: IOException - ApplicationUtils: - check if Shaarli resources are accessible with sufficient permissions - basic test coverage - index.php: - check access permissions and redirect to an error page if needed: - before running the first installation Modifications: - LinkDB: - factorize datastore write code - check if the datastore (exists AND is writeable) OR (doesn't exist AND its parent dir is writable) - raise an IOException if needed Signed-off-by: VirtualTam --- tests/LinkDBTest.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'tests/LinkDBTest.php') diff --git a/tests/LinkDBTest.php b/tests/LinkDBTest.php index 451f1d6f..8929713d 100644 --- a/tests/LinkDBTest.php +++ b/tests/LinkDBTest.php @@ -4,6 +4,7 @@ */ require_once 'application/Cache.php'; +require_once 'application/FileUtils.php'; require_once 'application/LinkDB.php'; require_once 'application/Utils.php'; require_once 'tests/utils/ReferenceLinkDB.php'; @@ -87,8 +88,8 @@ class LinkDBTest extends PHPUnit_Framework_TestCase /** * Attempt to instantiate a LinkDB whereas the datastore is not writable * - * @expectedException PHPUnit_Framework_Error_Warning - * @expectedExceptionMessageRegExp /failed to open stream: No such file or directory/ + * @expectedException IOException + * @expectedExceptionMessageRegExp /Error accessing null/ */ public function testConstructDatastoreNotWriteable() { -- cgit v1.2.3