2019-02-10 18:52:21 +00:00
|
|
|
<?php
|
2020-02-09 14:45:36 +00:00
|
|
|
/**
|
|
|
|
* @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/>.
|
|
|
|
*
|
|
|
|
*/
|
2019-02-10 18:52:21 +00:00
|
|
|
|
2019-02-27 11:32:56 +00:00
|
|
|
namespace Friendica\Test\src\Core\Config;
|
2019-02-10 18:52:21 +00:00
|
|
|
|
2020-01-19 21:23:44 +00:00
|
|
|
use Friendica\Core\Config\Cache;
|
2020-01-19 20:29:36 +00:00
|
|
|
use Friendica\Core\Config\IConfig;
|
2019-07-02 22:42:47 +00:00
|
|
|
use Friendica\Model\Config\Config as ConfigModel;
|
2019-02-10 18:52:21 +00:00
|
|
|
use Friendica\Test\MockedTest;
|
2019-07-02 22:42:47 +00:00
|
|
|
use Mockery\MockInterface;
|
|
|
|
use Mockery;
|
2019-02-10 18:52:21 +00:00
|
|
|
|
2020-01-19 21:38:33 +00:00
|
|
|
abstract class ConfigTest extends MockedTest
|
2019-02-10 18:52:21 +00:00
|
|
|
{
|
2019-07-02 22:42:47 +00:00
|
|
|
/** @var ConfigModel|MockInterface */
|
|
|
|
protected $configModel;
|
|
|
|
|
2020-01-19 21:23:44 +00:00
|
|
|
/** @var Cache */
|
2019-07-02 22:42:47 +00:00
|
|
|
protected $configCache;
|
|
|
|
|
2020-01-19 20:29:36 +00:00
|
|
|
/** @var IConfig */
|
2019-07-02 22:42:47 +00:00
|
|
|
protected $testedConfig;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Assert a config tree
|
|
|
|
*
|
|
|
|
* @param string $cat The category to assert
|
|
|
|
* @param array $data The result data array
|
|
|
|
*/
|
|
|
|
protected function assertConfig(string $cat, array $data)
|
|
|
|
{
|
|
|
|
$result = $this->testedConfig->getCache()->getAll();
|
|
|
|
|
2020-10-17 12:19:57 +00:00
|
|
|
self::assertNotEmpty($result);
|
|
|
|
self::assertArrayHasKey($cat, $result);
|
|
|
|
self::assertArraySubset($data, $result[$cat]);
|
2019-07-02 22:42:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected function setUp()
|
|
|
|
{
|
|
|
|
parent::setUp();
|
|
|
|
|
|
|
|
// Create the config model
|
|
|
|
$this->configModel = Mockery::mock(ConfigModel::class);
|
2020-01-19 21:23:44 +00:00
|
|
|
$this->configCache = new Cache();
|
2019-07-02 22:42:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-01-19 20:29:36 +00:00
|
|
|
* @return IConfig
|
2019-07-02 22:42:47 +00:00
|
|
|
*/
|
2020-10-18 18:31:57 +00:00
|
|
|
abstract public function getInstance();
|
2019-07-02 22:42:47 +00:00
|
|
|
|
2019-02-11 20:36:26 +00:00
|
|
|
public function dataTests()
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
'string' => ['data' => 'it'],
|
|
|
|
'boolTrue' => ['data' => true],
|
|
|
|
'boolFalse' => ['data' => false],
|
|
|
|
'integer' => ['data' => 235],
|
|
|
|
'decimal' => ['data' => 2.456],
|
|
|
|
'array' => ['data' => ['1', 2, '3', true, false]],
|
|
|
|
'boolIntTrue' => ['data' => 1],
|
|
|
|
'boolIntFalse' => ['Data' => 0],
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
2019-07-02 22:42:47 +00:00
|
|
|
public function dataConfigLoad()
|
|
|
|
{
|
|
|
|
$data = [
|
|
|
|
'system' => [
|
|
|
|
'key1' => 'value1',
|
|
|
|
'key2' => 'value2',
|
|
|
|
'key3' => 'value3',
|
|
|
|
],
|
|
|
|
'config' => [
|
|
|
|
'key1' => 'value1a',
|
|
|
|
'key4' => 'value4',
|
|
|
|
],
|
|
|
|
'other' => [
|
|
|
|
'key5' => 'value5',
|
|
|
|
'key6' => 'value6',
|
|
|
|
],
|
|
|
|
];
|
|
|
|
|
|
|
|
return [
|
|
|
|
'system' => [
|
|
|
|
'data' => $data,
|
|
|
|
'possibleCats' => [
|
|
|
|
'system',
|
|
|
|
'config',
|
|
|
|
'other'
|
|
|
|
],
|
|
|
|
'load' => [
|
|
|
|
'system',
|
|
|
|
],
|
|
|
|
],
|
|
|
|
'other' => [
|
|
|
|
'data' => $data,
|
|
|
|
'possibleCats' => [
|
|
|
|
'system',
|
|
|
|
'config',
|
|
|
|
'other'
|
|
|
|
],
|
|
|
|
'load' => [
|
|
|
|
'other',
|
|
|
|
],
|
|
|
|
],
|
|
|
|
'config' => [
|
|
|
|
'data' => $data,
|
|
|
|
'possibleCats' => [
|
|
|
|
'system',
|
|
|
|
'config',
|
|
|
|
'other'
|
|
|
|
],
|
|
|
|
'load' => [
|
|
|
|
'config',
|
|
|
|
],
|
|
|
|
],
|
|
|
|
'all' => [
|
|
|
|
'data' => $data,
|
|
|
|
'possibleCats' => [
|
|
|
|
'system',
|
|
|
|
'config',
|
|
|
|
'other'
|
|
|
|
],
|
|
|
|
'load' => [
|
|
|
|
'system',
|
|
|
|
'config',
|
|
|
|
'other'
|
|
|
|
],
|
|
|
|
],
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
2019-02-10 18:52:21 +00:00
|
|
|
/**
|
|
|
|
* Test the configuration initialization
|
|
|
|
*/
|
2019-07-02 22:42:47 +00:00
|
|
|
public function testSetUp(array $data)
|
2019-02-10 18:52:21 +00:00
|
|
|
{
|
2019-07-02 22:42:47 +00:00
|
|
|
$this->configModel->shouldReceive('isConnected')
|
|
|
|
->andReturn(true)
|
|
|
|
->once();
|
2019-02-10 18:52:21 +00:00
|
|
|
|
2019-07-02 22:42:47 +00:00
|
|
|
$this->testedConfig = $this->getInstance();
|
2020-10-17 12:19:57 +00:00
|
|
|
self::assertInstanceOf(Cache::class, $this->testedConfig->getCache());
|
2019-02-10 18:52:21 +00:00
|
|
|
|
2019-07-02 22:42:47 +00:00
|
|
|
// assert config is loaded everytime
|
2020-10-17 12:19:57 +00:00
|
|
|
self::assertConfig('config', $data['config']);
|
2019-02-10 18:52:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2019-02-11 20:36:26 +00:00
|
|
|
* Test the configuration load() method
|
2020-10-18 18:31:57 +00:00
|
|
|
*
|
|
|
|
* @param array $data
|
|
|
|
* @param array $load
|
2019-02-10 18:52:21 +00:00
|
|
|
*/
|
2020-10-18 18:31:57 +00:00
|
|
|
public function testLoad(array $data, array $load)
|
2019-02-10 18:52:21 +00:00
|
|
|
{
|
2019-07-02 22:42:47 +00:00
|
|
|
$this->testedConfig = $this->getInstance();
|
2020-10-17 12:19:57 +00:00
|
|
|
self::assertInstanceOf(Cache::class, $this->testedConfig->getCache());
|
2019-07-02 22:42:47 +00:00
|
|
|
|
|
|
|
foreach ($load as $loadedCats) {
|
|
|
|
$this->testedConfig->load($loadedCats);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Assert at least loaded cats are loaded
|
|
|
|
foreach ($load as $loadedCats) {
|
2020-10-17 12:19:57 +00:00
|
|
|
self::assertConfig($loadedCats, $data[$loadedCats]);
|
2019-07-02 22:42:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function dataDoubleLoad()
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
'config' => [
|
|
|
|
'data1' => [
|
|
|
|
'config' => [
|
|
|
|
'key1' => 'value1',
|
|
|
|
'key2' => 'value2',
|
|
|
|
],
|
|
|
|
],
|
|
|
|
'data2' => [
|
|
|
|
'config' => [
|
|
|
|
'key1' => 'overwritten!',
|
|
|
|
'key3' => 'value3',
|
|
|
|
],
|
|
|
|
],
|
|
|
|
'expect' => [
|
|
|
|
'config' => [
|
|
|
|
// load should overwrite values everytime!
|
|
|
|
'key1' => 'overwritten!',
|
|
|
|
'key2' => 'value2',
|
|
|
|
'key3' => 'value3',
|
|
|
|
],
|
|
|
|
],
|
|
|
|
],
|
|
|
|
'other' => [
|
|
|
|
'data1' => [
|
|
|
|
'config' => [
|
|
|
|
'key12' => 'data4',
|
|
|
|
'key45' => 7,
|
|
|
|
],
|
|
|
|
'other' => [
|
|
|
|
'key1' => 'value1',
|
|
|
|
'key2' => 'value2',
|
|
|
|
],
|
|
|
|
],
|
|
|
|
'data2' => [
|
|
|
|
'other' => [
|
|
|
|
'key1' => 'overwritten!',
|
|
|
|
'key3' => 'value3',
|
|
|
|
],
|
|
|
|
'config' => [
|
|
|
|
'key45' => 45,
|
|
|
|
'key52' => true,
|
|
|
|
]
|
|
|
|
],
|
|
|
|
'expect' => [
|
|
|
|
'other' => [
|
|
|
|
// load should overwrite values everytime!
|
|
|
|
'key1' => 'overwritten!',
|
|
|
|
'key2' => 'value2',
|
|
|
|
'key3' => 'value3',
|
|
|
|
],
|
|
|
|
'config' => [
|
|
|
|
'key12' => 'data4',
|
|
|
|
'key45' => 45,
|
|
|
|
'key52' => true,
|
|
|
|
],
|
|
|
|
],
|
|
|
|
],
|
|
|
|
];
|
2019-02-10 18:52:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2019-02-11 20:36:26 +00:00
|
|
|
* Test the configuration load() method with overwrite
|
2019-02-10 18:52:21 +00:00
|
|
|
*/
|
2020-10-18 18:31:57 +00:00
|
|
|
public function testCacheLoadDouble(array $data1, array $data2, array $expect = [])
|
2019-02-10 18:52:21 +00:00
|
|
|
{
|
2019-07-02 22:42:47 +00:00
|
|
|
$this->testedConfig = $this->getInstance();
|
2020-10-17 12:19:57 +00:00
|
|
|
self::assertInstanceOf(Cache::class, $this->testedConfig->getCache());
|
2019-07-02 22:42:47 +00:00
|
|
|
|
|
|
|
foreach ($data1 as $cat => $data) {
|
|
|
|
$this->testedConfig->load($cat);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Assert at least loaded cats are loaded
|
|
|
|
foreach ($data1 as $cat => $data) {
|
2020-10-17 12:19:57 +00:00
|
|
|
self::assertConfig($cat, $data);
|
2019-07-02 22:42:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
foreach ($data2 as $cat => $data) {
|
|
|
|
$this->testedConfig->load($cat);
|
|
|
|
}
|
2019-02-10 18:52:21 +00:00
|
|
|
}
|
|
|
|
|
2019-07-04 19:39:49 +00:00
|
|
|
/**
|
|
|
|
* Test the configuration load without result
|
|
|
|
*/
|
|
|
|
public function testLoadWrong()
|
|
|
|
{
|
|
|
|
$this->configModel->shouldReceive('isConnected')->andReturn(true)->once();
|
|
|
|
$this->configModel->shouldReceive('load')->withAnyArgs()->andReturn([])->once();
|
|
|
|
|
|
|
|
$this->testedConfig = $this->getInstance();
|
2020-10-17 12:19:57 +00:00
|
|
|
self::assertInstanceOf(Cache::class, $this->testedConfig->getCache());
|
2019-07-04 19:39:49 +00:00
|
|
|
|
2020-10-17 12:19:57 +00:00
|
|
|
self::assertEmpty($this->testedConfig->getCache()->getAll());
|
2019-07-04 19:39:49 +00:00
|
|
|
}
|
|
|
|
|
2019-02-10 18:52:21 +00:00
|
|
|
/**
|
2019-02-11 20:36:26 +00:00
|
|
|
* Test the configuration get() and set() methods without adapter
|
2019-07-02 22:42:47 +00:00
|
|
|
*
|
2019-02-11 20:36:26 +00:00
|
|
|
* @dataProvider dataTests
|
2019-02-10 18:52:21 +00:00
|
|
|
*/
|
2019-02-11 20:36:26 +00:00
|
|
|
public function testSetGetWithoutDB($data)
|
2019-02-10 18:52:21 +00:00
|
|
|
{
|
2019-07-02 22:42:47 +00:00
|
|
|
$this->configModel->shouldReceive('isConnected')
|
|
|
|
->andReturn(false)
|
|
|
|
->times(3);
|
2019-02-10 18:52:21 +00:00
|
|
|
|
2019-07-02 22:42:47 +00:00
|
|
|
$this->testedConfig = $this->getInstance();
|
2020-10-17 12:19:57 +00:00
|
|
|
self::assertInstanceOf(Cache::class, $this->testedConfig->getCache());
|
2019-02-10 18:52:21 +00:00
|
|
|
|
2020-10-17 12:19:57 +00:00
|
|
|
self::assertTrue($this->testedConfig->set('test', 'it', $data));
|
2019-02-10 18:52:21 +00:00
|
|
|
|
2020-10-17 12:19:57 +00:00
|
|
|
self::assertEquals($data, $this->testedConfig->get('test', 'it'));
|
|
|
|
self::assertEquals($data, $this->testedConfig->getCache()->get('test', 'it'));
|
2019-02-10 18:52:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2019-07-02 22:42:47 +00:00
|
|
|
* Test the configuration get() and set() methods with a model/db
|
|
|
|
*
|
2019-02-11 20:36:26 +00:00
|
|
|
* @dataProvider dataTests
|
2019-02-10 18:52:21 +00:00
|
|
|
*/
|
2019-02-11 20:36:26 +00:00
|
|
|
public function testSetGetWithDB($data)
|
2019-02-10 18:52:21 +00:00
|
|
|
{
|
2019-07-02 22:42:47 +00:00
|
|
|
$this->configModel->shouldReceive('set')->with('test', 'it', $data)->andReturn(true)->once();
|
2019-02-10 18:52:21 +00:00
|
|
|
|
2019-07-02 22:42:47 +00:00
|
|
|
$this->testedConfig = $this->getInstance();
|
2020-10-17 12:19:57 +00:00
|
|
|
self::assertInstanceOf(Cache::class, $this->testedConfig->getCache());
|
2019-02-10 18:52:21 +00:00
|
|
|
|
2020-10-17 12:19:57 +00:00
|
|
|
self::assertTrue($this->testedConfig->set('test', 'it', $data));
|
2019-02-10 18:52:21 +00:00
|
|
|
|
2020-10-17 12:19:57 +00:00
|
|
|
self::assertEquals($data, $this->testedConfig->get('test', 'it'));
|
|
|
|
self::assertEquals($data, $this->testedConfig->getCache()->get('test', 'it'));
|
2019-02-10 18:52:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test the configuration get() method with wrong value and no db
|
|
|
|
*/
|
|
|
|
public function testGetWrongWithoutDB()
|
|
|
|
{
|
2019-07-02 22:42:47 +00:00
|
|
|
$this->testedConfig = $this->getInstance();
|
2020-10-17 12:19:57 +00:00
|
|
|
self::assertInstanceOf(Cache::class, $this->testedConfig->getCache());
|
2019-02-10 18:52:21 +00:00
|
|
|
|
|
|
|
// without refresh
|
2020-10-17 12:19:57 +00:00
|
|
|
self::assertNull($this->testedConfig->get('test', 'it'));
|
2019-02-10 18:52:21 +00:00
|
|
|
|
|
|
|
/// beware that the cache returns '!<unset>!' and not null for a non existing value
|
2020-10-17 12:19:57 +00:00
|
|
|
self::assertNull($this->testedConfig->getCache()->get('test', 'it'));
|
2019-02-10 18:52:21 +00:00
|
|
|
|
|
|
|
// with default value
|
2020-10-17 12:19:57 +00:00
|
|
|
self::assertEquals('default', $this->testedConfig->get('test', 'it', 'default'));
|
2019-02-10 18:52:21 +00:00
|
|
|
|
|
|
|
// with default value and refresh
|
2020-10-17 12:19:57 +00:00
|
|
|
self::assertEquals('default', $this->testedConfig->get('test', 'it', 'default', true));
|
2019-02-10 18:52:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test the configuration get() method with refresh
|
2019-07-02 22:42:47 +00:00
|
|
|
*
|
2019-02-11 20:36:26 +00:00
|
|
|
* @dataProvider dataTests
|
2019-02-10 18:52:21 +00:00
|
|
|
*/
|
2019-02-11 20:36:26 +00:00
|
|
|
public function testGetWithRefresh($data)
|
2019-02-10 18:52:21 +00:00
|
|
|
{
|
2020-10-04 18:37:35 +00:00
|
|
|
$this->configCache->load(['test' => ['it' => 'now']], Cache::SOURCE_FILE);
|
2019-07-02 22:42:47 +00:00
|
|
|
|
|
|
|
$this->testedConfig = $this->getInstance();
|
2020-10-17 12:19:57 +00:00
|
|
|
self::assertInstanceOf(Cache::class, $this->testedConfig->getCache());
|
2019-02-10 18:52:21 +00:00
|
|
|
|
|
|
|
// without refresh
|
2020-10-17 12:19:57 +00:00
|
|
|
self::assertEquals('now', $this->testedConfig->get('test', 'it'));
|
|
|
|
self::assertEquals('now', $this->testedConfig->getCache()->get('test', 'it'));
|
2019-02-10 18:52:21 +00:00
|
|
|
|
|
|
|
// with refresh
|
2020-10-17 12:19:57 +00:00
|
|
|
self::assertEquals($data, $this->testedConfig->get('test', 'it', null, true));
|
|
|
|
self::assertEquals($data, $this->testedConfig->getCache()->get('test', 'it'));
|
2019-02-10 18:52:21 +00:00
|
|
|
|
|
|
|
// without refresh and wrong value and default
|
2020-10-17 12:19:57 +00:00
|
|
|
self::assertEquals('default', $this->testedConfig->get('test', 'not', 'default'));
|
|
|
|
self::assertNull($this->testedConfig->getCache()->get('test', 'not'));
|
2019-02-11 20:36:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2019-07-02 22:42:47 +00:00
|
|
|
* Test the configuration delete() method without a model/db
|
|
|
|
*
|
2019-02-11 20:36:26 +00:00
|
|
|
* @dataProvider dataTests
|
|
|
|
*/
|
|
|
|
public function testDeleteWithoutDB($data)
|
|
|
|
{
|
2020-10-04 18:37:35 +00:00
|
|
|
$this->configCache->load(['test' => ['it' => $data]], Cache::SOURCE_FILE);
|
2019-02-11 20:36:26 +00:00
|
|
|
|
2019-07-02 22:42:47 +00:00
|
|
|
$this->testedConfig = $this->getInstance();
|
2020-10-17 12:19:57 +00:00
|
|
|
self::assertInstanceOf(Cache::class, $this->testedConfig->getCache());
|
2019-02-11 20:36:26 +00:00
|
|
|
|
2020-10-17 12:19:57 +00:00
|
|
|
self::assertEquals($data, $this->testedConfig->get('test', 'it'));
|
|
|
|
self::assertEquals($data, $this->testedConfig->getCache()->get('test', 'it'));
|
2019-02-11 20:36:26 +00:00
|
|
|
|
2020-10-17 12:19:57 +00:00
|
|
|
self::assertTrue($this->testedConfig->delete('test', 'it'));
|
|
|
|
self::assertNull($this->testedConfig->get('test', 'it'));
|
|
|
|
self::assertNull($this->testedConfig->getCache()->get('test', 'it'));
|
2019-02-10 18:52:21 +00:00
|
|
|
|
2020-10-17 12:19:57 +00:00
|
|
|
self::assertEmpty($this->testedConfig->getCache()->getAll());
|
2019-02-10 18:52:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2019-07-02 22:42:47 +00:00
|
|
|
* Test the configuration delete() method with a model/db
|
2019-02-10 18:52:21 +00:00
|
|
|
*/
|
|
|
|
public function testDeleteWithDB()
|
|
|
|
{
|
2020-10-04 18:37:35 +00:00
|
|
|
$this->configCache->load(['test' => ['it' => 'now', 'quarter' => 'true']], Cache::SOURCE_FILE);
|
2019-07-02 22:42:47 +00:00
|
|
|
|
|
|
|
$this->configModel->shouldReceive('delete')
|
|
|
|
->with('test', 'it')
|
|
|
|
->andReturn(false)
|
|
|
|
->once();
|
|
|
|
$this->configModel->shouldReceive('delete')
|
|
|
|
->with('test', 'second')
|
|
|
|
->andReturn(true)
|
|
|
|
->once();
|
|
|
|
$this->configModel->shouldReceive('delete')
|
|
|
|
->with('test', 'third')
|
|
|
|
->andReturn(false)
|
|
|
|
->once();
|
|
|
|
$this->configModel->shouldReceive('delete')
|
|
|
|
->with('test', 'quarter')
|
|
|
|
->andReturn(true)
|
|
|
|
->once();
|
|
|
|
|
|
|
|
$this->testedConfig = $this->getInstance();
|
2020-10-17 12:19:57 +00:00
|
|
|
self::assertInstanceOf(Cache::class, $this->testedConfig->getCache());
|
2019-07-02 22:42:47 +00:00
|
|
|
|
|
|
|
// directly set the value to the cache
|
|
|
|
$this->testedConfig->getCache()->set('test', 'it', 'now');
|
|
|
|
|
2020-10-17 12:19:57 +00:00
|
|
|
self::assertEquals('now', $this->testedConfig->get('test', 'it'));
|
|
|
|
self::assertEquals('now', $this->testedConfig->getCache()->get('test', 'it'));
|
2019-02-10 18:52:21 +00:00
|
|
|
|
|
|
|
// delete from cache only
|
2020-10-17 12:19:57 +00:00
|
|
|
self::assertTrue($this->testedConfig->delete('test', 'it'));
|
2019-02-10 18:52:21 +00:00
|
|
|
// delete from db only
|
2020-10-17 12:19:57 +00:00
|
|
|
self::assertTrue($this->testedConfig->delete('test', 'second'));
|
2019-02-10 18:52:21 +00:00
|
|
|
// no delete
|
2020-10-17 12:19:57 +00:00
|
|
|
self::assertFalse($this->testedConfig->delete('test', 'third'));
|
2019-02-10 18:52:21 +00:00
|
|
|
// delete both
|
2020-10-17 12:19:57 +00:00
|
|
|
self::assertTrue($this->testedConfig->delete('test', 'quarter'));
|
2019-02-10 18:52:21 +00:00
|
|
|
|
2020-10-17 12:19:57 +00:00
|
|
|
self::assertEmpty($this->testedConfig->getCache()->getAll());
|
2019-02-10 18:52:21 +00:00
|
|
|
}
|
|
|
|
}
|