1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* @license LGPLv3, http://opensource.org/licenses/LGPL-3.0 |
5
|
|
|
* @copyright Aimeos (aimeos.org), 2018 |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
namespace Aimeos\Controller\Common\Subscription\Export\Csv\Processor\Product; |
9
|
|
|
|
10
|
|
|
|
11
|
|
|
class StandardTest extends \PHPUnit\Framework\TestCase |
|
|
|
|
12
|
|
|
{ |
13
|
|
|
public function testProcess() |
14
|
|
|
{ |
15
|
|
|
$context = \TestHelperCntl::getContext(); |
16
|
|
|
$mapping = array( |
17
|
|
|
0 => 'order.base.product.type', |
18
|
|
|
1 => 'order.base.product.stocktype', |
19
|
|
|
2 => 'order.base.product.suppliercode', |
20
|
|
|
3 => 'order.base.product.prodcode', |
21
|
|
|
4 => 'order.base.product.productid', |
22
|
|
|
5 => 'order.base.product.quantity', |
23
|
|
|
6 => 'order.base.product.name', |
24
|
|
|
7 => 'order.base.product.mediaurl', |
25
|
|
|
8 => 'order.base.product.price', |
26
|
|
|
9 => 'order.base.product.costs', |
27
|
|
|
10 => 'order.base.product.rebate', |
28
|
|
|
11 => 'order.base.product.taxrate', |
29
|
|
|
12 => 'order.base.product.status', |
30
|
|
|
13 => 'order.base.product.position', |
31
|
|
|
14 => 'order.base.product.attribute.type', |
32
|
|
|
15 => 'order.base.product.attribute.code', |
33
|
|
|
16 => 'order.base.product.attribute.name', |
34
|
|
|
17 => 'order.base.product.attribute.value', |
35
|
|
|
); |
36
|
|
|
|
37
|
|
|
|
38
|
|
|
$object = new \Aimeos\Controller\Common\Subscription\Export\Csv\Processor\Product\Standard( $context, $mapping ); |
39
|
|
|
|
40
|
|
|
$subscription = $this->getSubscription( $context ); |
41
|
|
|
$order = \Aimeos\MShop::create( $context, 'order/base' )->load( $subscription->getOrderBaseId() ); |
|
|
|
|
42
|
|
|
|
43
|
|
|
$data = $object->process( $subscription, $order ); |
44
|
|
|
|
45
|
|
|
|
46
|
|
|
$this->assertEquals( 1, count( $data ) ); |
47
|
|
|
|
48
|
|
|
$this->assertEquals( 18, count( $data[0] ) ); |
49
|
|
|
$this->assertEquals( 'default', $data[0][0] ); |
50
|
|
|
$this->assertEquals( 'unit_type1', $data[0][1] ); |
51
|
|
|
$this->assertEquals( 'unitsupplier', $data[0][2] ); |
52
|
|
|
$this->assertEquals( 'CNE', $data[0][3] ); |
53
|
|
|
$this->assertGreaterThan( 0, $data[0][4] ); |
54
|
|
|
$this->assertEquals( '9', $data[0][5] ); |
55
|
|
|
$this->assertEquals( 'Cafe Noire Expresso', $data[0][6] ); |
56
|
|
|
$this->assertEquals( 'somewhere/thump1.jpg', $data[0][7] ); |
57
|
|
|
$this->assertEquals( '4.50', $data[0][8] ); |
58
|
|
|
$this->assertEquals( '0.00', $data[0][9] ); |
59
|
|
|
$this->assertEquals( '0.00', $data[0][10] ); |
60
|
|
|
$this->assertEquals( '0.0000', $data[0][11] ); |
61
|
|
|
$this->assertEquals( '1', $data[0][12] ); |
62
|
|
|
$this->assertEquals( '1', $data[0][13] ); |
63
|
|
|
$this->assertEquals( "default\ndefault\nconfig", $data[0][14] ); |
64
|
|
|
$this->assertEquals( "width\nlength\ninterval", $data[0][15] ); |
65
|
|
|
$this->assertEquals( "33\n36\nP0Y1M0W0D", $data[0][16] ); |
66
|
|
|
$this->assertEquals( "33\n36\nP0Y1M0W0D", $data[0][17] ); |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
|
70
|
|
|
protected function getSubscription( $context ) |
71
|
|
|
{ |
72
|
|
|
$manager = \Aimeos\MShop::create( $context, 'subscription' ); |
73
|
|
|
|
74
|
|
|
$search = $manager->createSearch(); |
75
|
|
|
$search->setConditions( $search->compare( '==', 'subscription.dateend', '2010-01-01' ) ); |
76
|
|
|
|
77
|
|
|
$items = $manager->searchItems( $search ); |
78
|
|
|
|
79
|
|
|
if( ( $item = reset( $items ) ) !== false ) { |
80
|
|
|
return $item; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
throw new \Exception( 'No subscription item found' ); |
84
|
|
|
} |
85
|
|
|
} |
86
|
|
|
|
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