<?php
+use Shaarli\Exceptions\IOException;
+
require_once 'exceptions/IOException.php';
/**
<?php
+
+use Shaarli\Exceptions\IOException;
+
/**
* Data storage for links.
*
use Shaarli\Config\ConfigJson;
use Shaarli\Config\ConfigPhp;
use Shaarli\Config\ConfigManager;
+use Shaarli\Exceptions\IOException;
use Shaarli\Thumbnailer;
/**
$print = defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : 0;
$data = self::getPhpHeaders() . json_encode($conf, $print) . self::getPhpSuffix();
if (!file_put_contents($filepath, $data)) {
- throw new \IOException(
+ throw new \Shaarli\Exceptions\IOException(
$filepath,
t('Shaarli could not create the config file. '.
'Please make sure Shaarli has the right to write in the folder is it installed in.')
*
* @throws MissingFieldConfigException: a mandatory field has not been provided in $conf.
* @throws UnauthorizedConfigException: user is not authorize to change configuration.
- * @throws \IOException: an error occurred while writing the new config file.
+ * @throws \Shaarli\Exceptions\IOException: an error occurred while writing the new config file.
*/
public function write($isLoggedIn)
{
if (!file_put_contents($filepath, $configStr)
|| strcmp(file_get_contents($filepath), $configStr) != 0
) {
- throw new \IOException(
+ throw new \Shaarli\Exceptions\IOException(
$filepath,
t('Shaarli could not create the config file. '.
'Please make sure Shaarli has the right to write in the folder is it installed in.')
<?php
+namespace Shaarli\Exceptions;
+
+use Exception;
/**
* Exception class thrown when a filesystem access failure happens
{
$this->path = $path;
$this->message = empty($message) ? t('Error accessing') : $message;
- $this->message .= ' "' . $this->path .'"';
+ $this->message .= ' "' . $this->path . '"';
}
}
"Shaarli\\Api\\Exceptions\\": "application/api/exceptions",
"Shaarli\\Config\\": "application/config/",
"Shaarli\\Config\\Exception\\": "application/config/exception",
+ "Shaarli\\Exceptions\\": "application/exceptions",
"Shaarli\\Security\\": "application/security"
}
}
<?php
+use Shaarli\Exceptions\IOException;
+
require_once 'application/FileUtils.php';
/**
/**
* File not writable: raise an exception.
*
- * @expectedException IOException
+ * @expectedException Shaarli\Exceptions\IOException
* @expectedExceptionMessage Error accessing "sandbox/flat.db"
*/
public function testWriteWithoutPermission()
/**
* Folder non existent: raise an exception.
*
- * @expectedException IOException
+ * @expectedException Shaarli\Exceptions\IOException
* @expectedExceptionMessage Error accessing "nopefolder"
*/
public function testWriteFolderDoesNotExist()
/**
* Folder non writable: raise an exception.
*
- * @expectedException IOException
+ * @expectedException Shaarli\Exceptions\IOException
* @expectedExceptionMessage Error accessing "sandbox"
*/
public function testWriteFolderPermission()
* Link datastore tests
*/
+use Shaarli\Exceptions\IOException;
+
require_once 'application/Cache.php';
require_once 'application/FileUtils.php';
require_once 'application/LinkDB.php';
/**
* Attempt to instantiate a LinkDB whereas the datastore is not writable
*
- * @expectedException IOException
+ * @expectedException Shaarli\Exceptions\IOException
* @expectedExceptionMessageRegExp /Error accessing "null"/
*/
public function testConstructDatastoreNotWriteable()
/**
* Write to invalid path.
*
- * @expectedException \IOException
+ * @expectedException \Shaarli\Exceptions\IOException
*/
public function testWriteInvalidArray()
{
/**
* Write to invalid path.
*
- * @expectedException \IOException
+ * @expectedException \Shaarli\Exceptions\IOException
*/
public function testWriteInvalidBlank()
{