1 | <?php |
||
2 | namespace RazonYang\Yii2\Setting\Tests\Unit; |
||
3 | |||
4 | use Codeception\Test\Unit; |
||
5 | use RazonYang\Yii2\Setting\DbManager; |
||
6 | use RazonYang\Yii2\Setting\Tests\Fixture\SettingFixture; |
||
7 | |||
8 | class DbManagerTest extends Unit |
||
9 | { |
||
10 | private function getDataFile(): string |
||
11 | { |
||
12 | return codecept_data_dir() . 'setting.php'; |
||
13 | } |
||
14 | |||
15 | public function _fixtures() |
||
16 | { |
||
17 | return [ |
||
18 | 'setting' => [ |
||
19 | 'class' => SettingFixture::className(), |
||
0 ignored issues
–
show
|
|||
20 | 'dataFile' => $this->getDataFile() |
||
21 | ] |
||
22 | ]; |
||
23 | } |
||
24 | |||
25 | public function testLoad(): void |
||
26 | { |
||
27 | $data = require $this->getDataFile(); |
||
28 | $manager = new DbManager(); |
||
29 | $settings = $manager->load(); |
||
30 | $this->assertCount(count($data), $settings); |
||
31 | foreach ($data as $id => $fields) { |
||
32 | $this->assertArrayHasKey($id, $settings); |
||
33 | $this->assertSame($fields['value'], $settings[$id]); |
||
34 | } |
||
35 | } |
||
36 | } |
||
37 |
This function has been deprecated. The supplier of the function has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.