Completed
Push — 3.x ( 839353...0c5d0b )
by Grégoire
02:14
created

FilterWithQueryBuilderTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getQueryBuilder() 0 4 1
B setUp() 0 24 1
1
<?php
2
3
/*
4
 * This file is part of the Sonata Project package.
5
 *
6
 * (c) Thomas Rabaix <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Sonata\DoctrineMongoDBAdminBundle\Tests\Filter;
13
14
abstract class FilterWithQueryBuilderTest extends \PHPUnit_Framework_TestCase
15
{
16
    private $queryBuilder = null;
17
    private $expr = null;
18
19
    public function setUp()
20
    {
21
        $this->queryBuilder = $this->getMockBuilder('Doctrine\ODM\MongoDB\Query\Builder')
22
                ->disableOriginalConstructor()
23
                ->getMock();
24
        $this->queryBuilder
25
                ->expects($this->any())
26
                ->method('field')
27
                ->will($this->returnSelf())
28
        ;
29
        $this->expr = $this->getMockBuilder('Doctrine\ODM\MongoDB\Query\Expr')
30
            ->disableOriginalConstructor()
31
            ->getMock();
32
        $this->expr
33
            ->expects($this->any())
34
            ->method('field')
35
            ->will($this->returnSelf())
36
        ;
37
        $this->queryBuilder
38
            ->expects($this->any())
39
            ->method('expr')
40
            ->will($this->returnValue($this->expr))
41
        ;
42
    }
43
44
    protected function getQueryBuilder()
45
    {
46
        return $this->queryBuilder;
47
    }
48
}
49