3 namespace Friendica\Test\src\Core\Config;
5 use Friendica\Core\Config\PreloadConfig;
7 class PreloadConfigTest extends ConfigTest
9 public function getInstance()
11 return new PreloadConfig($this->configCache, $this->configModel);
15 * @dataProvider dataConfigLoad
17 public function testSetUp(array $data)
19 $this->configModel->shouldReceive('load')
23 parent::testSetUp($data);
27 * @dataProvider dataConfigLoad
29 public function testLoad(array $data, array $possibleCats, array $load)
31 $this->configModel->shouldReceive('isConnected')
35 $this->configModel->shouldReceive('load')
39 parent::testLoad($data, $possibleCats, $load);
41 // Assert that every category is loaded everytime
42 foreach ($data as $cat => $values) {
43 $this->assertConfig($cat, $values);
48 * @dataProvider dataDoubleLoad
50 public function testCacheLoadDouble(array $data1, array $data2, array $expect)
52 $this->configModel->shouldReceive('isConnected')
56 $this->configModel->shouldReceive('load')
60 parent::testCacheLoadDouble($data1, $data2, $expect);
62 // Assert that every category is loaded everytime and is NOT overwritten
63 foreach ($data1 as $cat => $values) {
64 $this->assertConfig($cat, $values);
69 * @dataProvider dataTests
71 public function testSetGetWithDB($data)
73 $this->configModel->shouldReceive('isConnected')
77 $this->configModel->shouldReceive('load')->andReturn(['config' => []])->once();
79 parent::testSetGetWithDB($data);
83 * @dataProvider dataTests
85 public function testGetWithRefresh($data)
87 $this->configModel->shouldReceive('isConnected')
91 // constructor loading
92 $this->configModel->shouldReceive('load')
93 ->andReturn(['config' => []])
97 $this->configModel->shouldReceive('get')
102 parent::testGetWithRefresh($data);
106 public function testGetWrongWithoutDB()
108 $this->configModel->shouldReceive('isConnected')
112 parent::testGetWrongWithoutDB();
116 * @dataProvider dataTests
118 public function testDeleteWithoutDB($data)
120 $this->configModel->shouldReceive('isConnected')
124 parent::testDeleteWithoutDB($data);
127 public function testDeleteWithDB()
129 $this->configModel->shouldReceive('isConnected')
133 // constructor loading
134 $this->configModel->shouldReceive('load')
135 ->andReturn(['config' => []])
138 parent::testDeleteWithDB();