1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the jquery-datatables-bundle package. |
5
|
|
|
* |
6
|
|
|
* (c) 2018 WEBEWEB |
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 WBW\Bundle\JQuery\DataTablesBundle\Tests\Helper; |
13
|
|
|
|
14
|
|
|
use Doctrine\ORM\EntityManagerInterface; |
15
|
|
|
use Doctrine\ORM\QueryBuilder; |
16
|
|
|
use WBW\Bundle\JQuery\DataTablesBundle\Factory\DataTablesFactory; |
17
|
|
|
use WBW\Bundle\JQuery\DataTablesBundle\Helper\DataTablesRepositoryHelper; |
18
|
|
|
use WBW\Bundle\JQuery\DataTablesBundle\Tests\AbstractTestCase; |
19
|
|
|
use WBW\Bundle\JQuery\DataTablesBundle\Tests\Fixtures\TestFixtures; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* DataTables repository helper test. |
23
|
|
|
* |
24
|
|
|
* @author webeweb <https://github.com/webeweb> |
25
|
|
|
* @package WBW\Bundle\JQuery\DataTablesBundle\Tests\Helper |
26
|
|
|
*/ |
27
|
|
|
class DataTablesRepositoryHelperTest extends AbstractTestCase { |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* Query builder. |
31
|
|
|
* |
32
|
|
|
* @var QueryBuilder |
33
|
|
|
*/ |
34
|
|
|
private $queryBuilder; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* {@inheritDoc} |
38
|
|
|
*/ |
39
|
|
|
protected function setUp(): void { |
40
|
|
|
parent::setUp(); |
41
|
|
|
|
42
|
|
|
// Set an Entity manager mock. |
43
|
|
|
$this->entityManager = $this->getMockBuilder(EntityManagerInterface::class)->getMock(); |
|
|
|
|
44
|
|
|
|
45
|
|
|
// Set a Query builder mock. |
46
|
|
|
$this->queryBuilder = new QueryBuilder($this->entityManager); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Test appendOrder() |
51
|
|
|
* |
52
|
|
|
* @return void |
53
|
|
|
*/ |
54
|
|
|
public function testAppendOrder(): void { |
55
|
|
|
|
56
|
|
|
// Get a wrapper. |
57
|
|
|
$wrapper = TestFixtures::getWrapper(); |
58
|
|
|
DataTablesFactory::parseWrapper($wrapper, $this->request); |
59
|
|
|
|
60
|
|
|
DataTablesRepositoryHelper::appendOrder($this->queryBuilder, $wrapper); |
61
|
|
|
$this->assertNull(null); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* Test appendWhere() |
66
|
|
|
* |
67
|
|
|
* @return void |
68
|
|
|
*/ |
69
|
|
|
public function testAppendWhere(): void { |
70
|
|
|
|
71
|
|
|
// Get a wrapper. |
72
|
|
|
$wrapper = TestFixtures::getWrapper(); |
73
|
|
|
DataTablesFactory::parseWrapper($wrapper, $this->request); |
74
|
|
|
|
75
|
|
|
DataTablesRepositoryHelper::appendWhere($this->queryBuilder, $wrapper); |
76
|
|
|
$this->assertNull(null); |
77
|
|
|
} |
78
|
|
|
} |
79
|
|
|
|
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..