[1] | 1 | <?php |
---|
| 2 | /// FIXME: Tests not implemented. |
---|
| 3 | return; |
---|
| 4 | |
---|
| 5 | /** |
---|
[135] | 6 | * PHPUnit test case for Cache |
---|
[42] | 7 | * |
---|
| 8 | * The method skeletons below need to be filled in with |
---|
| 9 | * real data so that the tests will run correctly. Replace |
---|
| 10 | * all EXPECTED_VAL and PARAM strings with real data. |
---|
| 11 | * |
---|
[1] | 12 | * Created with PHPUnit_Skeleton on 2005-08-09 |
---|
| 13 | */ |
---|
| 14 | require_once 'PHPUnit.php'; |
---|
[135] | 15 | class CacheTest extends PHPUnit_TestCase { |
---|
[1] | 16 | |
---|
[135] | 17 | var $Cache; |
---|
[1] | 18 | |
---|
[135] | 19 | function CacheTest($name) |
---|
[1] | 20 | { |
---|
| 21 | $this->PHPUnit_TestCase($name); |
---|
| 22 | } |
---|
| 23 | |
---|
| 24 | function setUp() |
---|
| 25 | { |
---|
| 26 | require dirname(__FILE__) . '/_config.inc.php'; |
---|
[135] | 27 | require_once '../lib/Cache.inc.php'; |
---|
| 28 | $this->Cache =& new Cache(PARAM); |
---|
[1] | 29 | } |
---|
| 30 | |
---|
| 31 | function tearDown() |
---|
| 32 | { |
---|
[135] | 33 | unset($this->Cache); |
---|
[1] | 34 | } |
---|
| 35 | |
---|
| 36 | function test_getinstance() |
---|
| 37 | { |
---|
[135] | 38 | $result = $this->Cache->getinstance(PARAM); |
---|
[1] | 39 | $expected = EXPECTED_VAL; |
---|
| 40 | $this->assertEquals($expected, $result); |
---|
| 41 | } |
---|
| 42 | |
---|
| 43 | function test_setparam() |
---|
| 44 | { |
---|
[135] | 45 | $result = $this->Cache->setparam(PARAM); |
---|
[1] | 46 | $expected = EXPECTED_VAL; |
---|
| 47 | $this->assertEquals($expected, $result); |
---|
| 48 | } |
---|
| 49 | |
---|
| 50 | function test_getparam() |
---|
| 51 | { |
---|
[135] | 52 | $result = $this->Cache->getparam(PARAM); |
---|
[1] | 53 | $expected = EXPECTED_VAL; |
---|
| 54 | $this->assertEquals($expected, $result); |
---|
| 55 | } |
---|
| 56 | |
---|
| 57 | function test_putcache() |
---|
| 58 | { |
---|
[135] | 59 | $result = $this->Cache->putcache(PARAM); |
---|
[1] | 60 | $expected = EXPECTED_VAL; |
---|
| 61 | $this->assertEquals($expected, $result); |
---|
| 62 | } |
---|
| 63 | |
---|
| 64 | function test_getcache() |
---|
| 65 | { |
---|
[135] | 66 | $result = $this->Cache->getcache(PARAM); |
---|
[1] | 67 | $expected = EXPECTED_VAL; |
---|
| 68 | $this->assertEquals($expected, $result); |
---|
| 69 | } |
---|
| 70 | |
---|
| 71 | function test_iscached() |
---|
| 72 | { |
---|
[135] | 73 | $result = $this->Cache->iscached(PARAM); |
---|
[1] | 74 | $expected = EXPECTED_VAL; |
---|
| 75 | $this->assertEquals($expected, $result); |
---|
| 76 | } |
---|
| 77 | |
---|
| 78 | function test_breakcache() |
---|
| 79 | { |
---|
[135] | 80 | $result = $this->Cache->breakcache(PARAM); |
---|
[1] | 81 | $expected = EXPECTED_VAL; |
---|
| 82 | $this->assertEquals($expected, $result); |
---|
| 83 | } |
---|
| 84 | |
---|
| 85 | } |
---|
| 86 | // Running the test. |
---|
[135] | 87 | $suite = new PHPUnit_TestSuite('CacheTest'); |
---|
[1] | 88 | $result = PHPUnit::run($suite); |
---|
| 89 | echo $result->toString(); |
---|
| 90 | ?> |
---|