3 namespace Friendica\Test\src\Core\Config;
5 use Friendica\Core\Config\PreloadPConfiguration;
7 class PreloadPConfigurationTest extends PConfigurationTest
9 public function getInstance()
11 return new PreloadPConfiguration($this->configCache, $this->configModel);
15 * @dataProvider dataConfigLoad
17 public function testLoad(int $uid, array $data, array $possibleCats, array $load)
19 $this->configModel->shouldReceive('isConnected')
23 $this->configModel->shouldReceive('load')
28 parent::testLoad($uid, $data, $possibleCats, $load);
30 // Assert that every category is loaded everytime
31 foreach ($data as $cat => $values) {
32 $this->assertConfig($uid, $cat, $values);
37 * @dataProvider dataDoubleLoad
39 public function testCacheLoadDouble(int $uid, array $data1, array $data2, array $expect)
41 $this->configModel->shouldReceive('isConnected')
45 $this->configModel->shouldReceive('load')
50 parent::testCacheLoadDouble($uid, $data1, $data2, $expect);
52 // Assert that every category is loaded everytime and is NOT overwritten
53 foreach ($data1 as $cat => $values) {
54 $this->assertConfig($uid, $cat, $values);
59 * @dataProvider dataTests
61 public function testSetGetWithoutDB(int $uid, $data)
63 $this->configModel->shouldReceive('isConnected')
67 parent::testSetGetWithoutDB($uid, $data);
71 * @dataProvider dataTests
73 public function testSetGetWithDB(int $uid, $data)
75 $this->configModel->shouldReceive('isConnected')
79 $this->configModel->shouldReceive('load')
81 ->andReturn(['config' => []])
84 parent::testSetGetWithDB($uid, $data);
88 * @dataProvider dataTests
90 public function testGetWithRefresh(int $uid, $data)
92 $this->configModel->shouldReceive('isConnected')
96 // constructor loading
97 $this->configModel->shouldReceive('load')
99 ->andReturn(['config' => []])
103 $this->configModel->shouldReceive('get')
104 ->with($uid, 'test', 'it')
108 parent::testGetWithRefresh($uid, $data);
112 * @dataProvider dataTests
114 public function testDeleteWithoutDB(int $uid, $data)
116 $this->configModel->shouldReceive('isConnected')
120 parent::testDeleteWithoutDB($uid, $data);
123 public function testDeleteWithDB()
125 $this->configModel->shouldReceive('isConnected')
129 // constructor loading
130 $this->configModel->shouldReceive('load')
132 ->andReturn(['config' => []])
135 parent::testDeleteWithDB();