. namespace core_cache; /** * PHPunit tests for the cache_helper class. * * @package core_cache * @category cache * @copyright 2023 Andrew Lyons * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @covers \core_cache\helper */ final class cache_helper_test extends \advanced_testcase { /** * Test the result_found method. * * @param mixed $value * @param bool $expected * @dataProvider result_found_provider */ public function test_result_found($value, bool $expected): void { $this->assertEquals($expected, helper::result_found($value)); } /** * Data provider for result_found tests. * * @return array */ public static function result_found_provider(): array { return [ // Only false values are considered as not found. [false, false], // The rest are considered valid values. [null, true], [0, true], ['', true], [[], true], [new \stdClass(), true], [true, true], [1, true], ['a', true], [[1], true], [new \stdClass(), true], ]; } }