|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of |
|
5
|
|
|
* |
|
6
|
|
|
* (c) symball <http://simonball.me> |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please view the LICENSE file |
|
9
|
|
|
* that was distributed with this source code. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace Symball\ReportBundle\Service; |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* Description of QueryBase |
|
16
|
|
|
* |
|
17
|
|
|
* @author Simon Ball <simonball at simonball dot me> |
|
18
|
|
|
*/ |
|
19
|
|
|
class QueryBase { |
|
20
|
|
|
public function testSetNumberDataSets() |
|
21
|
|
|
{ |
|
22
|
|
|
$query = new Query(); |
|
23
|
|
|
$query->setNumberDataSets(2); |
|
24
|
|
|
|
|
25
|
|
|
$this->assertEquals(2, $query->getNumberDataSetCount()); |
|
|
|
|
|
|
26
|
|
|
} |
|
27
|
|
|
public function testSetInvalidNumberDataSets() |
|
28
|
|
|
{ |
|
29
|
|
|
$query = new Query(); |
|
30
|
|
|
$this->expectException(\InvalidArgumentException::class); |
|
|
|
|
|
|
31
|
|
|
$query->setNumberDataSets(0); |
|
32
|
|
|
} |
|
33
|
|
|
public function testSetErroneousNumberDataSets() |
|
34
|
|
|
{ |
|
35
|
|
|
$query = new Query(); |
|
36
|
|
|
$this->expectException(\InvalidArgumentException::class); |
|
|
|
|
|
|
37
|
|
|
$query->setNumberDataSets('this is not a number!'); |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
public function testSetRepository() |
|
41
|
|
|
{ |
|
42
|
|
|
$query = new Query(); |
|
43
|
|
|
|
|
44
|
|
|
$mockRepository = $this->createMock(ObjectRepository::class); |
|
|
|
|
|
|
45
|
|
|
$query->setRepository($mockRepository); |
|
46
|
|
|
|
|
47
|
|
|
$this->assertEquals($mockRepository, $query->getRepository()); |
|
|
|
|
|
|
48
|
|
|
} |
|
49
|
|
|
public function testAddModifier() |
|
50
|
|
|
{ |
|
51
|
|
|
$query = new Query(); |
|
52
|
|
|
|
|
53
|
|
|
$options = ['value' => 'test_value', 'type' => 'equals']; |
|
54
|
|
|
$query->addModifier('test_field', $options); |
|
55
|
|
|
|
|
56
|
|
|
$this->assertEquals(['test_field' => $options], $query->getModifiers()); |
|
|
|
|
|
|
57
|
|
|
} |
|
58
|
|
|
public function testAddInvalidModifier() |
|
59
|
|
|
{ |
|
60
|
|
|
$query = new Query(); |
|
61
|
|
|
$this->expectException(\InvalidArgumentException::class); |
|
|
|
|
|
|
62
|
|
|
$query->addModifier('test_field'); |
|
63
|
|
|
} |
|
64
|
|
|
} |
|
65
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.