@@ -24,8 +24,8 @@ discard block |
||
24 | 24 | { |
25 | 25 | $this->context = \TestHelper::getContext(); |
26 | 26 | $this->editor = $this->context->getEditor(); |
27 | - $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager( $this->context, 'FosUser' ); |
|
28 | - $this->object = $manager->getSubManager( 'lists', 'FosUser' ); |
|
27 | + $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager($this->context, 'FosUser'); |
|
28 | + $this->object = $manager->getSubManager('lists', 'FosUser'); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | |
@@ -37,36 +37,36 @@ discard block |
||
37 | 37 | */ |
38 | 38 | protected function tearDown() |
39 | 39 | { |
40 | - unset( $this->object, $this->context ); |
|
40 | + unset($this->object, $this->context); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | |
44 | 44 | public function testCleanup() |
45 | 45 | { |
46 | - $this->object->cleanup( array( -1 ) ); |
|
46 | + $this->object->cleanup(array( -1 )); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
50 | 50 | public function testAggregate() |
51 | 51 | { |
52 | - $search = $this->object->createSearch( true ); |
|
52 | + $search = $this->object->createSearch(true); |
|
53 | 53 | $expr = array( |
54 | 54 | $search->getConditions(), |
55 | - $search->compare( '==', 'customer.lists.editor', 'ai-symfony:unittest' ), |
|
55 | + $search->compare('==', 'customer.lists.editor', 'ai-symfony:unittest'), |
|
56 | 56 | ); |
57 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
57 | + $search->setConditions($search->combine('&&', $expr)); |
|
58 | 58 | |
59 | - $result = $this->object->aggregate( $search, 'customer.lists.domain' ); |
|
59 | + $result = $this->object->aggregate($search, 'customer.lists.domain'); |
|
60 | 60 | |
61 | - $this->assertEquals( 1, count( $result ) ); |
|
62 | - $this->assertArrayHasKey( 'text', $result ); |
|
63 | - $this->assertEquals( 4, $result['text'] ); |
|
61 | + $this->assertEquals(1, count($result)); |
|
62 | + $this->assertArrayHasKey('text', $result); |
|
63 | + $this->assertEquals(4, $result['text']); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | |
67 | 67 | public function testCreateItem() |
68 | 68 | { |
69 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $this->object->createItem() ); |
|
69 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $this->object->createItem()); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | |
@@ -74,13 +74,13 @@ discard block |
||
74 | 74 | { |
75 | 75 | $search = $this->object->createSearch(); |
76 | 76 | $search->setSlice(0, 1); |
77 | - $results = $this->object->searchItems( $search ); |
|
77 | + $results = $this->object->searchItems($search); |
|
78 | 78 | |
79 | - if( ( $item = reset( $results ) ) === false ) { |
|
80 | - throw new \Exception( 'No item found' ); |
|
79 | + if (($item = reset($results)) === false) { |
|
80 | + throw new \Exception('No item found'); |
|
81 | 81 | } |
82 | 82 | |
83 | - $this->assertEquals( $item, $this->object->getItem( $item->getId() ) ); |
|
83 | + $this->assertEquals($item, $this->object->getItem($item->getId())); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | |
@@ -88,144 +88,144 @@ discard block |
||
88 | 88 | { |
89 | 89 | $search = $this->object->createSearch(); |
90 | 90 | $search->setSlice(0, 1); |
91 | - $items = $this->object->searchItems( $search ); |
|
91 | + $items = $this->object->searchItems($search); |
|
92 | 92 | |
93 | - if( ( $item = reset( $items ) ) === false ) { |
|
94 | - throw new \Exception( 'No item found' ); |
|
93 | + if (($item = reset($items)) === false) { |
|
94 | + throw new \Exception('No item found'); |
|
95 | 95 | } |
96 | 96 | |
97 | - $item->setId( null ); |
|
98 | - $item->setDomain( 'unittest' ); |
|
99 | - $this->object->saveItem( $item ); |
|
100 | - $itemSaved = $this->object->getItem( $item->getId() ); |
|
97 | + $item->setId(null); |
|
98 | + $item->setDomain('unittest'); |
|
99 | + $this->object->saveItem($item); |
|
100 | + $itemSaved = $this->object->getItem($item->getId()); |
|
101 | 101 | |
102 | 102 | $itemExp = clone $itemSaved; |
103 | - $itemExp->setDomain( 'unittest2' ); |
|
104 | - $this->object->saveItem( $itemExp ); |
|
105 | - $itemUpd = $this->object->getItem( $itemExp->getId() ); |
|
106 | - |
|
107 | - $this->object->deleteItem( $itemSaved->getId() ); |
|
108 | - |
|
109 | - |
|
110 | - $this->assertTrue( $item->getId() !== null ); |
|
111 | - $this->assertTrue( $itemSaved->getType() !== null ); |
|
112 | - $this->assertEquals( $item->getId(), $itemSaved->getId() ); |
|
113 | - $this->assertEquals( $item->getSiteId(), $itemSaved->getSiteId() ); |
|
114 | - $this->assertEquals( $item->getParentId(), $itemSaved->getParentId() ); |
|
115 | - $this->assertEquals( $item->getTypeId(), $itemSaved->getTypeId() ); |
|
116 | - $this->assertEquals( $item->getRefId(), $itemSaved->getRefId() ); |
|
117 | - $this->assertEquals( $item->getDomain(), $itemSaved->getDomain() ); |
|
118 | - $this->assertEquals( $item->getDateStart(), $itemSaved->getDateStart() ); |
|
119 | - $this->assertEquals( $item->getDateEnd(), $itemSaved->getDateEnd() ); |
|
120 | - $this->assertEquals( $item->getPosition(), $itemSaved->getPosition() ); |
|
121 | - $this->assertEquals( $this->editor, $itemSaved->getEditor() ); |
|
103 | + $itemExp->setDomain('unittest2'); |
|
104 | + $this->object->saveItem($itemExp); |
|
105 | + $itemUpd = $this->object->getItem($itemExp->getId()); |
|
106 | + |
|
107 | + $this->object->deleteItem($itemSaved->getId()); |
|
108 | + |
|
109 | + |
|
110 | + $this->assertTrue($item->getId() !== null); |
|
111 | + $this->assertTrue($itemSaved->getType() !== null); |
|
112 | + $this->assertEquals($item->getId(), $itemSaved->getId()); |
|
113 | + $this->assertEquals($item->getSiteId(), $itemSaved->getSiteId()); |
|
114 | + $this->assertEquals($item->getParentId(), $itemSaved->getParentId()); |
|
115 | + $this->assertEquals($item->getTypeId(), $itemSaved->getTypeId()); |
|
116 | + $this->assertEquals($item->getRefId(), $itemSaved->getRefId()); |
|
117 | + $this->assertEquals($item->getDomain(), $itemSaved->getDomain()); |
|
118 | + $this->assertEquals($item->getDateStart(), $itemSaved->getDateStart()); |
|
119 | + $this->assertEquals($item->getDateEnd(), $itemSaved->getDateEnd()); |
|
120 | + $this->assertEquals($item->getPosition(), $itemSaved->getPosition()); |
|
121 | + $this->assertEquals($this->editor, $itemSaved->getEditor()); |
|
122 | 122 | $this->assertStringStartsWith(date('Y-m-d', time()), $itemSaved->getTimeCreated()); |
123 | 123 | $this->assertStringStartsWith(date('Y-m-d', time()), $itemSaved->getTimeModified()); |
124 | 124 | |
125 | - $this->assertEquals( $this->editor, $itemSaved->getEditor() ); |
|
126 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated() ); |
|
127 | - $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified() ); |
|
128 | - |
|
129 | - $this->assertTrue( $itemUpd->getType() !== null ); |
|
130 | - $this->assertEquals( $itemExp->getId(), $itemUpd->getId() ); |
|
131 | - $this->assertEquals( $itemExp->getSiteId(), $itemUpd->getSiteId() ); |
|
132 | - $this->assertEquals( $itemExp->getParentId(), $itemUpd->getParentId() ); |
|
133 | - $this->assertEquals( $itemExp->getTypeId(), $itemUpd->getTypeId() ); |
|
134 | - $this->assertEquals( $itemExp->getRefId(), $itemUpd->getRefId() ); |
|
135 | - $this->assertEquals( $itemExp->getDomain(), $itemUpd->getDomain() ); |
|
136 | - $this->assertEquals( $itemExp->getDateStart(), $itemUpd->getDateStart() ); |
|
137 | - $this->assertEquals( $itemExp->getDateEnd(), $itemUpd->getDateEnd() ); |
|
138 | - $this->assertEquals( $itemExp->getPosition(), $itemUpd->getPosition() ); |
|
139 | - |
|
140 | - $this->assertEquals( $this->editor, $itemUpd->getEditor() ); |
|
141 | - $this->assertEquals( $itemExp->getTimeCreated(), $itemUpd->getTimeCreated() ); |
|
142 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified() ); |
|
125 | + $this->assertEquals($this->editor, $itemSaved->getEditor()); |
|
126 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated()); |
|
127 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified()); |
|
128 | + |
|
129 | + $this->assertTrue($itemUpd->getType() !== null); |
|
130 | + $this->assertEquals($itemExp->getId(), $itemUpd->getId()); |
|
131 | + $this->assertEquals($itemExp->getSiteId(), $itemUpd->getSiteId()); |
|
132 | + $this->assertEquals($itemExp->getParentId(), $itemUpd->getParentId()); |
|
133 | + $this->assertEquals($itemExp->getTypeId(), $itemUpd->getTypeId()); |
|
134 | + $this->assertEquals($itemExp->getRefId(), $itemUpd->getRefId()); |
|
135 | + $this->assertEquals($itemExp->getDomain(), $itemUpd->getDomain()); |
|
136 | + $this->assertEquals($itemExp->getDateStart(), $itemUpd->getDateStart()); |
|
137 | + $this->assertEquals($itemExp->getDateEnd(), $itemUpd->getDateEnd()); |
|
138 | + $this->assertEquals($itemExp->getPosition(), $itemUpd->getPosition()); |
|
139 | + |
|
140 | + $this->assertEquals($this->editor, $itemUpd->getEditor()); |
|
141 | + $this->assertEquals($itemExp->getTimeCreated(), $itemUpd->getTimeCreated()); |
|
142 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified()); |
|
143 | 143 | |
144 | 144 | $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
145 | - $this->object->getItem( $itemSaved->getId() ); |
|
145 | + $this->object->getItem($itemSaved->getId()); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | |
149 | 149 | public function testMoveItemLastToFront() |
150 | 150 | { |
151 | 151 | $listItems = $this->getListItems(); |
152 | - $this->assertGreaterThan( 1, count( $listItems ) ); |
|
152 | + $this->assertGreaterThan(1, count($listItems)); |
|
153 | 153 | |
154 | - if( ( $first = reset( $listItems ) ) === false ) { |
|
155 | - throw new \Exception( 'No first customer list item' ); |
|
154 | + if (($first = reset($listItems)) === false) { |
|
155 | + throw new \Exception('No first customer list item'); |
|
156 | 156 | } |
157 | 157 | |
158 | - if( ( $last = end( $listItems ) ) === false ) { |
|
159 | - throw new \Exception( 'No last customer list item' ); |
|
158 | + if (($last = end($listItems)) === false) { |
|
159 | + throw new \Exception('No last customer list item'); |
|
160 | 160 | } |
161 | 161 | |
162 | - $this->object->moveItem( $last->getId(), $first->getId() ); |
|
162 | + $this->object->moveItem($last->getId(), $first->getId()); |
|
163 | 163 | |
164 | - $newFirst = $this->object->getItem( $last->getId() ); |
|
165 | - $newSecond = $this->object->getItem( $first->getId() ); |
|
164 | + $newFirst = $this->object->getItem($last->getId()); |
|
165 | + $newSecond = $this->object->getItem($first->getId()); |
|
166 | 166 | |
167 | - $this->object->moveItem( $last->getId() ); |
|
167 | + $this->object->moveItem($last->getId()); |
|
168 | 168 | |
169 | - $this->assertEquals( 0, $newFirst->getPosition() ); |
|
170 | - $this->assertEquals( 1, $newSecond->getPosition() ); |
|
169 | + $this->assertEquals(0, $newFirst->getPosition()); |
|
170 | + $this->assertEquals(1, $newSecond->getPosition()); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | |
174 | 174 | public function testMoveItemFirstToLast() |
175 | 175 | { |
176 | 176 | $listItems = $this->getListItems(); |
177 | - $this->assertGreaterThan( 1, count( $listItems ) ); |
|
177 | + $this->assertGreaterThan(1, count($listItems)); |
|
178 | 178 | |
179 | - if( ( $first = reset( $listItems ) ) === false ) { |
|
180 | - throw new \Exception( 'No first customer list item' ); |
|
179 | + if (($first = reset($listItems)) === false) { |
|
180 | + throw new \Exception('No first customer list item'); |
|
181 | 181 | } |
182 | 182 | |
183 | - if( ( $second = next( $listItems ) ) === false ) { |
|
184 | - throw new \Exception( 'No second customer list item' ); |
|
183 | + if (($second = next($listItems)) === false) { |
|
184 | + throw new \Exception('No second customer list item'); |
|
185 | 185 | } |
186 | 186 | |
187 | - if( ( $last = end( $listItems ) ) === false ) { |
|
188 | - throw new \Exception( 'No last customer list item' ); |
|
187 | + if (($last = end($listItems)) === false) { |
|
188 | + throw new \Exception('No last customer list item'); |
|
189 | 189 | } |
190 | 190 | |
191 | - $this->object->moveItem( $first->getId() ); |
|
191 | + $this->object->moveItem($first->getId()); |
|
192 | 192 | |
193 | - $newBefore = $this->object->getItem( $last->getId() ); |
|
194 | - $newLast = $this->object->getItem( $first->getId() ); |
|
193 | + $newBefore = $this->object->getItem($last->getId()); |
|
194 | + $newLast = $this->object->getItem($first->getId()); |
|
195 | 195 | |
196 | - $this->object->moveItem( $first->getId(), $second->getId() ); |
|
196 | + $this->object->moveItem($first->getId(), $second->getId()); |
|
197 | 197 | |
198 | - $this->assertEquals( $last->getPosition() - 1, $newBefore->getPosition() ); |
|
199 | - $this->assertEquals( $last->getPosition(), $newLast->getPosition() ); |
|
198 | + $this->assertEquals($last->getPosition() - 1, $newBefore->getPosition()); |
|
199 | + $this->assertEquals($last->getPosition(), $newLast->getPosition()); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | |
203 | 203 | public function testMoveItemFirstUp() |
204 | 204 | { |
205 | 205 | $listItems = $this->getListItems(); |
206 | - $this->assertGreaterThan( 1, count( $listItems ) ); |
|
206 | + $this->assertGreaterThan(1, count($listItems)); |
|
207 | 207 | |
208 | - if( ( $first = reset( $listItems ) ) === false ) { |
|
209 | - throw new \Exception( 'No first customer list item' ); |
|
208 | + if (($first = reset($listItems)) === false) { |
|
209 | + throw new \Exception('No first customer list item'); |
|
210 | 210 | } |
211 | 211 | |
212 | - if( ( $second = next( $listItems ) ) === false ) { |
|
213 | - throw new \Exception( 'No second customer list item' ); |
|
212 | + if (($second = next($listItems)) === false) { |
|
213 | + throw new \Exception('No second customer list item'); |
|
214 | 214 | } |
215 | 215 | |
216 | - if( ( $last = end( $listItems ) ) === false ) { |
|
217 | - throw new \Exception( 'No last customer list item' ); |
|
216 | + if (($last = end($listItems)) === false) { |
|
217 | + throw new \Exception('No last customer list item'); |
|
218 | 218 | } |
219 | 219 | |
220 | - $this->object->moveItem( $first->getId(), $last->getId() ); |
|
220 | + $this->object->moveItem($first->getId(), $last->getId()); |
|
221 | 221 | |
222 | - $newLast = $this->object->getItem( $last->getId() ); |
|
223 | - $newUp = $this->object->getItem( $first->getId() ); |
|
222 | + $newLast = $this->object->getItem($last->getId()); |
|
223 | + $newUp = $this->object->getItem($first->getId()); |
|
224 | 224 | |
225 | - $this->object->moveItem( $first->getId(), $second->getId() ); |
|
225 | + $this->object->moveItem($first->getId(), $second->getId()); |
|
226 | 226 | |
227 | - $this->assertEquals( $last->getPosition() - 1, $newUp->getPosition() ); |
|
228 | - $this->assertEquals( $last->getPosition(), $newLast->getPosition() ); |
|
227 | + $this->assertEquals($last->getPosition() - 1, $newUp->getPosition()); |
|
228 | + $this->assertEquals($last->getPosition(), $newLast->getPosition()); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | |
@@ -235,39 +235,39 @@ discard block |
||
235 | 235 | $search = $this->object->createSearch(); |
236 | 236 | |
237 | 237 | $expr = array(); |
238 | - $expr[] = $search->compare( '!=', 'customer.lists.id', null ); |
|
239 | - $expr[] = $search->compare( '!=', 'customer.lists.siteid', null ); |
|
240 | - $expr[] = $search->compare( '>', 'customer.lists.parentid', 0 ); |
|
241 | - $expr[] = $search->compare( '==', 'customer.lists.domain', 'text' ); |
|
242 | - $expr[] = $search->compare( '>', 'customer.lists.typeid', 0 ); |
|
243 | - $expr[] = $search->compare( '>', 'customer.lists.refid', 0 ); |
|
244 | - $expr[] = $search->compare( '==', 'customer.lists.datestart', '2010-01-01 00:00:00' ); |
|
245 | - $expr[] = $search->compare( '==', 'customer.lists.dateend', '2100-01-01 00:00:00' ); |
|
246 | - $expr[] = $search->compare( '!=', 'customer.lists.config', null ); |
|
247 | - $expr[] = $search->compare( '>', 'customer.lists.position', 0 ); |
|
248 | - $expr[] = $search->compare( '==', 'customer.lists.status', 1 ); |
|
249 | - $expr[] = $search->compare( '>=', 'customer.lists.mtime', '1970-01-01 00:00:00' ); |
|
250 | - $expr[] = $search->compare( '>=', 'customer.lists.ctime', '1970-01-01 00:00:00' ); |
|
251 | - $expr[] = $search->compare( '==', 'customer.lists.editor', $this->editor ); |
|
252 | - |
|
253 | - $expr[] = $search->compare( '!=', 'customer.lists.type.id', 0 ); |
|
254 | - $expr[] = $search->compare( '!=', 'customer.lists.type.siteid', null ); |
|
255 | - $expr[] = $search->compare( '==', 'customer.lists.type.code', 'default' ); |
|
256 | - $expr[] = $search->compare( '==', 'customer.lists.type.domain', 'text' ); |
|
257 | - $expr[] = $search->compare( '==', 'customer.lists.type.label', 'Standard' ); |
|
258 | - $expr[] = $search->compare( '==', 'customer.lists.type.status', 1 ); |
|
259 | - $expr[] = $search->compare( '>=', 'customer.lists.type.mtime', '1970-01-01 00:00:00' ); |
|
260 | - $expr[] = $search->compare( '>=', 'customer.lists.type.ctime', '1970-01-01 00:00:00' ); |
|
261 | - $expr[] = $search->compare( '==', 'customer.lists.type.editor', $this->editor ); |
|
262 | - |
|
263 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
238 | + $expr[] = $search->compare('!=', 'customer.lists.id', null); |
|
239 | + $expr[] = $search->compare('!=', 'customer.lists.siteid', null); |
|
240 | + $expr[] = $search->compare('>', 'customer.lists.parentid', 0); |
|
241 | + $expr[] = $search->compare('==', 'customer.lists.domain', 'text'); |
|
242 | + $expr[] = $search->compare('>', 'customer.lists.typeid', 0); |
|
243 | + $expr[] = $search->compare('>', 'customer.lists.refid', 0); |
|
244 | + $expr[] = $search->compare('==', 'customer.lists.datestart', '2010-01-01 00:00:00'); |
|
245 | + $expr[] = $search->compare('==', 'customer.lists.dateend', '2100-01-01 00:00:00'); |
|
246 | + $expr[] = $search->compare('!=', 'customer.lists.config', null); |
|
247 | + $expr[] = $search->compare('>', 'customer.lists.position', 0); |
|
248 | + $expr[] = $search->compare('==', 'customer.lists.status', 1); |
|
249 | + $expr[] = $search->compare('>=', 'customer.lists.mtime', '1970-01-01 00:00:00'); |
|
250 | + $expr[] = $search->compare('>=', 'customer.lists.ctime', '1970-01-01 00:00:00'); |
|
251 | + $expr[] = $search->compare('==', 'customer.lists.editor', $this->editor); |
|
252 | + |
|
253 | + $expr[] = $search->compare('!=', 'customer.lists.type.id', 0); |
|
254 | + $expr[] = $search->compare('!=', 'customer.lists.type.siteid', null); |
|
255 | + $expr[] = $search->compare('==', 'customer.lists.type.code', 'default'); |
|
256 | + $expr[] = $search->compare('==', 'customer.lists.type.domain', 'text'); |
|
257 | + $expr[] = $search->compare('==', 'customer.lists.type.label', 'Standard'); |
|
258 | + $expr[] = $search->compare('==', 'customer.lists.type.status', 1); |
|
259 | + $expr[] = $search->compare('>=', 'customer.lists.type.mtime', '1970-01-01 00:00:00'); |
|
260 | + $expr[] = $search->compare('>=', 'customer.lists.type.ctime', '1970-01-01 00:00:00'); |
|
261 | + $expr[] = $search->compare('==', 'customer.lists.type.editor', $this->editor); |
|
262 | + |
|
263 | + $search->setConditions($search->combine('&&', $expr)); |
|
264 | 264 | $search->setSlice(0, 2); |
265 | - $results = $this->object->searchItems( $search, array(), $total ); |
|
266 | - $this->assertEquals( 2, count( $results ) ); |
|
267 | - $this->assertEquals( 3, $total ); |
|
265 | + $results = $this->object->searchItems($search, array(), $total); |
|
266 | + $this->assertEquals(2, count($results)); |
|
267 | + $this->assertEquals(3, $total); |
|
268 | 268 | |
269 | - foreach($results as $itemId => $item) { |
|
270 | - $this->assertEquals( $itemId, $item->getId() ); |
|
269 | + foreach ($results as $itemId => $item) { |
|
270 | + $this->assertEquals($itemId, $item->getId()); |
|
271 | 271 | } |
272 | 272 | } |
273 | 273 | |
@@ -275,8 +275,8 @@ discard block |
||
275 | 275 | public function testSearchItemsNoCriteria() |
276 | 276 | { |
277 | 277 | $search = $this->object->createSearch(); |
278 | - $search->setConditions( $search->compare( '==', 'customer.lists.editor', $this->editor ) ); |
|
279 | - $this->assertEquals( 4, count( $this->object->searchItems($search) ) ); |
|
278 | + $search->setConditions($search->compare('==', 'customer.lists.editor', $this->editor)); |
|
279 | + $this->assertEquals(4, count($this->object->searchItems($search))); |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | |
@@ -284,48 +284,48 @@ discard block |
||
284 | 284 | { |
285 | 285 | $search = $this->object->createSearch(true); |
286 | 286 | $conditions = array( |
287 | - $search->compare( '==', 'customer.lists.editor', $this->editor ), |
|
287 | + $search->compare('==', 'customer.lists.editor', $this->editor), |
|
288 | 288 | $search->getConditions() |
289 | 289 | ); |
290 | - $search->setConditions( $search->combine( '&&', $conditions ) ); |
|
291 | - $this->assertEquals( 4, count( $this->object->searchItems($search) ) ); |
|
290 | + $search->setConditions($search->combine('&&', $conditions)); |
|
291 | + $this->assertEquals(4, count($this->object->searchItems($search))); |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | |
295 | 295 | public function testGetSubManager() |
296 | 296 | { |
297 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type') ); |
|
298 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type', 'Standard') ); |
|
297 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type')); |
|
298 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type', 'Standard')); |
|
299 | 299 | |
300 | - $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
301 | - $this->object->getSubManager( 'unknown' ); |
|
300 | + $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
301 | + $this->object->getSubManager('unknown'); |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | |
305 | 305 | protected function getListItems() |
306 | 306 | { |
307 | - $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager( $this->context, 'FosUser' ); |
|
307 | + $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager($this->context, 'FosUser'); |
|
308 | 308 | |
309 | 309 | $search = $manager->createSearch(); |
310 | - $search->setConditions( $search->compare( '==', 'customer.code', 'unitCustomer3' ) ); |
|
311 | - $search->setSlice( 0, 1 ); |
|
310 | + $search->setConditions($search->compare('==', 'customer.code', 'unitCustomer3')); |
|
311 | + $search->setSlice(0, 1); |
|
312 | 312 | |
313 | - $results = $manager->searchItems( $search ); |
|
313 | + $results = $manager->searchItems($search); |
|
314 | 314 | |
315 | - if( ( $item = reset( $results ) ) === false ) { |
|
316 | - throw new \Exception( 'No customer item found' ); |
|
315 | + if (($item = reset($results)) === false) { |
|
316 | + throw new \Exception('No customer item found'); |
|
317 | 317 | } |
318 | 318 | |
319 | 319 | $search = $this->object->createSearch(); |
320 | 320 | $expr = array( |
321 | - $search->compare( '==', 'customer.lists.parentid', $item->getId() ), |
|
322 | - $search->compare( '==', 'customer.lists.domain', 'text' ), |
|
323 | - $search->compare( '==', 'customer.lists.editor', $this->editor ), |
|
324 | - $search->compare( '==', 'customer.lists.type.code', 'default' ), |
|
321 | + $search->compare('==', 'customer.lists.parentid', $item->getId()), |
|
322 | + $search->compare('==', 'customer.lists.domain', 'text'), |
|
323 | + $search->compare('==', 'customer.lists.editor', $this->editor), |
|
324 | + $search->compare('==', 'customer.lists.type.code', 'default'), |
|
325 | 325 | ); |
326 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
327 | - $search->setSortations( array( $search->sort( '+', 'customer.lists.position' ) ) ); |
|
326 | + $search->setConditions($search->combine('&&', $expr)); |
|
327 | + $search->setSortations(array($search->sort('+', 'customer.lists.position'))); |
|
328 | 328 | |
329 | - return $this->object->searchItems( $search ); |
|
329 | + return $this->object->searchItems($search); |
|
330 | 330 | } |
331 | 331 | } |
@@ -22,10 +22,10 @@ discard block |
||
22 | 22 | protected function setUp() |
23 | 23 | { |
24 | 24 | $this->editor = \TestHelper::getContext()->getEditor(); |
25 | - $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager( \TestHelper::getContext(), 'FosUser' ); |
|
25 | + $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager(\TestHelper::getContext(), 'FosUser'); |
|
26 | 26 | |
27 | - $listManager = $manager->getSubManager( 'lists', 'FosUser' ); |
|
28 | - $this->object = $listManager->getSubManager( 'type', 'FosUser' ); |
|
27 | + $listManager = $manager->getSubManager('lists', 'FosUser'); |
|
28 | + $this->object = $listManager->getSubManager('type', 'FosUser'); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | |
@@ -37,20 +37,20 @@ discard block |
||
37 | 37 | */ |
38 | 38 | protected function tearDown() |
39 | 39 | { |
40 | - unset( $this->object ); |
|
40 | + unset($this->object); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | |
44 | 44 | public function testCleanup() |
45 | 45 | { |
46 | - $this->object->cleanup( array( -1 ) ); |
|
46 | + $this->object->cleanup(array( -1 )); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
50 | 50 | public function testCreateItem() |
51 | 51 | { |
52 | 52 | $item = $this->object->createItem(); |
53 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Type\\Iface', $item ); |
|
53 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Type\\Iface', $item); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | |
@@ -60,11 +60,11 @@ discard block |
||
60 | 60 | $search->setSlice(0, 1); |
61 | 61 | $results = $this->object->searchItems($search); |
62 | 62 | |
63 | - if( ( $expected = reset($results) ) === false ) { |
|
64 | - throw new \Exception( 'No list type item found' ); |
|
63 | + if (($expected = reset($results)) === false) { |
|
64 | + throw new \Exception('No list type item found'); |
|
65 | 65 | } |
66 | 66 | |
67 | - $this->assertEquals( $expected, $this->object->getItem( $expected->getId() ) ); |
|
67 | + $this->assertEquals($expected, $this->object->getItem($expected->getId())); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | |
@@ -74,48 +74,48 @@ discard block |
||
74 | 74 | $search->setSlice(0, 1); |
75 | 75 | $results = $this->object->searchItems($search); |
76 | 76 | |
77 | - if( ( $item = reset($results) ) === false ) { |
|
78 | - throw new \Exception( 'No type item found' ); |
|
77 | + if (($item = reset($results)) === false) { |
|
78 | + throw new \Exception('No type item found'); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | $item->setId(null); |
82 | - $item->setCode( 'unitTestInit' ); |
|
83 | - $this->object->saveItem( $item ); |
|
84 | - $itemSaved = $this->object->getItem( $item->getId() ); |
|
82 | + $item->setCode('unitTestInit'); |
|
83 | + $this->object->saveItem($item); |
|
84 | + $itemSaved = $this->object->getItem($item->getId()); |
|
85 | 85 | |
86 | 86 | $itemExp = clone $itemSaved; |
87 | - $itemExp->setCode( 'unitTestSave' ); |
|
88 | - $this->object->saveItem( $itemExp ); |
|
89 | - $itemUpd = $this->object->getItem( $itemExp->getId() ); |
|
87 | + $itemExp->setCode('unitTestSave'); |
|
88 | + $this->object->saveItem($itemExp); |
|
89 | + $itemUpd = $this->object->getItem($itemExp->getId()); |
|
90 | 90 | |
91 | - $this->object->deleteItem( $itemSaved->getId() ); |
|
91 | + $this->object->deleteItem($itemSaved->getId()); |
|
92 | 92 | |
93 | 93 | |
94 | - $this->assertTrue( $item->getId() !== null ); |
|
95 | - $this->assertEquals( $item->getId(), $itemSaved->getId() ); |
|
96 | - $this->assertEquals( $item->getSiteId(), $itemSaved->getSiteId() ); |
|
97 | - $this->assertEquals( $item->getCode(), $itemSaved->getCode() ); |
|
98 | - $this->assertEquals( $item->getDomain(), $itemSaved->getDomain() ); |
|
99 | - $this->assertEquals( $item->getLabel(), $itemSaved->getLabel() ); |
|
100 | - $this->assertEquals( $item->getStatus(), $itemSaved->getStatus() ); |
|
94 | + $this->assertTrue($item->getId() !== null); |
|
95 | + $this->assertEquals($item->getId(), $itemSaved->getId()); |
|
96 | + $this->assertEquals($item->getSiteId(), $itemSaved->getSiteId()); |
|
97 | + $this->assertEquals($item->getCode(), $itemSaved->getCode()); |
|
98 | + $this->assertEquals($item->getDomain(), $itemSaved->getDomain()); |
|
99 | + $this->assertEquals($item->getLabel(), $itemSaved->getLabel()); |
|
100 | + $this->assertEquals($item->getStatus(), $itemSaved->getStatus()); |
|
101 | 101 | |
102 | - $this->assertEquals( $this->editor, $itemSaved->getEditor() ); |
|
103 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated() ); |
|
104 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified() ); |
|
102 | + $this->assertEquals($this->editor, $itemSaved->getEditor()); |
|
103 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated()); |
|
104 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified()); |
|
105 | 105 | |
106 | - $this->assertEquals( $itemExp->getId(), $itemUpd->getId() ); |
|
107 | - $this->assertEquals( $itemExp->getSiteId(), $itemUpd->getSiteId() ); |
|
108 | - $this->assertEquals( $itemExp->getCode(), $itemUpd->getCode() ); |
|
109 | - $this->assertEquals( $itemExp->getDomain(), $itemUpd->getDomain() ); |
|
110 | - $this->assertEquals( $itemExp->getLabel(), $itemUpd->getLabel() ); |
|
111 | - $this->assertEquals( $itemExp->getStatus(), $itemUpd->getStatus() ); |
|
106 | + $this->assertEquals($itemExp->getId(), $itemUpd->getId()); |
|
107 | + $this->assertEquals($itemExp->getSiteId(), $itemUpd->getSiteId()); |
|
108 | + $this->assertEquals($itemExp->getCode(), $itemUpd->getCode()); |
|
109 | + $this->assertEquals($itemExp->getDomain(), $itemUpd->getDomain()); |
|
110 | + $this->assertEquals($itemExp->getLabel(), $itemUpd->getLabel()); |
|
111 | + $this->assertEquals($itemExp->getStatus(), $itemUpd->getStatus()); |
|
112 | 112 | |
113 | - $this->assertEquals( $this->editor, $itemUpd->getEditor() ); |
|
114 | - $this->assertEquals( $itemExp->getTimeCreated(), $itemUpd->getTimeCreated() ); |
|
115 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified() ); |
|
113 | + $this->assertEquals($this->editor, $itemUpd->getEditor()); |
|
114 | + $this->assertEquals($itemExp->getTimeCreated(), $itemUpd->getTimeCreated()); |
|
115 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified()); |
|
116 | 116 | |
117 | 117 | $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
118 | - $this->object->getItem( $itemSaved->getId() ); |
|
118 | + $this->object->getItem($itemSaved->getId()); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | |
@@ -125,25 +125,25 @@ discard block |
||
125 | 125 | $search = $this->object->createSearch(); |
126 | 126 | |
127 | 127 | $expr = array(); |
128 | - $expr[] = $search->compare( '!=', 'customer.lists.type.id', 0 ); |
|
129 | - $expr[] = $search->compare( '!=', 'customer.lists.type.siteid', null ); |
|
130 | - $expr[] = $search->compare( '==', 'customer.lists.type.code', 'default' ); |
|
131 | - $expr[] = $search->compare( '==', 'customer.lists.type.domain', 'text' ); |
|
132 | - $expr[] = $search->compare( '==', 'customer.lists.type.label', 'Standard' ); |
|
133 | - $expr[] = $search->compare( '==', 'customer.lists.type.status', 1 ); |
|
134 | - $expr[] = $search->compare( '>=', 'customer.lists.type.mtime', '1970-01-01 00:00:00' ); |
|
135 | - $expr[] = $search->compare( '>=', 'customer.lists.type.ctime', '1970-01-01 00:00:00' ); |
|
136 | - $expr[] = $search->compare( '==', 'customer.lists.type.editor', $this->editor ); |
|
137 | - |
|
138 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
128 | + $expr[] = $search->compare('!=', 'customer.lists.type.id', 0); |
|
129 | + $expr[] = $search->compare('!=', 'customer.lists.type.siteid', null); |
|
130 | + $expr[] = $search->compare('==', 'customer.lists.type.code', 'default'); |
|
131 | + $expr[] = $search->compare('==', 'customer.lists.type.domain', 'text'); |
|
132 | + $expr[] = $search->compare('==', 'customer.lists.type.label', 'Standard'); |
|
133 | + $expr[] = $search->compare('==', 'customer.lists.type.status', 1); |
|
134 | + $expr[] = $search->compare('>=', 'customer.lists.type.mtime', '1970-01-01 00:00:00'); |
|
135 | + $expr[] = $search->compare('>=', 'customer.lists.type.ctime', '1970-01-01 00:00:00'); |
|
136 | + $expr[] = $search->compare('==', 'customer.lists.type.editor', $this->editor); |
|
137 | + |
|
138 | + $search->setConditions($search->combine('&&', $expr)); |
|
139 | 139 | $search->setSlice(0, 1); |
140 | 140 | |
141 | - $results = $this->object->searchItems( $search, array(), $total ); |
|
142 | - $this->assertEquals( 1, count( $results ) ); |
|
143 | - $this->assertEquals( 1, $total ); |
|
141 | + $results = $this->object->searchItems($search, array(), $total); |
|
142 | + $this->assertEquals(1, count($results)); |
|
143 | + $this->assertEquals(1, $total); |
|
144 | 144 | |
145 | - foreach($results as $itemId => $item) { |
|
146 | - $this->assertEquals( $itemId, $item->getId() ); |
|
145 | + foreach ($results as $itemId => $item) { |
|
146 | + $this->assertEquals($itemId, $item->getId()); |
|
147 | 147 | } |
148 | 148 | } |
149 | 149 |
@@ -25,13 +25,13 @@ discard block |
||
25 | 25 | */ |
26 | 26 | protected function setUp() |
27 | 27 | { |
28 | - if( class_exists( 'Symfony\Component\HttpFoundation\Session\Session' ) === false ) { |
|
29 | - $this->markTestSkipped( 'Class Symfony\Component\HttpFoundation\Session\Session not found' ); |
|
28 | + if (class_exists('Symfony\Component\HttpFoundation\Session\Session') === false) { |
|
29 | + $this->markTestSkipped('Class Symfony\Component\HttpFoundation\Session\Session not found'); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | $storage = new \Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage(); |
33 | - $session = new \Symfony\Component\HttpFoundation\Session\Session( $storage ); |
|
34 | - $this->object = new \Aimeos\MW\Session\Symfony2( $session ); |
|
33 | + $session = new \Symfony\Component\HttpFoundation\Session\Session($storage); |
|
34 | + $this->object = new \Aimeos\MW\Session\Symfony2($session); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | |
@@ -43,26 +43,26 @@ discard block |
||
43 | 43 | */ |
44 | 44 | protected function tearDown() |
45 | 45 | { |
46 | - unset( $this->object ); |
|
46 | + unset($this->object); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
50 | 50 | public function testGetDefault() |
51 | 51 | { |
52 | - $this->assertEquals( null, $this->object->get( 'notexist' ) ); |
|
52 | + $this->assertEquals(null, $this->object->get('notexist')); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | |
56 | 56 | public function testGetSet() |
57 | 57 | { |
58 | - $this->object->set( 'key', 'value' ); |
|
59 | - $this->assertEquals( 'value', $this->object->get( 'key' ) ); |
|
58 | + $this->object->set('key', 'value'); |
|
59 | + $this->assertEquals('value', $this->object->get('key')); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | |
63 | 63 | public function testGetSetArray() |
64 | 64 | { |
65 | - $this->object->set( 'key', array( 'value' ) ); |
|
66 | - $this->assertEquals( array( 'value' ), $this->object->get( 'key' ) ); |
|
65 | + $this->object->set('key', array('value')); |
|
66 | + $this->assertEquals(array('value'), $this->object->get('key')); |
|
67 | 67 | } |
68 | 68 | } |
@@ -11,7 +11,7 @@ |
||
11 | 11 | |
12 | 12 | $collection = new RouteCollection(); |
13 | 13 | |
14 | -$route = new Route( '/{site}/lists', array( '_controller' => 'AimeosShopBundle:Catalog:list' ) ); |
|
15 | -$collection->add( 'catalog_list', $route ); |
|
14 | +$route = new Route('/{site}/lists', array('_controller' => 'AimeosShopBundle:Catalog:list')); |
|
15 | +$collection->add('catalog_list', $route); |
|
16 | 16 | |
17 | 17 | return $collection; |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * Set error reporting to maximum |
10 | 10 | */ |
11 | 11 | error_reporting( -1 ); |
12 | -ini_set( 'display_errors', '1' ); |
|
12 | +ini_set('display_errors', '1'); |
|
13 | 13 | |
14 | 14 | date_default_timezone_set('UTC'); |
15 | 15 | |
@@ -17,11 +17,11 @@ discard block |
||
17 | 17 | /* |
18 | 18 | * Set locale settings to reasonable defaults |
19 | 19 | */ |
20 | -setlocale( LC_ALL, 'en_US.UTF-8' ); |
|
21 | -setlocale( LC_CTYPE, 'en_US.UTF-8' ); |
|
22 | -setlocale( LC_NUMERIC, 'POSIX' ); |
|
23 | -setlocale( LC_TIME, 'POSIX' ); |
|
24 | -date_default_timezone_set( 'UTC' ); |
|
20 | +setlocale(LC_ALL, 'en_US.UTF-8'); |
|
21 | +setlocale(LC_CTYPE, 'en_US.UTF-8'); |
|
22 | +setlocale(LC_NUMERIC, 'POSIX'); |
|
23 | +setlocale(LC_TIME, 'POSIX'); |
|
24 | +date_default_timezone_set('UTC'); |
|
25 | 25 | |
26 | 26 | require_once 'TestHelper.php'; |
27 | 27 | TestHelper::bootstrap(); |
@@ -95,8 +95,7 @@ |
||
95 | 95 | $value->getClientMimeType(), |
96 | 96 | $value->getError() |
97 | 97 | ); |
98 | - } |
|
99 | - elseif( is_array( $value ) ) |
|
98 | + } elseif( is_array( $value ) ) |
|
100 | 99 | { |
101 | 100 | $list[$key] = $this->createUploadedFiles( $value ); |
102 | 101 | } |
@@ -34,11 +34,11 @@ discard block |
||
34 | 34 | * @param \Aimeos\MW\View\Iface $view View instance with registered view helpers |
35 | 35 | * @param \Symfony\Component\HttpFoundation\Request $request Symfony2 request object |
36 | 36 | */ |
37 | - public function __construct( $view, \Symfony\Component\HttpFoundation\Request $request ) |
|
37 | + public function __construct($view, \Symfony\Component\HttpFoundation\Request $request) |
|
38 | 38 | { |
39 | 39 | $this->request = $request; |
40 | 40 | |
41 | - parent::__construct( $view, $this->createRequest( $request ) ); |
|
41 | + parent::__construct($view, $this->createRequest($request)); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | */ |
61 | 61 | public function getTarget() |
62 | 62 | { |
63 | - return $this->request->get( '_route' ); |
|
63 | + return $this->request->get('_route'); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | |
@@ -70,10 +70,10 @@ discard block |
||
70 | 70 | * @param \Symfony\Component\HttpFoundation\Request $nativeRequest Symfony request object |
71 | 71 | * @return \Psr\Http\Message\ServerRequestInterface PSR-7 request object |
72 | 72 | */ |
73 | - protected function createRequest( \Symfony\Component\HttpFoundation\Request $nativeRequest ) |
|
73 | + protected function createRequest(\Symfony\Component\HttpFoundation\Request $nativeRequest) |
|
74 | 74 | { |
75 | - $files = ServerRequestFactory::normalizeFiles( $this->getFiles( $nativeRequest->files->all() ) ); |
|
76 | - $server = ServerRequestFactory::normalizeServer( $nativeRequest->server->all() ); |
|
75 | + $files = ServerRequestFactory::normalizeFiles($this->getFiles($nativeRequest->files->all())); |
|
76 | + $server = ServerRequestFactory::normalizeServer($nativeRequest->server->all()); |
|
77 | 77 | $headers = $nativeRequest->headers->all(); |
78 | 78 | $cookies = $nativeRequest->cookies->all(); |
79 | 79 | $post = $nativeRequest->request->all(); |
@@ -81,13 +81,13 @@ discard block |
||
81 | 81 | $method = $nativeRequest->getMethod(); |
82 | 82 | $uri = $nativeRequest->getUri(); |
83 | 83 | |
84 | - $body = new Stream( 'php://temp', 'wb+' ); |
|
85 | - $body->write( $nativeRequest->getContent() ); |
|
84 | + $body = new Stream('php://temp', 'wb+'); |
|
85 | + $body->write($nativeRequest->getContent()); |
|
86 | 86 | |
87 | - $request = new ServerRequest( $server, $files, $uri, $method, $body, $headers, $cookies, $query, $post ); |
|
87 | + $request = new ServerRequest($server, $files, $uri, $method, $body, $headers, $cookies, $query, $post); |
|
88 | 88 | |
89 | - foreach( $nativeRequest->attributes->all() as $key => $value ) { |
|
90 | - $request = $request->withAttribute( $key, $value ); |
|
89 | + foreach ($nativeRequest->attributes->all() as $key => $value) { |
|
90 | + $request = $request->withAttribute($key, $value); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | return $request; |
@@ -100,13 +100,13 @@ discard block |
||
100 | 100 | * @param array $files Multi-dimensional list of uploaded files from Symfony request |
101 | 101 | * @return array Multi-dimensional list of uploaded files as PSR-7 objects |
102 | 102 | */ |
103 | - protected function getFiles( array $files ) |
|
103 | + protected function getFiles(array $files) |
|
104 | 104 | { |
105 | 105 | $list = array(); |
106 | 106 | |
107 | - foreach( $files as $key => $value ) |
|
107 | + foreach ($files as $key => $value) |
|
108 | 108 | { |
109 | - if( $value instanceof \Symfony\Component\HttpFoundation\File\UploadedFile ) |
|
109 | + if ($value instanceof \Symfony\Component\HttpFoundation\File\UploadedFile) |
|
110 | 110 | { |
111 | 111 | $list[$key] = new \Zend\Diactoros\UploadedFile( |
112 | 112 | $file->getRealPath(), |
@@ -116,9 +116,9 @@ discard block |
||
116 | 116 | $file->getClientMimeType() |
117 | 117 | ); |
118 | 118 | } |
119 | - elseif( is_array( $value ) ) |
|
119 | + elseif (is_array($value)) |
|
120 | 120 | { |
121 | - $list[$key] = $this->getFiles( $value ); |
|
121 | + $list[$key] = $this->getFiles($value); |
|
122 | 122 | } |
123 | 123 | } |
124 | 124 |
@@ -26,8 +26,8 @@ |
||
26 | 26 | * |
27 | 27 | * @param \Aimeos\MW\View\Iface $view View instance with registered view helpers |
28 | 28 | */ |
29 | - public function __construct( \Aimeos\MW\View\Iface $view ) |
|
29 | + public function __construct(\Aimeos\MW\View\Iface $view) |
|
30 | 30 | { |
31 | - parent::__construct( $view, new \Zend\Diactoros\Response() ); |
|
31 | + parent::__construct($view, new \Zend\Diactoros\Response()); |
|
32 | 32 | } |
33 | 33 | } |
@@ -17,23 +17,23 @@ |
||
17 | 17 | |
18 | 18 | protected function setUp() |
19 | 19 | { |
20 | - if( !class_exists( '\Zend\Diactoros\Response' ) ) { |
|
21 | - $this->markTestSkipped( '\Zend\Diactoros\Response is not available' ); |
|
20 | + if (!class_exists('\Zend\Diactoros\Response')) { |
|
21 | + $this->markTestSkipped('\Zend\Diactoros\Response is not available'); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | $view = new \Aimeos\MW\View\Standard(); |
25 | - $this->object = new \Aimeos\MW\View\Helper\Response\Symfony2( $view ); |
|
25 | + $this->object = new \Aimeos\MW\View\Helper\Response\Symfony2($view); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | |
29 | 29 | public function testTransform() |
30 | 30 | { |
31 | - $this->assertInstanceOf( '\Aimeos\MW\View\Helper\Response\Symfony2', $this->object->transform() ); |
|
31 | + $this->assertInstanceOf('\Aimeos\MW\View\Helper\Response\Symfony2', $this->object->transform()); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | |
35 | 35 | public function testCreateStream() |
36 | 36 | { |
37 | - $this->assertInstanceOf( '\Psr\Http\Message\StreamInterface', $this->object->createStream( __FILE__ ) ); |
|
37 | + $this->assertInstanceOf('\Psr\Http\Message\StreamInterface', $this->object->createStream(__FILE__)); |
|
38 | 38 | } |
39 | 39 | } |
@@ -15,35 +15,35 @@ |
||
15 | 15 | |
16 | 16 | protected function setUp() |
17 | 17 | { |
18 | - if( !class_exists( '\Symfony\Component\HttpFoundation\Request' ) ) { |
|
19 | - $this->markTestSkipped( '\Symfony\Component\HttpFoundation\Request is not available' ); |
|
18 | + if (!class_exists('\Symfony\Component\HttpFoundation\Request')) { |
|
19 | + $this->markTestSkipped('\Symfony\Component\HttpFoundation\Request is not available'); |
|
20 | 20 | } |
21 | 21 | |
22 | - if( !class_exists( '\Zend\Diactoros\Response' ) ) { |
|
23 | - $this->markTestSkipped( '\Zend\Diactoros\Response is not available' ); |
|
22 | + if (!class_exists('\Zend\Diactoros\Response')) { |
|
23 | + $this->markTestSkipped('\Zend\Diactoros\Response is not available'); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | $view = new \Aimeos\MW\View\Standard(); |
27 | - $param = array( 'HTTP_HOST' => 'localhost', 'REMOTE_ADDR' => '127.0.0.1' ); |
|
28 | - $request = new \Symfony\Component\HttpFoundation\Request( array(), array(), array(), array(), array(), $param, 'Content' ); |
|
29 | - $this->object = new \Aimeos\MW\View\Helper\Request\Symfony2( $view, $request ); |
|
27 | + $param = array('HTTP_HOST' => 'localhost', 'REMOTE_ADDR' => '127.0.0.1'); |
|
28 | + $request = new \Symfony\Component\HttpFoundation\Request(array(), array(), array(), array(), array(), $param, 'Content'); |
|
29 | + $this->object = new \Aimeos\MW\View\Helper\Request\Symfony2($view, $request); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | |
33 | 33 | public function testTransform() |
34 | 34 | { |
35 | - $this->assertInstanceOf( '\Aimeos\MW\View\Helper\Request\Symfony2', $this->object->transform() ); |
|
35 | + $this->assertInstanceOf('\Aimeos\MW\View\Helper\Request\Symfony2', $this->object->transform()); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
39 | 39 | public function testGetClientAddress() |
40 | 40 | { |
41 | - $this->assertEquals( '127.0.0.1', $this->object->getClientAddress() ); |
|
41 | + $this->assertEquals('127.0.0.1', $this->object->getClientAddress()); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | |
45 | 45 | public function testGetTarget() |
46 | 46 | { |
47 | - $this->assertEquals( null, $this->object->getTarget() ); |
|
47 | + $this->assertEquals(null, $this->object->getTarget()); |
|
48 | 48 | } |
49 | 49 | } |