Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
<?php
2
// This file is part of Moodle - http://moodle.org/
3
//
4
// This program is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8
//
9
// This program is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
// GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
16
 
17
declare(strict_types=1);
18
 
19
namespace testUtils;
20
 
21
use mod_edusharing\AppConfig;
22
 
23
/**
24
 * Class FakeConfig
25
 *
26
 * This can be used to inject a basic fake config into UtilityFunctions for testing
27
 *
28
 * @author Marian Ziegler <ziegler@edu-sharing.net>
29
 * @package mod_edusharing
30
 */
31
class FakeConfig implements AppConfig {
32
 
33
    /**
34
     * @var array
35
     */
36
    private array $entries = [];
37
 
38
    /**
39
     * Function set
40
     *
41
     * @param string $name
42
     * @param mixed $value
43
     * @return void
44
     */
45
    public function set(string $name, mixed $value): void {
46
        $this->entries[$name] = $value;
47
    }
48
 
49
    /**
50
     * Function get
51
     *
52
     * @param string $name
53
     * @return mixed
54
     */
55
    public function get(string $name): mixed {
56
        return $this->entries[$name] ?? false;
57
    }
58
 
59
    /**
60
     * Function setEntries
61
     *
62
     * @param array $entries
63
     * @return void
64
     */
65
    public function set_entries(array $entries): void {
66
        $this->entries = $entries;
67
    }
68
}