xref: /dokuwiki/lib/plugins/config/_test/Setting/SettingTest.php (revision c73b800af811677f6f1736661979eb0190c08e01)
198a151baSAndreas Gohr<?php
298a151baSAndreas Gohr
398a151baSAndreas Gohrnamespace dokuwiki\plugin\config\test\Setting;
498a151baSAndreas Gohr
598a151baSAndreas Gohruse dokuwiki\plugin\config\core\Setting\Setting;
698a151baSAndreas Gohr
798a151baSAndreas Gohr/**
898a151baSAndreas Gohr * @group plugin_config
998a151baSAndreas Gohr * @group admin_plugins
1098a151baSAndreas Gohr * @group plugins
1198a151baSAndreas Gohr * @group bundled_plugins
1298a151baSAndreas Gohr */
1398a151baSAndreas Gohrclass SettingTest extends AbstractSettingTest {
1498a151baSAndreas Gohr
1598a151baSAndreas Gohr    /**
1698a151baSAndreas Gohr     * Dataprovider for test out
1798a151baSAndreas Gohr     *
1898a151baSAndreas Gohr     * @return array
1998a151baSAndreas Gohr     */
2098a151baSAndreas Gohr    public function dataOut() {
2198a151baSAndreas Gohr        return [
2298a151baSAndreas Gohr            ['bar', "\$conf['test'] = 'bar';\n"],
2398a151baSAndreas Gohr            ["foo'bar", "\$conf['test'] = 'foo\\'bar';\n"],
2498a151baSAndreas Gohr        ];
2598a151baSAndreas Gohr    }
2698a151baSAndreas Gohr
2798a151baSAndreas Gohr    /**
2898a151baSAndreas Gohr     * Check the output
2998a151baSAndreas Gohr     *
3098a151baSAndreas Gohr     * @param mixed $in The value to initialize the setting with
3198a151baSAndreas Gohr     * @param string $out The expected output (for conf[test])
3298a151baSAndreas Gohr     * @dataProvider dataOut
3398a151baSAndreas Gohr     */
3498a151baSAndreas Gohr    public function testOut($in, $out) {
3598a151baSAndreas Gohr        /** @var Setting $setting */
36*c73b800aSAndreas Gohr        $setting = new $this->class('test');
3798a151baSAndreas Gohr        $setting->initialize('ignore', $in);
3898a151baSAndreas Gohr
3998a151baSAndreas Gohr        $this->assertEquals($out, $setting->out('conf'));
4098a151baSAndreas Gohr    }
4198a151baSAndreas Gohr}
42