1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* @license LGPLv3, http://opensource.org/licenses/LGPL-3.0 |
5
|
|
|
* @copyright Metaways Infosystems GmbH, 2011 |
6
|
|
|
* @copyright Aimeos (aimeos.org), 2015-2017 |
7
|
|
|
*/ |
8
|
|
|
|
9
|
|
|
|
10
|
|
|
namespace Aimeos\MShop\Order\Manager; |
11
|
|
|
|
12
|
|
|
|
13
|
|
|
class StandardTest extends \PHPUnit\Framework\TestCase |
14
|
|
|
{ |
15
|
|
|
private $context; |
16
|
|
|
private $object; |
17
|
|
|
private $editor = ''; |
18
|
|
|
|
19
|
|
|
|
20
|
|
|
protected function setUp() |
21
|
|
|
{ |
22
|
|
|
$this->editor = \TestHelperMShop::getContext()->getEditor(); |
23
|
|
|
$this->context = \TestHelperMShop::getContext(); |
24
|
|
|
$this->object = new \Aimeos\MShop\Order\Manager\Standard( $this->context ); |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
|
28
|
|
|
protected function tearDown() |
29
|
|
|
{ |
30
|
|
|
unset( $this->object ); |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
|
34
|
|
|
public function testAggregate() |
35
|
|
|
{ |
36
|
|
|
$search = $this->object->createSearch(); |
37
|
|
|
$search->setConditions( $search->compare( '==', 'order.editor', 'core:unittest' ) ); |
38
|
|
|
$result = $this->object->aggregate( $search, 'order.type' ); |
39
|
|
|
|
40
|
|
|
$this->assertEquals( 2, count( $result ) ); |
41
|
|
|
$this->assertArrayHasKey( 'web', $result ); |
42
|
|
|
$this->assertEquals( 3, $result['web'] ); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
|
46
|
|
|
public function testAggregateAvg() |
47
|
|
|
{ |
48
|
|
|
$search = $this->object->createSearch(); |
49
|
|
|
$search->setConditions( $search->compare( '==', 'order.editor', 'core:unittest' ) ); |
50
|
|
|
$result = $this->object->aggregate( $search, 'order.cmonth', 'order.base.price', 'avg' ); |
51
|
|
|
|
52
|
|
|
$this->assertEquals( 1, count( $result ) ); |
53
|
|
|
$this->assertEquals( '1384.750000', reset( $result ) ); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
|
57
|
|
|
public function testAggregateSum() |
58
|
|
|
{ |
59
|
|
|
$search = $this->object->createSearch(); |
60
|
|
|
$search->setConditions( $search->compare( '==', 'order.editor', 'core:unittest' ) ); |
61
|
|
|
$result = $this->object->aggregate( $search, 'order.cmonth', 'order.base.price', 'sum' ); |
62
|
|
|
|
63
|
|
|
$this->assertEquals( 1, count( $result ) ); |
64
|
|
|
$this->assertEquals( '5539.00', reset( $result ) ); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
|
68
|
|
|
public function testAggregateTimes() |
69
|
|
|
{ |
70
|
|
|
$search = $this->object->createSearch(); |
71
|
|
|
$search->setConditions( $search->compare( '==', 'order.editor', 'core:unittest' ) ); |
72
|
|
|
$search->setSortations( array( $search->sort( '-', 'order.cdate' ) ) ); |
73
|
|
|
$result = $this->object->aggregate( $search, 'order.cmonth' ); |
74
|
|
|
|
75
|
|
|
$this->assertEquals( 1, count( $result ) ); |
76
|
|
|
$this->assertEquals( 4, reset( $result ) ); |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
|
80
|
|
|
public function testAggregateAddress() |
81
|
|
|
{ |
82
|
|
|
$search = $this->object->createSearch(); |
83
|
|
|
$search->setConditions( $search->compare( '==', 'order.editor', 'core:unittest' ) ); |
84
|
|
|
$result = $this->object->aggregate( $search, 'order.base.address.countryid' ); |
85
|
|
|
|
86
|
|
|
$this->assertEquals( 1, count( $result ) ); |
87
|
|
|
$this->assertArrayHasKey( 'DE', $result ); |
88
|
|
|
$this->assertEquals( 4, reset( $result ) ); |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
|
92
|
|
|
public function testAggregateMonth() |
93
|
|
|
{ |
94
|
|
|
$search = $this->object->createSearch(); |
95
|
|
|
$search->setConditions( $search->compare( '==', 'order.editor', 'core:unittest' ) ); |
96
|
|
|
$result = $this->object->aggregate( $search, 'order.type' ); |
97
|
|
|
|
98
|
|
|
$this->assertEquals( 2, count( $result ) ); |
99
|
|
|
$this->assertArrayHasKey( 'web', $result ); |
100
|
|
|
$this->assertEquals( 3, $result['web'] ); |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
|
104
|
|
|
public function testCleanup() |
105
|
|
|
{ |
106
|
|
|
$this->object->cleanup( array( -1 ) ); |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
|
110
|
|
|
public function testGetResourceType() |
111
|
|
|
{ |
112
|
|
|
$result = $this->object->getResourceType(); |
113
|
|
|
|
114
|
|
|
$this->assertContains( 'order', $result ); |
115
|
|
|
$this->assertContains( 'order/status', $result ); |
116
|
|
|
$this->assertContains( 'order/base', $result ); |
117
|
|
|
$this->assertContains( 'order/base/address', $result ); |
118
|
|
|
$this->assertContains( 'order/base/coupon', $result ); |
119
|
|
|
$this->assertContains( 'order/base/product', $result ); |
120
|
|
|
$this->assertContains( 'order/base/product/attribute', $result ); |
121
|
|
|
$this->assertContains( 'order/base/service', $result ); |
122
|
|
|
$this->assertContains( 'order/base/service/attribute', $result ); |
123
|
|
|
} |
124
|
|
|
|
125
|
|
|
|
126
|
|
|
public function testCreateItem() |
127
|
|
|
{ |
128
|
|
|
$this->assertInstanceOf( '\\Aimeos\\MShop\\Order\\Item\\Iface', $this->object->createItem() ); |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
|
132
|
|
|
public function testGetItem() |
133
|
|
|
{ |
134
|
|
|
$status = \Aimeos\MShop\Order\Item\Base::PAY_RECEIVED; |
135
|
|
|
|
136
|
|
|
$search = $this->object->createSearch(); |
137
|
|
|
$conditions = array( |
138
|
|
|
$search->compare( '==', 'order.statuspayment', $status ), |
139
|
|
|
$search->compare( '==', 'order.editor', $this->editor ) |
140
|
|
|
); |
141
|
|
|
$search->setConditions( $search->combine( '&&', $conditions ) ); |
142
|
|
|
$results = $this->object->searchItems( $search ); |
143
|
|
|
|
144
|
|
|
if( ( $expected = reset( $results ) ) === false ) { |
145
|
|
|
throw new \RuntimeException( sprintf( 'No order found in shop_order_invoice with statuspayment "%1$s"', $status ) ); |
146
|
|
|
} |
147
|
|
|
|
148
|
|
|
$actual = $this->object->getItem( $expected->getId() ); |
149
|
|
|
$this->assertEquals( $expected, $actual ); |
150
|
|
|
} |
151
|
|
|
|
152
|
|
|
|
153
|
|
|
public function testSaveInvalid() |
154
|
|
|
{ |
155
|
|
|
$this->setExpectedException( '\Aimeos\MShop\Order\Exception' ); |
156
|
|
|
$this->object->saveItem( new \Aimeos\MShop\Locale\Item\Standard() ); |
157
|
|
|
} |
158
|
|
|
|
159
|
|
|
|
160
|
|
|
public function testSaveUpdateDeleteItem() |
161
|
|
|
{ |
162
|
|
|
$search = $this->object->createSearch(); |
163
|
|
|
$conditions = array( |
164
|
|
|
$search->compare( '==', 'order.type', \Aimeos\MShop\Order\Item\Base::TYPE_PHONE ), |
165
|
|
|
$search->compare( '==', 'order.editor', $this->editor ) |
166
|
|
|
); |
167
|
|
|
$search->setConditions( $search->combine( '&&', $conditions ) ); |
168
|
|
|
$results = $this->object->searchItems( $search ); |
169
|
|
|
|
170
|
|
|
if( ( $item = reset( $results ) ) === false ) { |
171
|
|
|
throw new \RuntimeException( 'No order item found.' ); |
172
|
|
|
} |
173
|
|
|
|
174
|
|
|
$item->setId( null ); |
175
|
|
|
$resultSaved = $this->object->saveItem( $item ); |
176
|
|
|
$itemSaved = $this->object->getItem( $item->getId() ); |
177
|
|
|
|
178
|
|
|
$itemExp = clone $itemSaved; |
179
|
|
|
$itemExp->setType( \Aimeos\MShop\Order\Item\Base::TYPE_WEB ); |
180
|
|
|
$resultUpd = $this->object->saveItem( $itemExp ); |
181
|
|
|
$itemUpd = $this->object->getItem( $itemExp->getId() ); |
182
|
|
|
|
183
|
|
|
$this->object->deleteItem( $itemSaved->getId() ); |
184
|
|
|
|
185
|
|
|
|
186
|
|
|
$this->assertTrue( $item->getId() !== null ); |
187
|
|
|
$this->assertEquals( $item->getId(), $itemSaved->getId() ); |
188
|
|
|
$this->assertEquals( $item->getSiteId(), $itemSaved->getSiteId() ); |
189
|
|
|
$this->assertEquals( $item->getBaseId(), $itemSaved->getBaseId() ); |
190
|
|
|
$this->assertEquals( $item->getType(), $itemSaved->getType() ); |
191
|
|
|
$this->assertEquals( $item->getDatePayment(), $itemSaved->getDatePayment() ); |
192
|
|
|
$this->assertEquals( $item->getDateDelivery(), $itemSaved->getDateDelivery() ); |
193
|
|
|
$this->assertEquals( $item->getPaymentStatus(), $itemSaved->getPaymentStatus() ); |
194
|
|
|
$this->assertEquals( $item->getDeliveryStatus(), $itemSaved->getDeliveryStatus() ); |
195
|
|
|
$this->assertEquals( $item->getRelatedId(), $itemSaved->getRelatedId() ); |
196
|
|
|
|
197
|
|
|
$this->assertEquals( $this->editor, $itemSaved->getEditor() ); |
198
|
|
|
$this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated() ); |
199
|
|
|
$this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified() ); |
200
|
|
|
|
201
|
|
|
$this->assertEquals( $itemExp->getId(), $itemUpd->getId() ); |
202
|
|
|
$this->assertEquals( $itemExp->getSiteId(), $itemUpd->getSiteId() ); |
203
|
|
|
$this->assertEquals( $itemExp->getBaseId(), $itemUpd->getBaseId() ); |
204
|
|
|
$this->assertEquals( $itemExp->getType(), $itemUpd->getType() ); |
205
|
|
|
$this->assertEquals( $itemExp->getDatePayment(), $itemUpd->getDatePayment() ); |
206
|
|
|
$this->assertEquals( $itemExp->getDateDelivery(), $itemUpd->getDateDelivery() ); |
207
|
|
|
$this->assertEquals( $itemExp->getPaymentStatus(), $itemUpd->getPaymentStatus() ); |
208
|
|
|
$this->assertEquals( $itemExp->getDeliveryStatus(), $itemUpd->getDeliveryStatus() ); |
209
|
|
|
$this->assertEquals( $itemExp->getRelatedId(), $itemUpd->getRelatedId() ); |
210
|
|
|
|
211
|
|
|
$this->assertEquals( $this->editor, $itemUpd->getEditor() ); |
212
|
|
|
$this->assertEquals( $itemExp->getTimeCreated(), $itemUpd->getTimeCreated() ); |
213
|
|
|
$this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified() ); |
214
|
|
|
|
215
|
|
|
$this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Iface', $resultSaved ); |
216
|
|
|
$this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Iface', $resultUpd ); |
217
|
|
|
|
218
|
|
|
$this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
219
|
|
|
$this->object->getItem( $itemSaved->getId() ); |
220
|
|
|
} |
221
|
|
|
|
222
|
|
|
|
223
|
|
|
public function testSaveStatusUpdatePayment() |
224
|
|
|
{ |
225
|
|
|
$statusManager = \Aimeos\MShop\Factory::createManager( $this->context, 'order/status' ); |
226
|
|
|
|
227
|
|
|
$search = $this->object->createSearch(); |
228
|
|
|
$conditions = array( |
229
|
|
|
$search->compare( '==', 'order.type', \Aimeos\MShop\Order\Item\Base::TYPE_PHONE ), |
230
|
|
|
$search->compare( '==', 'order.editor', $this->editor ) |
231
|
|
|
); |
232
|
|
|
$search->setConditions( $search->combine( '&&', $conditions ) ); |
233
|
|
|
$results = $this->object->searchItems( $search ); |
234
|
|
|
|
235
|
|
|
if( ( $item = reset( $results ) ) === false ) { |
236
|
|
|
throw new \RuntimeException( 'No order item found.' ); |
237
|
|
|
} |
238
|
|
|
|
239
|
|
|
$item->setId( null ); |
240
|
|
|
$this->object->saveItem( $item ); |
241
|
|
|
|
242
|
|
|
|
243
|
|
|
$search = $statusManager->createSearch(); |
244
|
|
|
$search->setConditions( $search->compare( '==', 'order.status.parentid', $item->getId() ) ); |
245
|
|
|
$results = $statusManager->searchItems( $search ); |
246
|
|
|
|
247
|
|
|
$this->object->deleteItem( $item->getId() ); |
248
|
|
|
|
249
|
|
|
$this->assertEquals( 0, count( $results ) ); |
250
|
|
|
|
251
|
|
|
|
252
|
|
|
$item->setId( null ); |
253
|
|
|
$item->setPaymentStatus( \Aimeos\MShop\Order\Item\Base::PAY_CANCELED ); |
254
|
|
|
$this->object->saveItem( $item ); |
255
|
|
|
|
256
|
|
|
$search = $statusManager->createSearch(); |
257
|
|
|
$search->setConditions( $search->compare( '==', 'order.status.parentid', $item->getId() ) ); |
258
|
|
|
$results = $statusManager->searchItems( $search ); |
259
|
|
|
|
260
|
|
|
$this->object->deleteItem( $item->getId() ); |
261
|
|
|
|
262
|
|
|
if( ( $statusItem = reset( $results ) ) === false ) { |
263
|
|
|
throw new \RuntimeException( 'No status item found' ); |
264
|
|
|
} |
265
|
|
|
|
266
|
|
|
$this->assertEquals( 1, count( $results ) ); |
267
|
|
|
$this->assertEquals( \Aimeos\MShop\Order\Item\Status\Base::STATUS_PAYMENT, $statusItem->getType() ); |
268
|
|
|
$this->assertEquals( \Aimeos\MShop\Order\Item\Base::PAY_CANCELED, $statusItem->getValue() ); |
269
|
|
|
} |
270
|
|
|
|
271
|
|
|
|
272
|
|
|
public function testSaveStatusUpdateDelivery() |
273
|
|
|
{ |
274
|
|
|
$statusManager = \Aimeos\MShop\Factory::createManager( $this->context, 'order/status' ); |
275
|
|
|
|
276
|
|
|
$search = $this->object->createSearch(); |
277
|
|
|
$conditions = array( |
278
|
|
|
$search->compare( '==', 'order.type', \Aimeos\MShop\Order\Item\Base::TYPE_PHONE ), |
279
|
|
|
$search->compare( '==', 'order.editor', $this->editor ) |
280
|
|
|
); |
281
|
|
|
$search->setConditions( $search->combine( '&&', $conditions ) ); |
282
|
|
|
$results = $this->object->searchItems( $search ); |
283
|
|
|
|
284
|
|
|
if( ( $item = reset( $results ) ) === false ) { |
285
|
|
|
throw new \RuntimeException( 'No order item found.' ); |
286
|
|
|
} |
287
|
|
|
|
288
|
|
|
$item->setId( null ); |
289
|
|
|
$this->object->saveItem( $item ); |
290
|
|
|
|
291
|
|
|
|
292
|
|
|
$search = $statusManager->createSearch(); |
293
|
|
|
$search->setConditions( $search->compare( '==', 'order.status.parentid', $item->getId() ) ); |
294
|
|
|
$results = $statusManager->searchItems( $search ); |
295
|
|
|
|
296
|
|
|
$this->object->deleteItem( $item->getId() ); |
297
|
|
|
|
298
|
|
|
$this->assertEquals( 0, count( $results ) ); |
299
|
|
|
|
300
|
|
|
|
301
|
|
|
$item->setId( null ); |
302
|
|
|
$item->setDeliveryStatus( \Aimeos\MShop\Order\Item\Base::STAT_LOST ); |
303
|
|
|
$this->object->saveItem( $item ); |
304
|
|
|
|
305
|
|
|
$search = $statusManager->createSearch(); |
306
|
|
|
$search->setConditions( $search->compare( '==', 'order.status.parentid', $item->getId() ) ); |
307
|
|
|
$results = $statusManager->searchItems( $search ); |
308
|
|
|
|
309
|
|
|
$this->object->deleteItem( $item->getId() ); |
310
|
|
|
|
311
|
|
|
if( ( $statusItem = reset( $results ) ) === false ) { |
312
|
|
|
throw new \RuntimeException( 'No status item found' ); |
313
|
|
|
} |
314
|
|
|
|
315
|
|
|
$this->assertEquals( 1, count( $results ) ); |
316
|
|
|
$this->assertEquals( \Aimeos\MShop\Order\Item\Status\Base::STATUS_DELIVERY, $statusItem->getType() ); |
317
|
|
|
$this->assertEquals( \Aimeos\MShop\Order\Item\Base::STAT_LOST, $statusItem->getValue() ); |
318
|
|
|
} |
319
|
|
|
|
320
|
|
|
|
321
|
|
|
public function testCreateSearch() |
322
|
|
|
{ |
323
|
|
|
$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $this->object->createSearch() ); |
324
|
|
|
} |
325
|
|
|
|
326
|
|
|
|
327
|
|
|
public function testSearchItems() |
328
|
|
|
{ |
329
|
|
|
$siteid = $this->context->getLocale()->getSiteId(); |
330
|
|
|
|
331
|
|
|
$total = 0; |
332
|
|
|
$search = $this->object->createSearch(); |
333
|
|
|
|
334
|
|
|
$param = array( (string) \Aimeos\MShop\Order\Item\Status\Base::STATUS_PAYMENT, (string) \Aimeos\MShop\Order\Item\Base::PAY_RECEIVED ); |
335
|
|
|
$funcStatPayment = $search->createFunction( 'order.containsStatus', $param ); |
336
|
|
|
|
337
|
|
|
$expr = []; |
338
|
|
|
$expr[] = $search->compare( '!=', 'order.id', null ); |
339
|
|
|
$expr[] = $search->compare( '==', 'order.siteid', $siteid ); |
340
|
|
|
$expr[] = $search->compare( '!=', 'order.baseid', null ); |
341
|
|
|
$expr[] = $search->compare( '==', 'order.type', 'web' ); |
342
|
|
|
$expr[] = $search->compare( '==', 'order.datepayment', '2008-02-15 12:34:56' ); |
343
|
|
|
$expr[] = $search->compare( '==', 'order.datedelivery', null ); |
344
|
|
|
$expr[] = $search->compare( '==', 'order.statuspayment', \Aimeos\MShop\Order\Item\Base::PAY_RECEIVED ); |
345
|
|
|
$expr[] = $search->compare( '==', 'order.statusdelivery', 4 ); |
346
|
|
|
$expr[] = $search->compare( '==', 'order.relatedid', null ); |
347
|
|
|
$expr[] = $search->compare( '>=', 'order.mtime', '1970-01-01 00:00:00' ); |
348
|
|
|
$expr[] = $search->compare( '>=', 'order.ctime', '1970-01-01 00:00:00' ); |
349
|
|
|
$expr[] = $search->compare( '==', 'order.editor', $this->editor ); |
350
|
|
|
$expr[] = $search->compare( '==', $funcStatPayment, 1 ); |
351
|
|
|
|
352
|
|
|
$expr[] = $search->compare( '!=', 'order.status.id', null ); |
353
|
|
|
$expr[] = $search->compare( '==', 'order.status.siteid', $siteid ); |
354
|
|
|
$expr[] = $search->compare( '!=', 'order.status.parentid', null ); |
355
|
|
|
$expr[] = $search->compare( '>=', 'order.status.type', 'typestatus' ); |
356
|
|
|
$expr[] = $search->compare( '==', 'order.status.value', 'shipped' ); |
357
|
|
|
$expr[] = $search->compare( '>=', 'order.status.mtime', '1970-01-01 00:00:00' ); |
358
|
|
|
$expr[] = $search->compare( '>=', 'order.status.ctime', '1970-01-01 00:00:00' ); |
359
|
|
|
$expr[] = $search->compare( '==', 'order.status.editor', $this->editor ); |
360
|
|
|
|
361
|
|
|
$expr[] = $search->compare( '!=', 'order.base.id', null ); |
362
|
|
|
$expr[] = $search->compare( '==', 'order.base.siteid', $siteid ); |
363
|
|
|
$expr[] = $search->compare( '==', 'order.base.sitecode', 'unittest' ); |
364
|
|
|
$expr[] = $search->compare( '>=', 'order.base.customerid', '' ); |
365
|
|
|
$expr[] = $search->compare( '==', 'order.base.languageid', 'de' ); |
366
|
|
|
$expr[] = $search->compare( '==', 'order.base.currencyid', 'EUR' ); |
367
|
|
|
$expr[] = $search->compare( '==', 'order.base.price', '53.50' ); |
368
|
|
|
$expr[] = $search->compare( '==', 'order.base.costs', '1.50' ); |
369
|
|
|
$expr[] = $search->compare( '==', 'order.base.rebate', '14.50' ); |
370
|
|
|
$expr[] = $search->compare( '~=', 'order.base.comment', 'This is a comment' ); |
371
|
|
|
$expr[] = $search->compare( '>=', 'order.base.mtime', '1970-01-01 00:00:00' ); |
372
|
|
|
$expr[] = $search->compare( '>=', 'order.base.ctime', '1970-01-01 00:00:00' ); |
373
|
|
|
$expr[] = $search->compare( '==', 'order.base.editor', $this->editor ); |
374
|
|
|
|
375
|
|
|
$expr[] = $search->compare( '!=', 'order.base.address.id', null ); |
376
|
|
|
$expr[] = $search->compare( '==', 'order.base.address.siteid', $siteid ); |
377
|
|
|
$expr[] = $search->compare( '!=', 'order.base.address.baseid', null ); |
378
|
|
|
$expr[] = $search->compare( '==', 'order.base.address.type', 'payment' ); |
379
|
|
|
$expr[] = $search->compare( '==', 'order.base.address.company', '' ); |
380
|
|
|
$expr[] = $search->compare( '==', 'order.base.address.vatid', '' ); |
381
|
|
|
$expr[] = $search->compare( '==', 'order.base.address.salutation', 'mr' ); |
382
|
|
|
$expr[] = $search->compare( '==', 'order.base.address.title', '' ); |
383
|
|
|
$expr[] = $search->compare( '==', 'order.base.address.firstname', 'Our' ); |
384
|
|
|
$expr[] = $search->compare( '==', 'order.base.address.lastname', 'Unittest' ); |
385
|
|
|
$expr[] = $search->compare( '==', 'order.base.address.address1', 'Durchschnitt' ); |
386
|
|
|
$expr[] = $search->compare( '==', 'order.base.address.address2', '1' ); |
387
|
|
|
$expr[] = $search->compare( '==', 'order.base.address.address3', '' ); |
388
|
|
|
$expr[] = $search->compare( '==', 'order.base.address.postal', '20146' ); |
389
|
|
|
$expr[] = $search->compare( '==', 'order.base.address.city', 'Hamburg' ); |
390
|
|
|
$expr[] = $search->compare( '==', 'order.base.address.state', 'Hamburg' ); |
391
|
|
|
$expr[] = $search->compare( '==', 'order.base.address.countryid', 'DE' ); |
392
|
|
|
$expr[] = $search->compare( '==', 'order.base.address.languageid', 'de' ); |
393
|
|
|
$expr[] = $search->compare( '==', 'order.base.address.telephone', '055544332211' ); |
394
|
|
|
$expr[] = $search->compare( '==', 'order.base.address.email', '[email protected]' ); |
395
|
|
|
$expr[] = $search->compare( '==', 'order.base.address.telefax', '055544332213' ); |
396
|
|
|
$expr[] = $search->compare( '==', 'order.base.address.website', 'www.metaways.net' ); |
397
|
|
|
$expr[] = $search->compare( '>=', 'order.base.address.mtime', '1970-01-01 00:00:00' ); |
398
|
|
|
$expr[] = $search->compare( '>=', 'order.base.address.ctime', '1970-01-01 00:00:00' ); |
399
|
|
|
$expr[] = $search->compare( '==', 'order.base.address.editor', $this->editor ); |
400
|
|
|
|
401
|
|
|
$expr[] = $search->compare( '!=', 'order.base.coupon.id', null ); |
402
|
|
|
$expr[] = $search->compare( '==', 'order.base.coupon.siteid', $siteid ); |
403
|
|
|
$expr[] = $search->compare( '!=', 'order.base.coupon.baseid', null ); |
404
|
|
|
$expr[] = $search->compare( '!=', 'order.base.coupon.productid', null ); |
405
|
|
|
$expr[] = $search->compare( '==', 'order.base.coupon.code', 'OPQR' ); |
406
|
|
|
$expr[] = $search->compare( '>=', 'order.base.coupon.mtime', '1970-01-01 00:00:00' ); |
407
|
|
|
$expr[] = $search->compare( '>=', 'order.base.coupon.ctime', '1970-01-01 00:00:00' ); |
408
|
|
|
$expr[] = $search->compare( '>=', 'order.base.coupon.editor', '' ); |
409
|
|
|
|
410
|
|
|
$expr[] = $search->compare( '!=', 'order.base.product.id', null ); |
411
|
|
|
$expr[] = $search->compare( '==', 'order.base.product.siteid', $siteid ); |
412
|
|
|
$expr[] = $search->compare( '!=', 'order.base.product.baseid', null ); |
413
|
|
|
$expr[] = $search->compare( '!=', 'order.base.product.productid', null ); |
414
|
|
|
$expr[] = $search->compare( '==', 'order.base.product.prodcode', 'CNE' ); |
415
|
|
|
$expr[] = $search->compare( '==', 'order.base.product.suppliercode', 'unitsupplier' ); |
416
|
|
|
$expr[] = $search->compare( '==', 'order.base.product.name', 'Cafe Noire Expresso' ); |
417
|
|
|
$expr[] = $search->compare( '==', 'order.base.product.mediaurl', 'somewhere/thump1.jpg' ); |
418
|
|
|
$expr[] = $search->compare( '==', 'order.base.product.quantity', 9 ); |
419
|
|
|
$expr[] = $search->compare( '==', 'order.base.product.price', '4.50' ); |
420
|
|
|
$expr[] = $search->compare( '==', 'order.base.product.costs', '0.00' ); |
421
|
|
|
$expr[] = $search->compare( '==', 'order.base.product.rebate', '0.00' ); |
422
|
|
|
$expr[] = $search->compare( '==', 'order.base.product.taxrate', '0.00' ); |
423
|
|
|
$expr[] = $search->compare( '==', 'order.base.product.flags', 0 ); |
424
|
|
|
$expr[] = $search->compare( '==', 'order.base.product.position', 1 ); |
425
|
|
|
$expr[] = $search->compare( '==', 'order.base.product.status', 1 ); |
426
|
|
|
$expr[] = $search->compare( '>=', 'order.base.product.mtime', '1970-01-01 00:00:00' ); |
427
|
|
|
$expr[] = $search->compare( '>=', 'order.base.product.ctime', '1970-01-01 00:00:00' ); |
428
|
|
|
$expr[] = $search->compare( '==', 'order.base.product.editor', $this->editor ); |
429
|
|
|
|
430
|
|
|
$expr[] = $search->compare( '!=', 'order.base.product.attribute.id', null ); |
431
|
|
|
$expr[] = $search->compare( '==', 'order.base.product.attribute.siteid', $siteid ); |
432
|
|
|
$expr[] = $search->compare( '!=', 'order.base.product.attribute.parentid', null ); |
433
|
|
|
$expr[] = $search->compare( '==', 'order.base.product.attribute.code', 'width' ); |
434
|
|
|
$expr[] = $search->compare( '==', 'order.base.product.attribute.value', '33' ); |
435
|
|
|
$expr[] = $search->compare( '==', 'order.base.product.attribute.name', '33' ); |
436
|
|
|
$expr[] = $search->compare( '>=', 'order.base.product.attribute.mtime', '1970-01-01 00:00:00' ); |
437
|
|
|
$expr[] = $search->compare( '>=', 'order.base.product.attribute.ctime', '1970-01-01 00:00:00' ); |
438
|
|
|
$expr[] = $search->compare( '==', 'order.base.product.attribute.editor', $this->editor ); |
439
|
|
|
|
440
|
|
|
$expr[] = $search->compare( '!=', 'order.base.service.id', null ); |
441
|
|
|
$expr[] = $search->compare( '==', 'order.base.service.siteid', $siteid ); |
442
|
|
|
$expr[] = $search->compare( '!=', 'order.base.service.baseid', null ); |
443
|
|
|
$expr[] = $search->compare( '==', 'order.base.service.type', 'payment' ); |
444
|
|
|
$expr[] = $search->compare( '==', 'order.base.service.code', 'OGONE' ); |
445
|
|
|
$expr[] = $search->compare( '==', 'order.base.service.name', 'ogone' ); |
446
|
|
|
$expr[] = $search->compare( '==', 'order.base.service.price', '0.00' ); |
447
|
|
|
$expr[] = $search->compare( '==', 'order.base.service.costs', '0.00' ); |
448
|
|
|
$expr[] = $search->compare( '==', 'order.base.service.rebate', '0.00' ); |
449
|
|
|
$expr[] = $search->compare( '==', 'order.base.service.taxrate', '0.00' ); |
450
|
|
|
$expr[] = $search->compare( '>=', 'order.base.service.mtime', '1970-01-01 00:00:00' ); |
451
|
|
|
$expr[] = $search->compare( '>=', 'order.base.service.ctime', '1970-01-01 00:00:00' ); |
452
|
|
|
$expr[] = $search->compare( '==', 'order.base.service.editor', $this->editor ); |
453
|
|
|
|
454
|
|
|
$expr[] = $search->compare( '!=', 'order.base.service.attribute.id', null ); |
455
|
|
|
$expr[] = $search->compare( '==', 'order.base.service.attribute.siteid', $siteid ); |
456
|
|
|
$expr[] = $search->compare( '!=', 'order.base.service.attribute.parentid', null ); |
457
|
|
|
$expr[] = $search->compare( '==', 'order.base.service.attribute.code', 'NAME' ); |
458
|
|
|
$expr[] = $search->compare( '==', 'order.base.service.attribute.value', '"CreditCard"' ); |
459
|
|
|
$expr[] = $search->compare( '>=', 'order.base.service.attribute.mtime', '1970-01-01 00:00:00' ); |
460
|
|
|
$expr[] = $search->compare( '>=', 'order.base.service.attribute.ctime', '1970-01-01 00:00:00' ); |
461
|
|
|
$expr[] = $search->compare( '==', 'order.base.service.attribute.editor', $this->editor ); |
462
|
|
|
|
463
|
|
|
|
464
|
|
|
|
465
|
|
|
$search->setConditions( $search->combine( '&&', $expr ) ); |
466
|
|
|
$result = $this->object->searchItems( $search, [], $total ); |
467
|
|
|
|
468
|
|
|
$this->assertEquals( 1, count( $result ) ); |
469
|
|
|
$this->assertEquals( 1, $total ); |
470
|
|
|
|
471
|
|
|
|
472
|
|
|
$search = $this->object->createSearch(); |
473
|
|
|
$conditions = array( |
474
|
|
|
$search->compare( '==', 'order.statuspayment', \Aimeos\MShop\Order\Item\Base::PAY_RECEIVED ), |
475
|
|
|
$search->compare( '==', 'order.editor', $this->editor ) |
476
|
|
|
); |
477
|
|
|
$search->setConditions( $search->combine( '&&', $conditions ) ); |
478
|
|
|
$search->setSlice( 0, 1 ); |
479
|
|
|
$total = 0; |
480
|
|
|
$items = $this->object->searchItems( $search, [], $total ); |
481
|
|
|
|
482
|
|
|
$this->assertEquals( 1, count( $items ) ); |
483
|
|
|
$this->assertEquals( 3, $total ); |
484
|
|
|
|
485
|
|
|
foreach( $items as $itemId => $item ) { |
486
|
|
|
$this->assertEquals( $itemId, $item->getId() ); |
487
|
|
|
} |
488
|
|
|
} |
489
|
|
|
|
490
|
|
|
|
491
|
|
|
public function testGetSubManager() |
492
|
|
|
{ |
493
|
|
|
$this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager( 'base' ) ); |
494
|
|
|
$this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager( 'base', 'Standard' ) ); |
495
|
|
|
$this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager( 'status' ) ); |
496
|
|
|
$this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager( 'status', 'Standard' ) ); |
497
|
|
|
|
498
|
|
|
|
499
|
|
|
$this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
500
|
|
|
$this->object->getSubManager( 'unknown' ); |
501
|
|
|
} |
502
|
|
|
|
503
|
|
|
|
504
|
|
|
public function testGetSubManagerInvalidName() |
505
|
|
|
{ |
506
|
|
|
$this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
507
|
|
|
$this->object->getSubManager( 'base', 'unknown' ); |
508
|
|
|
} |
509
|
|
|
|
510
|
|
|
} |
511
|
|
|
|