xref: /dokuwiki/lib/plugins/config/_test/Setting/SettingOnoffTest.php (revision 6dd8fd818073602607c15bd93e7894b560abef71)
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"],
18c73b800aSAndreas Gohr            // FIXME we probably want to handle other values better
19c73b800aSAndreas Gohr        ];
20c73b800aSAndreas Gohr    }
21c73b800aSAndreas Gohr
22*6dd8fd81SAndreas Gohr    /** @inheritdoc */
23*6dd8fd81SAndreas Gohr    public function dataShouldBeSaved() {
24*6dd8fd81SAndreas Gohr        return [
25*6dd8fd81SAndreas Gohr            [0, null, false],
26*6dd8fd81SAndreas Gohr            [1, null, false],
27*6dd8fd81SAndreas Gohr            [0, 0, false],
28*6dd8fd81SAndreas Gohr            [1, 1, false],
29*6dd8fd81SAndreas Gohr            [0, 1, true],
30*6dd8fd81SAndreas Gohr            [1, 0, true],
31*6dd8fd81SAndreas Gohr
32*6dd8fd81SAndreas Gohr            ['0', '0', false],
33*6dd8fd81SAndreas Gohr            ['1', '1', false],
34*6dd8fd81SAndreas Gohr            ['0', '1', true],
35*6dd8fd81SAndreas Gohr            ['1', '0', true],
36*6dd8fd81SAndreas Gohr
37*6dd8fd81SAndreas Gohr            ['0', 0, false],
38*6dd8fd81SAndreas Gohr            ['1', 1, false],
39*6dd8fd81SAndreas Gohr            ['0', 1, true],
40*6dd8fd81SAndreas Gohr            ['1', 0, true],
41*6dd8fd81SAndreas Gohr
42*6dd8fd81SAndreas Gohr            [0, '0', false],
43*6dd8fd81SAndreas Gohr            [1, '1', false],
44*6dd8fd81SAndreas Gohr            [0, '1', true],
45*6dd8fd81SAndreas Gohr            [1, '0', true],
46*6dd8fd81SAndreas Gohr        ];
47*6dd8fd81SAndreas Gohr    }
48*6dd8fd81SAndreas Gohr
49c73b800aSAndreas Gohr}
50