1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
|
4
|
|
|
namespace Aimeos\Aimeos\Tests\Unit\Controller; |
5
|
|
|
|
6
|
|
|
|
7
|
|
|
class JqadmControllerTest |
8
|
|
|
extends \TYPO3\CMS\Core\Tests\UnitTestCase |
|
|
|
|
9
|
|
|
{ |
10
|
|
|
private $object; |
11
|
|
|
private $request; |
12
|
|
|
private $view; |
13
|
|
|
|
14
|
|
|
|
15
|
|
|
public function setUp() |
16
|
|
|
{ |
17
|
|
|
\Aimeos\Aimeos\Base::aimeos(); // initialize autoloader |
18
|
|
|
|
19
|
|
|
$this->object = $this->getAccessibleMock('Aimeos\Aimeos\Controller\JqadmController', array('dummy')); |
20
|
|
|
|
21
|
|
|
$this->request = $this->getMockBuilder('TYPO3\CMS\Extbase\Mvc\Request') |
22
|
|
|
->setMethods(array('hasArgument', 'getArgument')) |
23
|
|
|
->disableOriginalConstructor() |
24
|
|
|
->getMock(); |
25
|
|
|
|
26
|
|
|
$this->response = $this->getMockBuilder('TYPO3\CMS\Extbase\Mvc\Response') |
|
|
|
|
27
|
|
|
->setMethods(array('setHeader')) |
28
|
|
|
->disableOriginalConstructor() |
29
|
|
|
->getMock(); |
30
|
|
|
|
31
|
|
|
$this->view = $this->getMockBuilder('TYPO3\CMS\Extbase\Mvc\View\EmptyView') |
32
|
|
|
->setMethods(array('assign')) |
33
|
|
|
->disableOriginalConstructor() |
34
|
|
|
->getMock(); |
35
|
|
|
|
36
|
|
|
$uriBuilder = $this->getMockBuilder('TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder') |
37
|
|
|
->setMethods(array('buildBackendUri')) |
38
|
|
|
->disableOriginalConstructor() |
39
|
|
|
->getMock(); |
40
|
|
|
|
41
|
|
|
|
42
|
|
|
$uriBuilder->expects($this->any())->method('buildBackendUri'); |
43
|
|
|
|
44
|
|
|
$this->object->_set('uriBuilder', $uriBuilder); |
45
|
|
|
$this->object->_set('response', $this->response); |
46
|
|
|
$this->object->_set('request', $this->request); |
47
|
|
|
$this->object->_set('view', $this->view); |
48
|
|
|
|
49
|
|
|
$this->object->_call('initializeAction'); |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
|
53
|
|
|
public function tearDown() |
54
|
|
|
{ |
55
|
|
|
unset($this->object, $this->request, $this->view); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @test |
61
|
|
|
*/ |
62
|
|
|
public function fileActionCss() |
63
|
|
|
{ |
64
|
|
|
$this->request->expects($this->any())->method('getArgument') |
65
|
|
|
->will($this->returnValue('css')); |
66
|
|
|
|
67
|
|
|
$result = $this->object->fileAction(); |
68
|
|
|
|
69
|
|
|
$this->assertContains('.aimeos', $result); |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* @test |
75
|
|
|
*/ |
76
|
|
|
public function fileActionJs() |
77
|
|
|
{ |
78
|
|
|
$this->request->expects($this->any())->method('getArgument') |
79
|
|
|
->will($this->returnValue('js')); |
80
|
|
|
|
81
|
|
|
$result = $this->object->fileAction(); |
82
|
|
|
|
83
|
|
|
$this->assertContains('Aimeos = {', $result); |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* @test |
89
|
|
|
*/ |
90
|
|
|
public function copyAction() |
91
|
|
|
{ |
92
|
|
|
$this->request->expects($this->atLeastOnce())->method('hasArgument') |
93
|
|
|
->will($this->returnValue(true)); |
94
|
|
|
|
95
|
|
|
$this->request->expects($this->any())->method('getArgument') |
96
|
|
|
->will($this->onConsecutiveCalls('product', 'de', 'unittest')); |
97
|
|
|
|
98
|
|
|
$this->view->expects($this->exactly(2))->method('assign'); |
99
|
|
|
|
100
|
|
|
$this->object->copyAction(); |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* @test |
106
|
|
|
*/ |
107
|
|
|
public function createAction() |
108
|
|
|
{ |
109
|
|
|
$this->request->expects($this->atLeastOnce())->method('hasArgument') |
110
|
|
|
->will($this->returnValue(true)); |
111
|
|
|
|
112
|
|
|
$this->request->expects($this->any())->method('getArgument') |
113
|
|
|
->will($this->onConsecutiveCalls('product', 'de', 'unittest')); |
114
|
|
|
|
115
|
|
|
$this->view->expects($this->exactly(2))->method('assign'); |
116
|
|
|
|
117
|
|
|
$this->object->createAction(); |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* @test |
123
|
|
|
*/ |
124
|
|
|
public function deleteAction() |
125
|
|
|
{ |
126
|
|
|
$this->request->expects($this->atLeastOnce())->method('hasArgument') |
127
|
|
|
->will($this->returnValue(true)); |
128
|
|
|
|
129
|
|
|
$this->request->expects($this->any())->method('getArgument') |
130
|
|
|
->will($this->onConsecutiveCalls('product', 'de', 'unittest')); |
131
|
|
|
|
132
|
|
|
$this->view->expects($this->exactly(2))->method('assign'); |
133
|
|
|
|
134
|
|
|
$this->object->deleteAction(); |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
|
138
|
|
|
/** |
139
|
|
|
* @test |
140
|
|
|
*/ |
141
|
|
|
public function getAction() |
142
|
|
|
{ |
143
|
|
|
$this->request->expects($this->atLeastOnce())->method('hasArgument') |
144
|
|
|
->will($this->returnValue(true)); |
145
|
|
|
|
146
|
|
|
$this->request->expects($this->any())->method('getArgument') |
147
|
|
|
->will($this->onConsecutiveCalls('product', 'de', 'unittest')); |
148
|
|
|
|
149
|
|
|
$this->view->expects($this->exactly(2))->method('assign'); |
150
|
|
|
|
151
|
|
|
$this->object->getAction(); |
152
|
|
|
} |
153
|
|
|
|
154
|
|
|
|
155
|
|
|
/** |
156
|
|
|
* @test |
157
|
|
|
*/ |
158
|
|
|
public function saveAction() |
159
|
|
|
{ |
160
|
|
|
$this->request->expects($this->atLeastOnce())->method('hasArgument') |
161
|
|
|
->will($this->returnValue(true)); |
162
|
|
|
|
163
|
|
|
$this->request->expects($this->any())->method('getArgument') |
164
|
|
|
->will($this->onConsecutiveCalls('product', 'de', 'unittest')); |
165
|
|
|
|
166
|
|
|
$this->view->expects($this->exactly(2))->method('assign'); |
167
|
|
|
|
168
|
|
|
$this->object->saveAction(); |
169
|
|
|
} |
170
|
|
|
|
171
|
|
|
|
172
|
|
|
/** |
173
|
|
|
* @test |
174
|
|
|
*/ |
175
|
|
|
public function searchAction() |
176
|
|
|
{ |
177
|
|
|
$this->request->expects($this->atLeastOnce())->method('hasArgument') |
178
|
|
|
->will($this->returnValue(true)); |
179
|
|
|
|
180
|
|
|
$this->request->expects($this->any())->method('getArgument') |
181
|
|
|
->will($this->onConsecutiveCalls('product', 'de', 'unittest')); |
182
|
|
|
|
183
|
|
|
$this->view->expects($this->exactly(2))->method('assign'); |
184
|
|
|
|
185
|
|
|
$this->object->searchAction(); |
186
|
|
|
} |
187
|
|
|
} |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths