1<?php
2/**
3 * OrangeHRM Enterprise is a closed sourced comprehensive Human Resource Management (HRM)
4 * System that captures all the essential functionalities required for any enterprise.
5 * Copyright (C) 2006 OrangeHRM Inc., http://www.orangehrm.com
6 *
7 * OrangeHRM Inc is the owner of the patent, copyright, trade secrets, trademarks and any
8 * other intellectual property rights which subsist in the Licensed Materials. OrangeHRM Inc
9 * is the owner of the media / downloaded OrangeHRM Enterprise software files on which the
10 * Licensed Materials are received. Title to the Licensed Materials and media shall remain
11 * vested in OrangeHRM Inc. For the avoidance of doubt title and all intellectual property
12 * rights to any design, new software, new protocol, new interface, enhancement, update,
13 * derivative works, revised screen text or any other items that OrangeHRM Inc creates for
14 * Customer shall remain vested in OrangeHRM Inc. Any rights not expressly granted herein are
15 * reserved to OrangeHRM Inc.
16 *
17 * Please refer http://www.orangehrm.com/Files/OrangeHRM_Commercial_License.pdf for the license which includes terms and conditions on using this software.
18 *
19 */
20
21/**
22 * @group Core
23 */
24class ohrmKeyValueCacheTest extends PHPUnit_Framework_TestCase {
25
26
27    protected function setUp() {
28    }
29
30    protected function tearDown() {
31        $fileSystem = new sfFilesystem();
32        $fileSystem->remove(sfFinder::type('file')->discard('.sf')->in(sfConfig::get('sf_cache_dir') . '/ohrmKeyValueCache'));
33    }
34
35    public function testGetNoValues() {
36        $keyValueCache = new ohrmKeyValueCache('testGetNoValues', function() { return array(); });
37        $this->assertNull($keyValueCache->get("ABC"));
38    }
39
40    public function testGetManyValues() {
41        $keyValueCache = new ohrmKeyValueCache('testGetNoValues', function() {
42            return array('age' => 12, 'name' => 'john major', 'height' => 5);
43        });
44
45        $this->assertEquals(12, $keyValueCache->get("age"));
46        $this->assertEquals('john major', $keyValueCache->get("name"));
47        $this->assertEquals(5, $keyValueCache->get('height'));
48    }
49
50}
51
52