2 // This file is part of Moodle - http://moodle.org/
4 // Moodle 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.
9 // Moodle 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.
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/>.
20 * PHPunit tests for the cache_helper class.
24 * @copyright 2023 Andrew Lyons <andrew@nicols.co.uk>
25 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
26 * @coversDefaultClass \cache_helper
28 class cache_helper_test
extends \advanced_testcase
{
30 * Test the result_found method.
33 * @param bool $expected
34 * @dataProvider result_found_provider
35 * @covers ::result_found
37 public function test_result_found($value, bool $expected): void
{
38 $this->assertEquals($expected, \cache_helper
::result_found($value));
42 * Data provider for result_found tests.
46 public function result_found_provider(): array {
48 // Only false values are considered as not found.
51 // The rest are considered valid values.
56 [new \
stdClass(), true],
61 [new \
stdClass(), true],