MemberOfXSpec::let()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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\Filter;
15
16
use Doctrine\Common\Collections\ArrayCollection;
17
use Doctrine\ORM\QueryBuilder;
18
use Happyr\DoctrineSpecification\Filter\Filter;
19
use Happyr\DoctrineSpecification\Filter\MemberOfX;
20
use PhpSpec\ObjectBehavior;
21
22
/**
23
 * @mixin MemberOfX
24
 */
25
class MemberOfXSpec extends ObjectBehavior
26
{
27
    public function let()
28
    {
29
        $this->beConstructedWith(18, 'age', 'a');
30
    }
31
32
    public function it_is_initializable()
33
    {
34
        $this->shouldHaveType(MemberOfX::class);
35
    }
36
37
    public function it_is_an_expression()
38
    {
39
        $this->shouldBeAnInstanceOf(Filter::class);
40
    }
41
42
    public function it_returns_expression_func_object(QueryBuilder $qb, ArrayCollection $parameters)
43
    {
44
        $qb->getParameters()->willReturn($parameters);
45
        $parameters->count()->willReturn(10);
46
47
        $qb->setParameter('comparison_10', 18, null)->shouldBeCalled();
48
49
        $this->getFilter($qb, null)->shouldReturn(':comparison_10 MEMBER OF a.age');
50
    }
51
}
52