Completed
Branch master (5105da)
by Stefano
02:21
created

CacheTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
lcom 1
cbo 2
dl 0
loc 27
rs 10
c 1
b 0
f 0
1
<?php
2
3
4
class CacheTest extends PHPUnit_Framework_TestCase {
5
6
    public function __construct(){
7
      Cache::using('memory');
8
    }
9
10
    public function testSetGet(){
11
      Cache::set('test','ALPHA');
12
      $this->assertEquals('ALPHA',Cache::get('test'));
13
    }
14
15
    public function testGetUnknown(){
16
      $this->assertEquals('BETA',Cache::get('test2','BETA'));
17
      $this->assertEquals('BETA',Cache::get('test2'));
18
    }
19
20
    public function testSetDefault(){
21
      Cache::set('test','ALPHA');
22
    }
23
24
    public function testGetDefaultFromClosure(){
25
      $this->assertEquals('SLOW_DATA :)',Cache::get('test3',function(){
26
        return "SLOW_DATA :)";
27
      }) );
28
    }
29
30
}
31
32
33