HavingSpec   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 3
dl 0
loc 25
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A let() 0 4 1
A it_is_a_having() 0 4 1
A it_is_a_query_modifier() 0 4 1
A it_add_having() 0 7 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\Query;
15
16
use Doctrine\ORM\QueryBuilder;
17
use Happyr\DoctrineSpecification\Filter\Filter;
18
use Happyr\DoctrineSpecification\Query\Having;
19
use Happyr\DoctrineSpecification\Query\QueryModifier;
20
use PhpSpec\ObjectBehavior;
21
22
/**
23
 * @mixin Having
24
 */
25
class HavingSpec extends ObjectBehavior
26
{
27
    public function let(Filter $filter)
28
    {
29
        $this->beConstructedWith($filter);
30
    }
31
32
    public function it_is_a_having()
33
    {
34
        $this->shouldBeAnInstanceOf(Having::class);
35
    }
36
37
    public function it_is_a_query_modifier()
38
    {
39
        $this->shouldHaveType(QueryModifier::class);
40
    }
41
42
    public function it_add_having(QueryBuilder $qb, Filter $filter)
43
    {
44
        $this->beConstructedWith($filter);
45
        $filter->getFilter($qb, 'a')->willReturn('foo = :bar');
46
        $qb->having('foo = :bar')->shouldBeCalled();
47
        $this->modify($qb, 'a');
48
    }
49
}
50