Completed
Push — patch-meta ( 5bd3e7 )
by Tobias
08:29
created

CacheSpec   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 1
cbo 2
dl 0
loc 21
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A let() 0 4 1
A it_is_a_specification() 0 4 1
A it_caches_query_for_given_time() 0 6 1
1
<?php
2
3
namespace tests\Happyr\DoctrineSpecification\Result;
4
5
use Doctrine\ORM\AbstractQuery;
6
use Happyr\DoctrineSpecification\Result\Cache;
7
use PhpSpec\ObjectBehavior;
8
9
/**
10
 * @mixin Cache
11
 */
12
class CacheSpec extends ObjectBehavior
13
{
14
    private $lifetime = 3600;
15
16
    public function let()
17
    {
18
        $this->beConstructedWith($this->lifetime);
19
    }
20
21
    public function it_is_a_specification()
22
    {
23
        $this->shouldBeAnInstanceOf('Happyr\DoctrineSpecification\Result\ResultModifier');
24
    }
25
26
    public function it_caches_query_for_given_time(AbstractQuery $query)
27
    {
28
        $query->setResultCacheLifetime($this->lifetime)->shouldBeCalled();
29
30
        $this->modify($query);
31
    }
32
}
33