|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
|
|
4
|
|
|
namespace Aimeos\Aimeos\Tests\Unit\Controller; |
|
5
|
|
|
|
|
6
|
|
|
|
|
7
|
|
|
class CatalogControllerTest |
|
8
|
|
|
extends \TYPO3\CMS\Core\Tests\UnitTestCase |
|
|
|
|
|
|
9
|
|
|
{ |
|
10
|
|
|
private $object; |
|
11
|
|
|
|
|
12
|
|
|
|
|
13
|
|
|
public function setUp() |
|
14
|
|
|
{ |
|
15
|
|
|
\Aimeos\Aimeos\Base::aimeos(); // initialize autoloader |
|
16
|
|
|
|
|
17
|
|
|
$this->object = $this->getAccessibleMock('Aimeos\\Aimeos\\Controller\\CatalogController', array('dummy')); |
|
18
|
|
|
|
|
19
|
|
|
$objManager = new \TYPO3\CMS\Extbase\Object\ObjectManager(); |
|
|
|
|
|
|
20
|
|
|
|
|
21
|
|
|
$uriBuilder = $objManager->get('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Routing\\UriBuilder'); |
|
22
|
|
|
$response = $objManager->get('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Response'); |
|
23
|
|
|
$request = $objManager->get('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Request'); |
|
24
|
|
|
|
|
25
|
|
|
$uriBuilder->setRequest($request); |
|
26
|
|
|
|
|
27
|
|
|
if (method_exists($response, 'setRequest')) { |
|
28
|
|
|
$response->setRequest($request); |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
$this->object->_set('uriBuilder', $uriBuilder); |
|
32
|
|
|
$this->object->_set('response', $response); |
|
33
|
|
|
$this->object->_set('request', $request); |
|
34
|
|
|
|
|
35
|
|
|
$this->object->_call('initializeAction'); |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
|
|
39
|
|
|
public function tearDown() |
|
40
|
|
|
{ |
|
41
|
|
|
unset($this->object); |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* @test |
|
47
|
|
|
*/ |
|
48
|
|
|
public function countAction() |
|
49
|
|
|
{ |
|
50
|
|
|
$name = '\\Aimeos\\Client\\Html\\Catalog\\Count\\Standard'; |
|
51
|
|
|
$client = $this->getMock($name, array('getBody', 'getHeader', 'process'), [], '', false); |
|
52
|
|
|
|
|
53
|
|
|
$client->expects($this->once())->method('getBody')->will($this->returnValue('body')); |
|
54
|
|
|
$client->expects($this->once())->method('getHeader')->will($this->returnValue('header')); |
|
55
|
|
|
|
|
56
|
|
|
\Aimeos\Client\Html\Catalog\Count\Factory::injectClient($name, $client); |
|
|
|
|
|
|
57
|
|
|
$output = $this->object->countAction(); |
|
58
|
|
|
\Aimeos\Client\Html\Catalog\Count\Factory::injectClient($name, null); |
|
59
|
|
|
|
|
60
|
|
|
$this->assertEquals('body', $output); |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* @test |
|
66
|
|
|
*/ |
|
67
|
|
|
public function detailAction() |
|
68
|
|
|
{ |
|
69
|
|
|
$name = '\\Aimeos\\Client\\Html\\Catalog\\Detail\\Standard'; |
|
70
|
|
|
$client = $this->getMock($name, array('getBody', 'getHeader', 'process'), [], '', false); |
|
71
|
|
|
|
|
72
|
|
|
$client->expects($this->once())->method('getBody')->will($this->returnValue('body')); |
|
73
|
|
|
$client->expects($this->once())->method('getHeader')->will($this->returnValue('header')); |
|
74
|
|
|
|
|
75
|
|
|
\Aimeos\Client\Html\Catalog\Detail\Factory::injectClient($name, $client); |
|
|
|
|
|
|
76
|
|
|
$output = $this->object->detailAction(); |
|
77
|
|
|
\Aimeos\Client\Html\Catalog\Detail\Factory::injectClient($name, null); |
|
78
|
|
|
|
|
79
|
|
|
$this->assertEquals('body', $output); |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
|
|
|
|
83
|
|
|
/** |
|
84
|
|
|
* @test |
|
85
|
|
|
*/ |
|
86
|
|
|
public function filterAction() |
|
87
|
|
|
{ |
|
88
|
|
|
$name = '\\Aimeos\\Client\\Html\\Catalog\\Filter\\Standard'; |
|
89
|
|
|
$client = $this->getMock($name, array('getBody', 'getHeader', 'process'), [], '', false); |
|
90
|
|
|
|
|
91
|
|
|
$client->expects($this->once())->method('getBody')->will($this->returnValue('body')); |
|
92
|
|
|
$client->expects($this->once())->method('getHeader')->will($this->returnValue('header')); |
|
93
|
|
|
|
|
94
|
|
|
\Aimeos\Client\Html\Catalog\Filter\Factory::injectClient($name, $client); |
|
|
|
|
|
|
95
|
|
|
$output = $this->object->filterAction(); |
|
96
|
|
|
\Aimeos\Client\Html\Catalog\Filter\Factory::injectClient($name, null); |
|
97
|
|
|
|
|
98
|
|
|
$this->assertEquals('body', $output); |
|
99
|
|
|
} |
|
100
|
|
|
|
|
101
|
|
|
|
|
102
|
|
|
/** |
|
103
|
|
|
* @test |
|
104
|
|
|
*/ |
|
105
|
|
|
public function listAction() |
|
106
|
|
|
{ |
|
107
|
|
|
$name = '\\Aimeos\\Client\\Html\\Catalog\\Lists\\Standard'; |
|
108
|
|
|
$client = $this->getMock($name, array('getBody', 'getHeader', 'process'), [], '', false); |
|
109
|
|
|
|
|
110
|
|
|
$client->expects($this->once())->method('getBody')->will($this->returnValue('body')); |
|
111
|
|
|
$client->expects($this->once())->method('getHeader')->will($this->returnValue('header')); |
|
112
|
|
|
|
|
113
|
|
|
\Aimeos\Client\Html\Catalog\Lists\Factory::injectClient($name, $client); |
|
|
|
|
|
|
114
|
|
|
$output = $this->object->listAction(); |
|
115
|
|
|
\Aimeos\Client\Html\Catalog\Lists\Factory::injectClient($name, null); |
|
116
|
|
|
|
|
117
|
|
|
$this->assertEquals('body', $output); |
|
118
|
|
|
} |
|
119
|
|
|
|
|
120
|
|
|
|
|
121
|
|
|
/** |
|
122
|
|
|
* @test |
|
123
|
|
|
*/ |
|
124
|
|
|
public function suggestAction() |
|
125
|
|
|
{ |
|
126
|
|
|
$name = '\\Aimeos\\Client\\Html\\Catalog\\Suggest\\Standard'; |
|
127
|
|
|
$client = $this->getMock($name, array('getBody', 'getHeader', 'process'), [], '', false); |
|
128
|
|
|
|
|
129
|
|
|
$client->expects($this->once())->method('getBody')->will($this->returnValue('body')); |
|
130
|
|
|
$client->expects($this->once())->method('getHeader')->will($this->returnValue('header')); |
|
131
|
|
|
|
|
132
|
|
|
\Aimeos\Client\Html\Catalog\Suggest\Factory::injectClient($name, $client); |
|
|
|
|
|
|
133
|
|
|
$output = $this->object->suggestAction(); |
|
134
|
|
|
\Aimeos\Client\Html\Catalog\Suggest\Factory::injectClient($name, null); |
|
135
|
|
|
|
|
136
|
|
|
$this->assertEquals('body', $output); |
|
137
|
|
|
} |
|
138
|
|
|
|
|
139
|
|
|
|
|
140
|
|
|
/** |
|
141
|
|
|
* @test |
|
142
|
|
|
*/ |
|
143
|
|
|
public function sessionAction() |
|
144
|
|
|
{ |
|
145
|
|
|
$name = '\\Aimeos\\Client\\Html\\Catalog\\Session\\Standard'; |
|
146
|
|
|
$client = $this->getMock($name, array('getBody', 'getHeader', 'process'), [], '', false); |
|
147
|
|
|
|
|
148
|
|
|
$client->expects($this->once())->method('getBody')->will($this->returnValue('body')); |
|
149
|
|
|
$client->expects($this->once())->method('getHeader')->will($this->returnValue('header')); |
|
150
|
|
|
|
|
151
|
|
|
\Aimeos\Client\Html\Catalog\Session\Factory::injectClient($name, $client); |
|
|
|
|
|
|
152
|
|
|
$output = $this->object->sessionAction(); |
|
153
|
|
|
\Aimeos\Client\Html\Catalog\Session\Factory::injectClient($name, null); |
|
154
|
|
|
|
|
155
|
|
|
$this->assertEquals('body', $output); |
|
156
|
|
|
} |
|
157
|
|
|
|
|
158
|
|
|
|
|
159
|
|
|
/** |
|
160
|
|
|
* @test |
|
161
|
|
|
*/ |
|
162
|
|
|
public function stageAction() |
|
163
|
|
|
{ |
|
164
|
|
|
$name = '\\Aimeos\\Client\\Html\\Catalog\\Stage\\Standard'; |
|
165
|
|
|
$client = $this->getMock($name, array('getBody', 'getHeader', 'process'), [], '', false); |
|
166
|
|
|
|
|
167
|
|
|
$client->expects($this->once())->method('getBody')->will($this->returnValue('body')); |
|
168
|
|
|
$client->expects($this->once())->method('getHeader')->will($this->returnValue('header')); |
|
169
|
|
|
|
|
170
|
|
|
\Aimeos\Client\Html\Catalog\Stage\Factory::injectClient($name, $client); |
|
|
|
|
|
|
171
|
|
|
$output = $this->object->stageAction(); |
|
172
|
|
|
\Aimeos\Client\Html\Catalog\Stage\Factory::injectClient($name, null); |
|
173
|
|
|
|
|
174
|
|
|
$this->assertEquals('body', $output); |
|
175
|
|
|
} |
|
176
|
|
|
|
|
177
|
|
|
|
|
178
|
|
|
/** |
|
179
|
|
|
* @test |
|
180
|
|
|
*/ |
|
181
|
|
|
public function stockAction() |
|
182
|
|
|
{ |
|
183
|
|
|
$name = '\\Aimeos\\Client\\Html\\Catalog\\Stock\\Standard'; |
|
184
|
|
|
$client = $this->getMock($name, array('getBody', 'getHeader', 'process'), [], '', false); |
|
185
|
|
|
|
|
186
|
|
|
$client->expects($this->once())->method('getBody')->will($this->returnValue('body')); |
|
187
|
|
|
$client->expects($this->once())->method('getHeader')->will($this->returnValue('header')); |
|
188
|
|
|
|
|
189
|
|
|
\Aimeos\Client\Html\Catalog\Stock\Factory::injectClient($name, $client); |
|
|
|
|
|
|
190
|
|
|
$output = $this->object->stockAction(); |
|
191
|
|
|
\Aimeos\Client\Html\Catalog\Stock\Factory::injectClient($name, null); |
|
192
|
|
|
|
|
193
|
|
|
$this->assertEquals('body', $output); |
|
194
|
|
|
} |
|
195
|
|
|
} |
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