Fix a lot of notices/warnings/deprecation notes in the test directory
This commit is contained in:
parent
efaec26b1d
commit
d55ecb9288
77 changed files with 428 additions and 558 deletions
|
@ -25,6 +25,7 @@ use Dice\Dice;
|
|||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\DI;
|
||||
use Friendica\Network\HTTPException\InternalServerErrorException;
|
||||
use Friendica\Render\FriendicaSmartyEngine;
|
||||
use Friendica\Util\Profiler;
|
||||
use Mockery\MockInterface;
|
||||
|
@ -64,7 +65,9 @@ trait AppMockTrait
|
|||
* Mock the App
|
||||
*
|
||||
* @param vfsStreamDirectory $root The root directory
|
||||
* @param bool $raw If true, no config mocking will be done
|
||||
* @param bool $raw If true, no config mocking will be done
|
||||
*
|
||||
* @throws InternalServerErrorException
|
||||
*/
|
||||
public function mockApp(vfsStreamDirectory $root, $raw = false)
|
||||
{
|
||||
|
|
|
@ -81,11 +81,11 @@ trait DBAMockTrait
|
|||
/**
|
||||
* Mocking DBA::fetchFirst()
|
||||
*
|
||||
* @param string $arg The argument of fetchFirst
|
||||
* @param bool $return True, if the DB is connected, otherwise false
|
||||
* @param null|int $times How often the method will get used
|
||||
* @param string $arg The argument of fetchFirst
|
||||
* @param bool $return True, if the DB is connected, otherwise false
|
||||
* @param null|int $times How often the method will get used
|
||||
*/
|
||||
public function mockFetchFirst($arg, $return = true, $times = null)
|
||||
public function mockFetchFirst(string $arg, bool $return = true, int $times = null)
|
||||
{
|
||||
$this->checkMock();
|
||||
|
||||
|
@ -139,13 +139,13 @@ trait DBAMockTrait
|
|||
/**
|
||||
* Mocking DBA::select()
|
||||
*
|
||||
* @param string $tableName The name of the table
|
||||
* @param array $select The Select Array (Default is [])
|
||||
* @param array $where The Where Array (Default is [])
|
||||
* @param object $return The array to return (Default is [])
|
||||
* @param null|int $times How often the method will get used
|
||||
* @param string $tableName The name of the table
|
||||
* @param array $select The Select Array (Default is [])
|
||||
* @param array $where The Where Array (Default is [])
|
||||
* @param object $return The array to return (Default is [])
|
||||
* @param null|int $times How often the method will get used
|
||||
*/
|
||||
public function mockSelect($tableName, $select = [], $where = [], $return = null, $times = null)
|
||||
public function mockSelect(string $tableName, array $select = [], array $where = [], $return = null, int $times = null)
|
||||
{
|
||||
$this->checkMock();
|
||||
|
||||
|
@ -159,12 +159,12 @@ trait DBAMockTrait
|
|||
/**
|
||||
* Mocking DBA::delete()
|
||||
*
|
||||
* @param string $tableName The name of the table
|
||||
* @param array $where The Where Array (Default is [])
|
||||
* @param bool $return The array to return (Default is true)
|
||||
* @param null|int $times How often the method will get used
|
||||
* @param string $tableName The name of the table
|
||||
* @param array $where The Where Array (Default is [])
|
||||
* @param bool $return The array to return (Default is true)
|
||||
* @param null|int $times How often the method will get used
|
||||
*/
|
||||
public function mockDBADelete($tableName, $where = [], $return = true, $times = null)
|
||||
public function mockDBADelete(string $tableName, array $where = [], bool $return = true, int $times = null)
|
||||
{
|
||||
$this->checkMock();
|
||||
|
||||
|
@ -178,14 +178,14 @@ trait DBAMockTrait
|
|||
/**
|
||||
* Mocking DBA::update()
|
||||
*
|
||||
* @param string $expTableName The name of the table
|
||||
* @param array $expFields The Fields Array
|
||||
* @param array $expCondition The Condition Array
|
||||
* @param array $expOld_fields The Old Fieldnames (Default is [])
|
||||
* @param bool $return true if the update was successful
|
||||
* @param null|int $times How often the method will get used
|
||||
* @param string $expTableName The name of the table
|
||||
* @param array $expFields The Fields Array
|
||||
* @param array $expCondition The Condition Array
|
||||
* @param array $expOld_fields The Old Fieldnames (Default is [])
|
||||
* @param bool $return true if the update was successful
|
||||
* @param null|int $times How often the method will get used
|
||||
*/
|
||||
public function mockDBAUpdate($expTableName, $expFields, $expCondition, $expOld_fields = [], $return = true, $times = null)
|
||||
public function mockDBAUpdate(string $expTableName, array $expFields, array $expCondition, array $expOld_fields = [], bool $return = true, int $times = null)
|
||||
{
|
||||
$this->checkMock();
|
||||
|
||||
|
@ -207,13 +207,13 @@ trait DBAMockTrait
|
|||
/**
|
||||
* Mocking DBA::insert()
|
||||
*
|
||||
* @param string $expTableName The name of the table
|
||||
* @param array $expParam The Parameters Array
|
||||
* @param bool $expOnDuplUpdate Update on a duplicated entry
|
||||
* @param bool $return True if the insert was successful
|
||||
* @param null|int $times How often the method will get used
|
||||
* @param string $expTableName The name of the table
|
||||
* @param array $expParam The Parameters Array
|
||||
* @param bool $expOnDuplUpdate Update on a duplicated entry
|
||||
* @param bool $return True if the insert was successful
|
||||
* @param null|int $times How often the method will get used
|
||||
*/
|
||||
public function mockDBAInsert($expTableName, $expParam, $expOnDuplUpdate = false, $return = true, $times = null)
|
||||
public function mockDBAInsert(string $expTableName, array $expParam, bool $expOnDuplUpdate = false, bool $return = true, int $times = null)
|
||||
{
|
||||
$this->checkMock();
|
||||
|
||||
|
@ -234,13 +234,13 @@ trait DBAMockTrait
|
|||
/**
|
||||
* Mocking DBA::selectFirst()
|
||||
*
|
||||
* @param string $expTableName The name of the table
|
||||
* @param array $expSelect The Select Array (Default is [])
|
||||
* @param array $expWhere The Where Array (Default is [])
|
||||
* @param array $return The array to return (Default is [])
|
||||
* @param null|int $times How often the method will get used
|
||||
* @param string $expTableName The name of the table
|
||||
* @param array $expSelect The Select Array (Default is [])
|
||||
* @param array $expWhere The Where Array (Default is [])
|
||||
* @param array $return The array to return (Default is [])
|
||||
* @param null|int $times How often the method will get used
|
||||
*/
|
||||
public function mockSelectFirst($expTableName, $expSelect = [], $expWhere = [], $return = [], $times = null)
|
||||
public function mockSelectFirst(string $expTableName, array $expSelect = [], array $expWhere = [], array $return = [], int $times = null)
|
||||
{
|
||||
$this->checkMock();
|
||||
|
||||
|
@ -321,11 +321,11 @@ trait DBAMockTrait
|
|||
/**
|
||||
* Mocking DBA::lock()
|
||||
*
|
||||
* @param string $table The table to lock
|
||||
* @param bool $return True, if the lock is set successful
|
||||
* @param null|int $times How often the method will get used
|
||||
* @param string $table The table to lock
|
||||
* @param bool $return True, if the lock is set successful
|
||||
* @param null|int $times How often the method will get used
|
||||
*/
|
||||
public function mockDbaLock($table, $return = true, $times = null)
|
||||
public function mockDbaLock(string $table, bool $return = true, int $times = null)
|
||||
{
|
||||
$this->checkMock();
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ trait DBStructureMockTrait
|
|||
* @param bool $return True, if the connect was successful, otherwise false
|
||||
* @param null|int $times How often the method will get used
|
||||
*/
|
||||
public function mockUpdate($args = [], $return = true, $times = null)
|
||||
public function mockUpdate(array $args = [], bool $return = true, int $times = null)
|
||||
{
|
||||
if (!isset($this->dbStructure)) {
|
||||
$this->dbStructure = \Mockery::mock('alias:' . DBStructure::class);
|
||||
|
@ -58,11 +58,11 @@ trait DBStructureMockTrait
|
|||
/**
|
||||
* Mocking DBStructure::existsTable()
|
||||
*
|
||||
* @param string $tableName The name of the table to check
|
||||
* @param bool $return True, if the connect was successful, otherwise false
|
||||
* @param null|int $times How often the method will get used
|
||||
* @param string $tableName The name of the table to check
|
||||
* @param bool $return True, if the connect was successful, otherwise false
|
||||
* @param null|int $times How often the method will get used
|
||||
*/
|
||||
public function mockExistsTable($tableName, $return = true, $times = null)
|
||||
public function mockExistsTable(string $tableName, bool $return = true, int $times = null)
|
||||
{
|
||||
if (!isset($this->dbStructure)) {
|
||||
$this->dbStructure = \Mockery::mock('alias:' . DBStructure::class);
|
||||
|
|
|
@ -33,7 +33,7 @@ class ExtendedPDO extends PDO
|
|||
/**
|
||||
* @var array Database drivers that support SAVEPOINT * statements.
|
||||
*/
|
||||
protected static $_supportedDrivers = array("pgsql", "mysql");
|
||||
protected static $_supportedDrivers = ["pgsql", "mysql"];
|
||||
|
||||
/**
|
||||
* @var int the current transaction depth
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
namespace Friendica\Test\Util\Database;
|
||||
|
||||
use Friendica\Database\Database;
|
||||
use Friendica\Database\DatabaseException;
|
||||
use PDO;
|
||||
use PDOException;
|
||||
|
||||
|
@ -80,7 +81,7 @@ class StaticDatabase extends Database
|
|||
/**
|
||||
* Does a commit
|
||||
*
|
||||
* @return boolean Was the command executed successfully?
|
||||
* @return bool Was the command executed successfully?
|
||||
*/
|
||||
public function commit()
|
||||
{
|
||||
|
@ -96,6 +97,8 @@ class StaticDatabase extends Database
|
|||
* Either through explicit calling or through implicit using the Database
|
||||
*
|
||||
* @param array $server $_SERVER variables
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function statConnect(array $server)
|
||||
{
|
||||
|
@ -119,6 +122,10 @@ class StaticDatabase extends Database
|
|||
$db_data = $server['MYSQL_DATABASE'];
|
||||
}
|
||||
|
||||
if (empty($db_host) || empty($db_user) || empty($db_data)) {
|
||||
throw new DatabaseException('Either one of the following settings are missing: Host, User or Database', 999, 'CONNECT');
|
||||
}
|
||||
|
||||
$port = 0;
|
||||
$serveraddr = trim($db_host);
|
||||
$serverdata = explode(':', $serveraddr);
|
||||
|
@ -128,7 +135,7 @@ class StaticDatabase extends Database
|
|||
}
|
||||
$server = trim($server);
|
||||
$user = trim($db_user);
|
||||
$pass = trim($db_pw);
|
||||
$pass = trim($db_pw ?? '');
|
||||
$db = trim($db_data);
|
||||
|
||||
if (!(strlen($server) && strlen($user))) {
|
||||
|
|
|
@ -1,103 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2020, Friendica
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Friendica\Test\Util;
|
||||
|
||||
use Friendica\Core\Cache\Duration;
|
||||
|
||||
trait DbaCacheMockTrait
|
||||
{
|
||||
/**
|
||||
* @var
|
||||
*/
|
||||
protected $dba;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
protected function mockDelete($key, $return = true, $times = null)
|
||||
{
|
||||
$this->mockDBADelete('cache', ['k' => $key], $return, $times);
|
||||
}
|
||||
|
||||
protected function mockGet($key, $return = null, $time = null, $times = null)
|
||||
{
|
||||
if ($time === null) {
|
||||
$time = time();
|
||||
}
|
||||
|
||||
$value = @serialize($return);
|
||||
|
||||
$this->mockSelectFirst('cache', ['v'], ['`k` = ? AND (`expires` >= ? OR `expires` = -1)', $key, $time], ['v' => $value], $times);
|
||||
$this->mockIsResult(['v' => $value], isset($return), $times);
|
||||
}
|
||||
|
||||
protected function mockSet($key, $value, $ttl = Duration::FIVE_MINUTES, $time = null, $return = true, $times = null)
|
||||
{
|
||||
if ($time === null) {
|
||||
$time = time();
|
||||
}
|
||||
|
||||
if ($ttl > 0) {
|
||||
$this->mockUtc('now + ' . $ttl . 'seconds', $time + $ttl, $times);
|
||||
$fields = [
|
||||
'v' => serialize($value),
|
||||
'expires' => $time + $ttl,
|
||||
'updated' => $time
|
||||
];
|
||||
} else {
|
||||
$fields = [
|
||||
'v' => serialize($value),
|
||||
'expires' => -1,
|
||||
'updated' => $time
|
||||
];
|
||||
}
|
||||
|
||||
$this->mockDBAUpdate('cache', $fields, ['k' => $key], true, $return, $times);
|
||||
}
|
||||
|
||||
protected function mockClear($outdated = true, $return = true, $times = null)
|
||||
{
|
||||
if ($outdated) {
|
||||
$this->mockDBADelete('cache', ['`expires` < NOW()'], $return, $times);
|
||||
} else {
|
||||
$this->mockDBADelete('cache', ['`k` IS NOT NULL '], $return, $times);
|
||||
}
|
||||
}
|
||||
|
||||
protected function mockGetAllKeys($prefix = null, $return = [], $time = null, $times = null)
|
||||
{
|
||||
if ($time === null) {
|
||||
$time = time();
|
||||
}
|
||||
|
||||
if (empty($prefix)) {
|
||||
$where = ['`expires` >= ?', $time];
|
||||
} else {
|
||||
$where = ['`expires` >= ? AND `k` LIKE CONCAT(?, \'%\')', $time, $prefix];
|
||||
}
|
||||
|
||||
$this->mockSelect('cache', ['k'], $where, $return, $times);
|
||||
$this->mockFetchLoop($return, $times);
|
||||
$this->mockDbaClose(true, $times);
|
||||
}
|
||||
}
|
|
@ -1,136 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2020, Friendica
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Friendica\Test\Util;
|
||||
|
||||
use Friendica\Core\Cache\Duration;
|
||||
use Friendica\Core\Lock\DatabaseLock;
|
||||
|
||||
trait DbaLockMockTrait
|
||||
{
|
||||
use DBAMockTrait;
|
||||
use DateTimeFormatMockTrait;
|
||||
|
||||
/**
|
||||
* Mocking acquireLock with DBA-backend
|
||||
*
|
||||
* @param mixed $key The key to lock
|
||||
* @param int $ttl The TimeToLive
|
||||
*
|
||||
* @param bool $locked Was the lock already set?
|
||||
* @param null $pid The PID which was set
|
||||
* @param bool $rowExists True, if a row already exists in the lock table
|
||||
* @param null $time The current timestamp
|
||||
* @param null|int $times How often the method will get used
|
||||
*
|
||||
*@see DatabaseLock::acquire()
|
||||
*
|
||||
*/
|
||||
public function mockAcquireLock($key, $ttl = Duration::FIVE_MINUTES, $locked = false, $pid = null, $rowExists = true, $time = null, $times = null)
|
||||
{
|
||||
if ($time === null) {
|
||||
$time = time();
|
||||
}
|
||||
|
||||
if ($pid === null) {
|
||||
$pid = getmypid();
|
||||
}
|
||||
|
||||
$this->mockDbaLock('locks', true, $times);
|
||||
|
||||
$this->mockUtcNow($time, $times);
|
||||
$result = ['locked' => $locked, 'pid' => $pid];
|
||||
$this->mockSelectFirst('locks', ['locked', 'pid'], ['`name` = ? AND `expires` >= ?', $key, $time], $result, $times);
|
||||
$this->mockIsResult($result, $rowExists, $times);
|
||||
|
||||
if ($rowExists) {
|
||||
if (!$locked ) {
|
||||
$this->mockUtc('now + ' . $ttl . 'seconds', $time, $times);
|
||||
$this->mockDBAUpdate('locks', ['locked' => true, 'pid' => $pid, 'expires' => $time], ['name' => $key], [], true, $times);
|
||||
}
|
||||
} else {
|
||||
$this->mockUtc('now + ' . $ttl . 'seconds', $time, $times);
|
||||
$this->mockDBAInsert('locks', ['name' => $key, 'locked' => true, 'pid' => $pid, 'expires' => $time], false, true, $times);
|
||||
}
|
||||
|
||||
$this->mockDbaUnlock($times);
|
||||
}
|
||||
|
||||
/**
|
||||
* Mocking isLocked with DBA-backend
|
||||
*
|
||||
* @param mixed $key The key of the lock
|
||||
* @param null|bool $return True, if the key is already locked
|
||||
* @param null $time The current timestamp
|
||||
* @param null|int $times How often the method will get used
|
||||
*
|
||||
*@see DatabaseLock::isLocked()
|
||||
*
|
||||
*/
|
||||
public function mockIsLocked($key, $return = true, $time = null, $times = null)
|
||||
{
|
||||
if ($time === null) {
|
||||
$time = time();
|
||||
}
|
||||
|
||||
$this->mockUtcNow($time, $times);
|
||||
$return = ((isset($return)) ? ['locked' => $return] : null);
|
||||
$this->mockSelectFirst('locks', ['locked'], ['`name` = ? AND `expires` >= ?', $key, $time], $return, $times);
|
||||
$this->mockIsResult($return, (isset($return) && $return), $times);
|
||||
}
|
||||
|
||||
/**
|
||||
* Mocking releaseAll with DBA-backend
|
||||
*
|
||||
* @param null $pid The PID which was set
|
||||
* @param null|int $times How often the method will get used
|
||||
*
|
||||
*@see DatabaseLock::releaseAll()
|
||||
*
|
||||
*/
|
||||
public function mockReleaseAll($pid = null, $times = null)
|
||||
{
|
||||
if ($pid === null) {
|
||||
$pid = getmypid();
|
||||
}
|
||||
|
||||
$this->mockDBADelete('locks', ['pid' => $pid], true, $times);
|
||||
}
|
||||
|
||||
/**
|
||||
* Mocking ReleaseLock with DBA-backend
|
||||
*
|
||||
* @param mixed $key The key to release
|
||||
* @param null|int $pid The PID which was set
|
||||
* @param null|int $times How often the method will get used
|
||||
*
|
||||
*@see DatabaseLock::release()
|
||||
*
|
||||
*/
|
||||
public function mockReleaseLock($key, $pid = null, $times = null)
|
||||
{
|
||||
if ($pid === null) {
|
||||
$pid = getmypid();
|
||||
}
|
||||
|
||||
$this->mockDBADelete('locks', ['name' => $key, 'pid' => $pid], true, $times);
|
||||
}
|
||||
}
|
|
@ -8,6 +8,18 @@ class EmailerSpy extends Emailer
|
|||
{
|
||||
public static $MAIL_DATA;
|
||||
|
||||
/**
|
||||
* Wrapper around the mail() method (mainly used to overwrite for tests)
|
||||
* @see mail()
|
||||
*
|
||||
* @param string $to Recipient of this mail
|
||||
* @param string $subject Subject of this mail
|
||||
* @param string $body Message body of this mail
|
||||
* @param string $headers Headers of this mail
|
||||
* @param string $parameters Additional (sendmail) parameters of this mail
|
||||
*
|
||||
* @return bool true if the mail was successfully accepted for delivery, false otherwise.
|
||||
*/
|
||||
protected function mail(string $to, string $subject, string $body, string $headers, string $parameters)
|
||||
{
|
||||
self::$MAIL_DATA = [
|
||||
|
|
|
@ -16,6 +16,8 @@ trait HookMockTrait
|
|||
/**
|
||||
* Mocking a method 'Hook::call()' call
|
||||
*
|
||||
* @param string $name
|
||||
* @param mixed $capture
|
||||
*/
|
||||
public function mockHookCallAll(string $name, &$capture)
|
||||
{
|
||||
|
|
|
@ -36,6 +36,7 @@ class Intercept extends php_user_filter
|
|||
*/
|
||||
public static $cache = '';
|
||||
|
||||
/** @noinspection PhpMissingParentCallCommonInspection */
|
||||
public function filter($in, $out, &$consumed, $closing)
|
||||
{
|
||||
while ($bucket = stream_bucket_make_writeable($in)) {
|
||||
|
|
|
@ -38,7 +38,7 @@ trait RendererMockTrait
|
|||
* @param string $return the return value of the mock (should be defined to have it later for followUp use)
|
||||
* @param null|int $times How often the method will get used
|
||||
*/
|
||||
public function mockGetMarkupTemplate($templateName, $return = '', $times = null)
|
||||
public function mockGetMarkupTemplate(string $templateName, string $return = '', int $times = null)
|
||||
{
|
||||
if (!isset($this->rendererMock)) {
|
||||
$this->rendererMock = \Mockery::mock('alias:' . Renderer::class);
|
||||
|
@ -54,12 +54,12 @@ trait RendererMockTrait
|
|||
/**
|
||||
* Mocking the method 'Renderer::replaceMacros()'
|
||||
*
|
||||
* @param string $template The template to use (normally, it is the mock result of 'mockGetMarkupTemplate()'
|
||||
* @param array|\Closure|null $args The arguments to pass to the macro
|
||||
* @param string $return the return value of the mock
|
||||
* @param null|int $times How often the method will get used
|
||||
* @param string $template The template to use (normally, it is the mock result of 'mockGetMarkupTemplate()'
|
||||
* @param array|\Closure|null $args The arguments to pass to the macro
|
||||
* @param string $return the return value of the mock
|
||||
* @param null|int $times How often the method will get used
|
||||
*/
|
||||
public function mockReplaceMacros($template, $args = null, $return = '', $times = null)
|
||||
public function mockReplaceMacros(string $template, $args = null, string $return = '', int $times = null)
|
||||
{
|
||||
if (!isset($this->rendererMock)) {
|
||||
$this->rendererMock = \Mockery::mock('alias:' . Renderer::class);
|
||||
|
|
|
@ -33,6 +33,20 @@ class StaticCookie extends Cookie
|
|||
/** @var int The last expire time set */
|
||||
public static $_EXPIRE;
|
||||
|
||||
/**
|
||||
* Send a cookie - protected, internal function for test-mocking possibility
|
||||
* @see Cookie::setCookie()
|
||||
*
|
||||
* @link https://php.net/manual/en/function.setcookie.php
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $value [optional]
|
||||
* @param int $expire [optional]
|
||||
* @param bool $secure [optional]
|
||||
*
|
||||
* @noinspection PhpMissingParentCallCommonInspection
|
||||
*
|
||||
*/
|
||||
protected function setCookie(string $name, string $value = null, int $expire = null, bool $secure = null)
|
||||
{
|
||||
self::$_COOKIE[$name] = $value;
|
||||
|
|
|
@ -58,9 +58,9 @@ trait VFSTrait
|
|||
* Copying a config file from the file system to the Virtual File System
|
||||
*
|
||||
* @param string $filename The filename of the config file
|
||||
* @param bool $static True, if the folder `static` instead of `config` should be used
|
||||
* @param bool $static True, if the folder `static` instead of `config` should be used
|
||||
*/
|
||||
protected function setConfigFile($filename, bool $static = false)
|
||||
protected function setConfigFile(string $filename, bool $static = false)
|
||||
{
|
||||
$file = dirname(__DIR__) . DIRECTORY_SEPARATOR .
|
||||
'..' . DIRECTORY_SEPARATOR .
|
||||
|
@ -78,9 +78,9 @@ trait VFSTrait
|
|||
* Delets a config file from the Virtual File System
|
||||
*
|
||||
* @param string $filename The filename of the config file
|
||||
* @param bool $static True, if the folder `static` instead of `config` should be used
|
||||
* @param bool $static True, if the folder `static` instead of `config` should be used
|
||||
*/
|
||||
protected function delConfigFile($filename, bool $static = false)
|
||||
protected function delConfigFile(string $filename, bool $static = false)
|
||||
{
|
||||
if ($this->root->hasChild(($static ? 'static' : 'config') . '/' . $filename)) {
|
||||
$this->root->getChild(($static ? 'static' : 'config'))->removeChild($filename);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue