Compatibility with PHP 8
This commit is contained in:
parent
a5a9cf23ac
commit
ab58f25420
5 changed files with 11 additions and 19 deletions
|
@ -8,6 +8,9 @@ matrix:
|
|||
install:
|
||||
- composer self-update --2
|
||||
- composer update --ignore-platform-req=php
|
||||
- composer remove phpunit/phpunit
|
||||
- composer require --dev --ignore-platform-req=php phpunit/php-text-template ^2.0
|
||||
- composer require --dev --ignore-platform-req=php phpunit/phpunit ^9.0
|
||||
- language: php
|
||||
php: 7.4
|
||||
- language: php
|
||||
|
|
|
@ -46,7 +46,7 @@ public function write($filepath, $conf)
|
|||
// JSON_PRETTY_PRINT is available from PHP 5.4.
|
||||
$print = defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : 0;
|
||||
$data = self::getPhpHeaders() . json_encode($conf, $print) . self::getPhpSuffix();
|
||||
if (!file_put_contents($filepath, $data)) {
|
||||
if (empty($filepath) || !file_put_contents($filepath, $data)) {
|
||||
throw new \Shaarli\Exceptions\IOException(
|
||||
$filepath,
|
||||
t('Shaarli could not create the config file. '.
|
||||
|
|
|
@ -81,8 +81,8 @@ public function testPluginWithPhpError(): void
|
|||
$data = [];
|
||||
$this->pluginManager->executeHooks('error', $data);
|
||||
|
||||
$this->assertSame(
|
||||
'test [plugin incompatibility]: Class \'Unknown\' not found',
|
||||
$this->assertMatchesRegularExpression(
|
||||
'/test \[plugin incompatibility\]: Class [\'"]Unknown[\'"] not found/',
|
||||
$this->pluginManager->getErrors()[0]
|
||||
);
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ public function testReadNonExistent()
|
|||
public function testReadInvalidJson()
|
||||
{
|
||||
$this->expectException(\Exception::class);
|
||||
$this->expectExceptionMessageRegExp(' /An error occurred while parsing JSON configuration file \\([\\w\\/\\.]+\\): error code #4/');
|
||||
$this->expectExceptionMessageRegExp('/An error occurred while parsing JSON configuration file \\([\\w\\/\\.]+\\): error code #4/');
|
||||
|
||||
$this->configIO->read('tests/utils/config/configInvalid.json.php');
|
||||
}
|
||||
|
@ -108,17 +108,6 @@ public function testOverwrite()
|
|||
unlink($dest);
|
||||
}
|
||||
|
||||
/**
|
||||
* Write to invalid path.
|
||||
*/
|
||||
public function testWriteInvalidArray()
|
||||
{
|
||||
$this->expectException(\Shaarli\Exceptions\IOException::class);
|
||||
|
||||
$conf = array('conf' => 'value');
|
||||
@$this->configIO->write(array(), $conf);
|
||||
}
|
||||
|
||||
/**
|
||||
* Write to invalid path.
|
||||
*/
|
||||
|
|
|
@ -37,7 +37,7 @@ public function __construct($doneUpdates, $bookmarkService, $conf, $isLoggedIn)
|
|||
*
|
||||
* @return bool true.
|
||||
*/
|
||||
final private function updateMethodDummy1()
|
||||
final protected function updateMethodDummy1()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ final private function updateMethodDummy1()
|
|||
*
|
||||
* @return bool true.
|
||||
*/
|
||||
final private function updateMethodDummy2()
|
||||
final protected function updateMethodDummy2()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ final private function updateMethodDummy2()
|
|||
*
|
||||
* @return bool true.
|
||||
*/
|
||||
final private function updateMethodDummy3()
|
||||
final protected function updateMethodDummy3()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ final private function updateMethodDummy3()
|
|||
*
|
||||
* @throws Exception error.
|
||||
*/
|
||||
final private function updateMethodException()
|
||||
final protected function updateMethodException()
|
||||
{
|
||||
throw new Exception('whatever');
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue