JoinSpec::it_is_a_specification()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
dl 4
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\Query;
15
16
use Doctrine\ORM\QueryBuilder;
17
use Happyr\DoctrineSpecification\Query\Join;
18
use Happyr\DoctrineSpecification\Query\QueryModifier;
19
use PhpSpec\ObjectBehavior;
20
21
/**
22
 * @mixin Join
23
 */
24 View Code Duplication
class JoinSpec extends ObjectBehavior
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
25
{
26
    public function let()
27
    {
28
        $this->beConstructedWith('user', 'authUser', 'a');
29
    }
30
31
    public function it_is_a_specification()
32
    {
33
        $this->shouldHaveType(QueryModifier::class);
34
    }
35
36
    public function it_joins_with_default_dql_alias(QueryBuilder $qb)
37
    {
38
        $qb->join('a.user', 'authUser')->shouldBeCalled();
39
        $this->modify($qb, 'a');
40
    }
41
42
    public function it_uses_local_alias_if_global_was_not_set(QueryBuilder $qb)
43
    {
44
        $this->beConstructedWith('user', 'authUser');
45
        $qb->join('b.user', 'authUser')->shouldBeCalled();
46
        $this->modify($qb, 'b');
47
    }
48
}
49