AbstractTestCase   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 116
Duplicated Lines 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
wmc 1
eloc 29
c 1
b 1
f 0
dl 0
loc 116
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 41 1
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;
13
14
use Symfony\Component\HttpFoundation\Request;
15
use WBW\Bundle\CoreBundle\Tests\AbstractTestCase as TestCase;
16
use WBW\Bundle\JQuery\DataTablesBundle\Api\DataTablesColumnInterface;
17
use WBW\Bundle\JQuery\DataTablesBundle\Api\DataTablesMappingInterface;
18
use WBW\Bundle\JQuery\DataTablesBundle\Api\DataTablesOptionsInterface;
19
use WBW\Bundle\JQuery\DataTablesBundle\Api\DataTablesOrderInterface;
20
use WBW\Bundle\JQuery\DataTablesBundle\Api\DataTablesRequestInterface;
21
use WBW\Bundle\JQuery\DataTablesBundle\Api\DataTablesResponseInterface;
22
use WBW\Bundle\JQuery\DataTablesBundle\Api\DataTablesSearchInterface;
23
use WBW\Bundle\JQuery\DataTablesBundle\Api\DataTablesWrapperInterface;
24
use WBW\Bundle\JQuery\DataTablesBundle\Provider\DataTablesProviderInterface;
25
use WBW\Bundle\JQuery\DataTablesBundle\Tests\Fixtures\TestFixtures;
26
27
/**
28
 * Abstract framework test case.
29
 *
30
 * @author webeweb <https://github.com/webeweb>
31
 * @package WBW\Bundle\JQuery\DataTablesBundle\Tests
32
 * @abstract
33
 */
34
abstract class AbstractTestCase extends TestCase {
35
36
    /**
37
     * DataTables column.
38
     *
39
     * @var DataTablesColumnInterface|null
40
     */
41
    protected $dtColumn;
42
43
    /**
44
     * DataTables mapping.
45
     *
46
     * @var DataTablesMappingInterface|null
47
     */
48
    protected $dtMapping;
49
50
    /**
51
     * DataTables option.
52
     *
53
     * @var DataTablesOptionsInterface|null
54
     */
55
    protected $dtOptions;
56
57
    /**
58
     * DataTables order.
59
     *
60
     * @var DataTablesOrderInterface|null
61
     */
62
    protected $dtOrder;
63
64
    /**
65
     * DataTables provider.
66
     *
67
     * @var DataTablesProviderInterface|null
68
     */
69
    protected $dtProvider;
70
71
    /**
72
     * DataTables request.
73
     *
74
     * @var DataTablesRequestInterface|null
75
     */
76
    protected $dtRequest;
77
78
    /**
79
     * DataTables response.
80
     *
81
     * @var DataTablesResponseInterface|null
82
     */
83
    protected $dtResponse;
84
85
    /**
86
     * DataTables search.
87
     *
88
     * @var DataTablesSearchInterface|null
89
     */
90
    protected $dtSearch;
91
92
    /**
93
     * DataTables wrapper.
94
     *
95
     * @var DataTablesWrapperInterface|null
96
     */
97
    protected $dtWrapper;
98
99
    /**
100
     * Request.
101
     *
102
     * @var Request
103
     */
104
    protected $request;
105
106
    /**
107
     * {@inheritDoc}
108
     */
109
    protected function setUp(): void {
110
        parent::setUp();
111
112
        // Set a DataTables mapping mock.
113
        $this->dtMapping = $this->getMockBuilder(DataTablesMappingInterface::class)->getMock();
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->getMockBuilder(WB...face::class)->getMock() of type PHPUnit\Framework\MockObject\MockObject is incompatible with the declared type WBW\Bundle\JQuery\DataTa...esMappingInterface|null of property $dtMapping.

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..

Loading history...
114
        $this->dtMapping->expects($this->any())->method("getColumn")->willReturn("column");
115
        $this->dtMapping->expects($this->any())->method("getPrefix")->willReturn("prefix");
116
117
        // Set a DataTables column mock.
118
        $this->dtColumn = $this->getMockBuilder(DataTablesColumnInterface::class)->getMock();
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->getMockBuilder(WB...face::class)->getMock() of type PHPUnit\Framework\MockObject\MockObject is incompatible with the declared type WBW\Bundle\JQuery\DataTa...lesColumnInterface|null of property $dtColumn.

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..

Loading history...
119
        $this->dtColumn->expects($this->any())->method("getData")->willReturn("data");
120
        $this->dtColumn->expects($this->any())->method("getMapping")->willReturn($this->dtMapping);
121
122
        // Set a DataTables options mock.
123
        $this->dtOptions = $this->getMockBuilder(DataTablesOptionsInterface::class)->getMock();
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->getMockBuilder(WB...face::class)->getMock() of type PHPUnit\Framework\MockObject\MockObject is incompatible with the declared type WBW\Bundle\JQuery\DataTa...esOptionsInterface|null of property $dtOptions.

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..

Loading history...
124
125
        // Set a DataTables order mock.
126
        $this->dtOrder = $this->getMockBuilder(DataTablesOrderInterface::class)->getMock();
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->getMockBuilder(WB...face::class)->getMock() of type PHPUnit\Framework\MockObject\MockObject is incompatible with the declared type WBW\Bundle\JQuery\DataTa...blesOrderInterface|null of property $dtOrder.

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..

Loading history...
127
128
        // Set a DataTables provider mock.
129
        $this->dtProvider = $this->getMockBuilder(DataTablesProviderInterface::class)->getMock();
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->getMockBuilder(WB...face::class)->getMock() of type PHPUnit\Framework\MockObject\MockObject is incompatible with the declared type WBW\Bundle\JQuery\DataTa...sProviderInterface|null of property $dtProvider.

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..

Loading history...
130
131
        // Set a DataTables request mock.
132
        $this->dtRequest = $this->getMockBuilder(DataTablesRequestInterface::class)->getMock();
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->getMockBuilder(WB...face::class)->getMock() of type PHPUnit\Framework\MockObject\MockObject is incompatible with the declared type WBW\Bundle\JQuery\DataTa...esRequestInterface|null of property $dtRequest.

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..

Loading history...
133
        $this->dtRequest->expects($this->any())->method("getDraw")->willReturn(0);
134
135
        // Set a DataTables response mock.
136
        $this->dtResponse = $this->getMockBuilder(DataTablesResponseInterface::class)->getMock();
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->getMockBuilder(WB...face::class)->getMock() of type PHPUnit\Framework\MockObject\MockObject is incompatible with the declared type WBW\Bundle\JQuery\DataTa...sResponseInterface|null of property $dtResponse.

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..

Loading history...
137
138
        // Set a DataTables search mock.
139
        $this->dtSearch = $this->getMockBuilder(DataTablesSearchInterface::class)->getMock();
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->getMockBuilder(WB...face::class)->getMock() of type PHPUnit\Framework\MockObject\MockObject is incompatible with the declared type WBW\Bundle\JQuery\DataTa...lesSearchInterface|null of property $dtSearch.

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..

Loading history...
140
141
        // Set a DataTables wrapper mock.
142
        $this->dtWrapper = TestFixtures::getWrapper();
143
144
        // Set the request parameters.
145
        $get  = ["query" => "query"];
146
        $post = array_merge(TestFixtures::getPostData(), ["request" => "request"]);
147
148
        // Set a DataTables request mock.
149
        $this->request = new Request($get, $post, [], [], [], ["REQUEST_METHOD" => "POST"]);
150
    }
151
}
152