Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
13.64% |
3 / 22 |
|
66.67% |
2 / 3 |
CRAP | |
0.00% |
0 / 1 |
| reverse_update_data_test | |
13.64% |
3 / 22 |
|
66.67% |
2 / 3 |
8.80 | |
0.00% |
0 / 1 |
| setUp | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| update_data_provider | |
0.00% |
0 / 19 |
|
0.00% |
0 / 1 |
2 | |||
| test_get_schema_steps | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * |
| 4 | * This file is part of the phpBB Forum Software package. |
| 5 | * |
| 6 | * @copyright (c) phpBB Limited <https://www.phpbb.com> |
| 7 | * @license GNU General Public License, version 2 (GPL-2.0) |
| 8 | * |
| 9 | * For full copyright and license information, please see |
| 10 | * the docs/CREDITS.txt file. |
| 11 | * |
| 12 | */ |
| 13 | |
| 14 | class reverse_update_data_test extends phpbb_test_case |
| 15 | { |
| 16 | /** @var \phpbb\db\migration\helper */ |
| 17 | protected $helper; |
| 18 | |
| 19 | protected function setUp(): void |
| 20 | { |
| 21 | parent::setUp(); |
| 22 | |
| 23 | $this->helper = new \phpbb\db\migration\helper(); |
| 24 | } |
| 25 | |
| 26 | public static function update_data_provider() |
| 27 | { |
| 28 | return array( |
| 29 | array( |
| 30 | array( |
| 31 | array('config.add', array('foobar', 1)), |
| 32 | array('if', array( |
| 33 | (false === true), |
| 34 | array('permission.add', array('some_data')), |
| 35 | )), |
| 36 | array('config.remove', array('foobar')), |
| 37 | array('custom', array(array(self::class, 'foo_bar'))), |
| 38 | array('tool.method', array('test_data')), |
| 39 | ), |
| 40 | array( |
| 41 | array('tool.reverse', array('method', 'test_data')), |
| 42 | array('config.reverse', array('remove', 'foobar')), |
| 43 | array('config.reverse', array('add', 'foobar', 1)), |
| 44 | ), |
| 45 | ), |
| 46 | ); |
| 47 | } |
| 48 | |
| 49 | /** |
| 50 | * @dataProvider update_data_provider |
| 51 | */ |
| 52 | public function test_get_schema_steps($data_changes, $expected) |
| 53 | { |
| 54 | $this->assertEquals($expected, $this->helper->reverse_update_data($data_changes)); |
| 55 | } |
| 56 | } |