CacheSpec   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

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
/**
4
 * This file is part of the Happyr Doctrine Specification package.
5
 *
6
 * (c) Tobias Nyholm <[email protected]>
7
 *     Kacper Gunia <[email protected]>
8
 *     Peter Gribanov <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace tests\Happyr\DoctrineSpecification\Result;
15
16
use Doctrine\ORM\AbstractQuery;
17
use Happyr\DoctrineSpecification\Result\Cache;
18
use Happyr\DoctrineSpecification\Result\ResultModifier;
19
use PhpSpec\ObjectBehavior;
20
21
/**
22
 * @mixin Cache
23
 */
24
class CacheSpec extends ObjectBehavior
25
{
26
    private $lifetime = 3600;
27
28
    public function let()
29
    {
30
        $this->beConstructedWith($this->lifetime);
31
    }
32
33
    public function it_is_a_specification()
34
    {
35
        $this->shouldBeAnInstanceOf(ResultModifier::class);
36
    }
37
38
    public function it_caches_query_for_given_time(AbstractQuery $query)
39
    {
40
        $query->setResultCacheLifetime($this->lifetime)->shouldBeCalled();
41
42
        $this->modify($query);
43
    }
44
}
45