xref: /dokuwiki/lib/plugins/config/_test/Setting/SettingOnoffTest.php (revision 28cc4f40f4befda684909df9332785b02932b956)
1c73b800aSAndreas Gohr<?php
2c73b800aSAndreas Gohr
3c73b800aSAndreas Gohrnamespace dokuwiki\plugin\config\test\Setting;
4c73b800aSAndreas Gohr
5c73b800aSAndreas Gohr/**
6c73b800aSAndreas Gohr * @group plugin_config
7c73b800aSAndreas Gohr * @group admin_plugins
8c73b800aSAndreas Gohr * @group plugins
9c73b800aSAndreas Gohr * @group bundled_plugins
10c73b800aSAndreas Gohr */
11c73b800aSAndreas Gohrclass SettingOnoffTest extends SettingTest {
12c73b800aSAndreas Gohr
13c73b800aSAndreas Gohr    /** @inheritdoc */
14c73b800aSAndreas Gohr    public function dataOut() {
15c73b800aSAndreas Gohr        return [
16c73b800aSAndreas Gohr            [1, "\$conf['test'] = 1;\n"],
17c73b800aSAndreas Gohr            [0, "\$conf['test'] = 0;\n"],
18*28cc4f40SAndreas Gohr
19*28cc4f40SAndreas Gohr            ['1', "\$conf['test'] = 1;\n"],
20*28cc4f40SAndreas Gohr            ['0', "\$conf['test'] = 0;\n"],
21*28cc4f40SAndreas Gohr
22*28cc4f40SAndreas Gohr            ['on', "\$conf['test'] = 1;\n"],
23*28cc4f40SAndreas Gohr            ['off', "\$conf['test'] = 0;\n"],
24*28cc4f40SAndreas Gohr
25*28cc4f40SAndreas Gohr            ['true', "\$conf['test'] = 1;\n"],
26*28cc4f40SAndreas Gohr            ['false', "\$conf['test'] = 0;\n"],
27*28cc4f40SAndreas Gohr
28*28cc4f40SAndreas Gohr            ['On', "\$conf['test'] = 1;\n"],
29*28cc4f40SAndreas Gohr            ['Off', "\$conf['test'] = 0;\n"],
30*28cc4f40SAndreas Gohr
31*28cc4f40SAndreas Gohr            ['True', "\$conf['test'] = 1;\n"],
32*28cc4f40SAndreas Gohr            ['False', "\$conf['test'] = 0;\n"],
33*28cc4f40SAndreas Gohr
34*28cc4f40SAndreas Gohr            [true, "\$conf['test'] = 1;\n"],
35*28cc4f40SAndreas Gohr            [false, "\$conf['test'] = 0;\n"],
36*28cc4f40SAndreas Gohr
37*28cc4f40SAndreas Gohr            [3, "\$conf['test'] = 1;\n"],
38*28cc4f40SAndreas Gohr            ['3', "\$conf['test'] = 1;\n"],
39*28cc4f40SAndreas Gohr
40*28cc4f40SAndreas Gohr            ['', "\$conf['test'] = 0;\n"],
41*28cc4f40SAndreas Gohr            ['   ', "\$conf['test'] = 0;\n"],
42c73b800aSAndreas Gohr        ];
43c73b800aSAndreas Gohr    }
44c73b800aSAndreas Gohr
456dd8fd81SAndreas Gohr    /** @inheritdoc */
466dd8fd81SAndreas Gohr    public function dataShouldBeSaved() {
476dd8fd81SAndreas Gohr        return [
486dd8fd81SAndreas Gohr            [0, null, false],
496dd8fd81SAndreas Gohr            [1, null, false],
506dd8fd81SAndreas Gohr            [0, 0, false],
516dd8fd81SAndreas Gohr            [1, 1, false],
526dd8fd81SAndreas Gohr            [0, 1, true],
536dd8fd81SAndreas Gohr            [1, 0, true],
546dd8fd81SAndreas Gohr
556dd8fd81SAndreas Gohr            ['0', '0', false],
566dd8fd81SAndreas Gohr            ['1', '1', false],
576dd8fd81SAndreas Gohr            ['0', '1', true],
586dd8fd81SAndreas Gohr            ['1', '0', true],
596dd8fd81SAndreas Gohr
606dd8fd81SAndreas Gohr            ['0', 0, false],
616dd8fd81SAndreas Gohr            ['1', 1, false],
626dd8fd81SAndreas Gohr            ['0', 1, true],
636dd8fd81SAndreas Gohr            ['1', 0, true],
646dd8fd81SAndreas Gohr
656dd8fd81SAndreas Gohr            [0, '0', false],
666dd8fd81SAndreas Gohr            [1, '1', false],
676dd8fd81SAndreas Gohr            [0, '1', true],
686dd8fd81SAndreas Gohr            [1, '0', true],
696dd8fd81SAndreas Gohr        ];
706dd8fd81SAndreas Gohr    }
716dd8fd81SAndreas Gohr
72c73b800aSAndreas Gohr}
73