Completed
Push — master ( 6dd458...ee0799 )
by Aimeos
10s
created
tests/Controller/Common/Order/Export/Csv/Processor/Invoice/StandardTest.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -34,50 +34,50 @@
 block discarded – undo
34 34
 		);
35 35
 
36 36
 
37
-		$object = new \Aimeos\Controller\Common\Order\Export\Csv\Processor\Invoice\Standard( $context, $mapping );
38
-
39
-		$invoice = $this->getInvoice( $context );
40
-		$order = \Aimeos\MShop\Factory::createManager( $context, 'order/base' )->load( $invoice->getBaseId() );
41
-
42
-		$data = $object->process( $invoice, $order );
43
-
44
-
45
-		$this->assertEquals( 1, count( $data ) );
46
-
47
-		$this->assertEquals( 17, count( $data[0] ) );
48
-		$this->assertEquals( 'web', $data[0][0] );
49
-		$this->assertEquals( '2008-02-15 12:34:56', $data[0][1] );
50
-		$this->assertEquals( '6', $data[0][2] );
51
-		$this->assertEquals( '', $data[0][3] );
52
-		$this->assertEquals( '4', $data[0][4] );
53
-		$this->assertEquals( '', $data[0][5] );
54
-		$this->assertGreaterThan( 0, $data[0][6] );
55
-		$this->assertEquals( 'unittest', $data[0][7] );
56
-		$this->assertEquals( 'de', $data[0][8] );
57
-		$this->assertEquals( 'EUR', $data[0][9] );
58
-		$this->assertEquals( '53.50', $data[0][10] );
59
-		$this->assertEquals( '1.50', $data[0][11] );
60
-		$this->assertEquals( '14.50', $data[0][12] );
61
-		$this->assertEquals( '0.0000', $data[0][13] );
62
-		$this->assertEquals( '1', $data[0][14] );
63
-		$this->assertEquals( '0', $data[0][15] );
64
-		$this->assertEquals( 'This is a comment if an order. It can be added by the user.', $data[0][16] );
37
+		$object = new \Aimeos\Controller\Common\Order\Export\Csv\Processor\Invoice\Standard($context, $mapping);
38
+
39
+		$invoice = $this->getInvoice($context);
40
+		$order = \Aimeos\MShop\Factory::createManager($context, 'order/base')->load($invoice->getBaseId());
41
+
42
+		$data = $object->process($invoice, $order);
43
+
44
+
45
+		$this->assertEquals(1, count($data));
46
+
47
+		$this->assertEquals(17, count($data[0]));
48
+		$this->assertEquals('web', $data[0][0]);
49
+		$this->assertEquals('2008-02-15 12:34:56', $data[0][1]);
50
+		$this->assertEquals('6', $data[0][2]);
51
+		$this->assertEquals('', $data[0][3]);
52
+		$this->assertEquals('4', $data[0][4]);
53
+		$this->assertEquals('', $data[0][5]);
54
+		$this->assertGreaterThan(0, $data[0][6]);
55
+		$this->assertEquals('unittest', $data[0][7]);
56
+		$this->assertEquals('de', $data[0][8]);
57
+		$this->assertEquals('EUR', $data[0][9]);
58
+		$this->assertEquals('53.50', $data[0][10]);
59
+		$this->assertEquals('1.50', $data[0][11]);
60
+		$this->assertEquals('14.50', $data[0][12]);
61
+		$this->assertEquals('0.0000', $data[0][13]);
62
+		$this->assertEquals('1', $data[0][14]);
63
+		$this->assertEquals('0', $data[0][15]);
64
+		$this->assertEquals('This is a comment if an order. It can be added by the user.', $data[0][16]);
65 65
 	}
66 66
 
67 67
 
68
-	protected function getInvoice( $context )
68
+	protected function getInvoice($context)
69 69
 	{
70
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'order' );
70
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'order');
71 71
 
72 72
 		$search = $manager->createSearch();
73
-		$search->setConditions( $search->compare( '==', 'order.datepayment', '2008-02-15 12:34:56' ) );
73
+		$search->setConditions($search->compare('==', 'order.datepayment', '2008-02-15 12:34:56'));
74 74
 
75
-		$items = $manager->searchItems( $search );
75
+		$items = $manager->searchItems($search);
76 76
 
77
-		if( ( $item = reset( $items ) ) !== false ) {
77
+		if (($item = reset($items)) !== false) {
78 78
 			return $item;
79 79
 		}
80 80
 
81
-		throw new \Exception( 'No order item found' );
81
+		throw new \Exception('No order item found');
82 82
 	}
83 83
 }
Please login to merge, or discard this patch.
common/src/Controller/Common/Order/Export/Csv/Processor/Coupon/Standard.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -40,17 +40,17 @@
 block discarded – undo
40 40
 	 * @param \Aimeos\MShop\Order\Item\Base\Iface $order Full order with associated items
41 41
 	 * @return array Two dimensional associative list of order data representing the lines in CSV
42 42
 	 */
43
-	public function process( \Aimeos\MShop\Order\Item\Iface $invoice, \Aimeos\MShop\Order\Item\Base\Iface $order )
43
+	public function process(\Aimeos\MShop\Order\Item\Iface $invoice, \Aimeos\MShop\Order\Item\Base\Iface $order)
44 44
 	{
45 45
 		$result = [];
46 46
 
47
-		foreach( $order->getCoupons() as $code => $products )
47
+		foreach ($order->getCoupons() as $code => $products)
48 48
 		{
49 49
 			$data = [];
50 50
 
51
-			foreach( $this->getMapping() as $pos => $key )
51
+			foreach ($this->getMapping() as $pos => $key)
52 52
 			{
53
-				if( $key === 'order.base.coupon.code' ) {
53
+				if ($key === 'order.base.coupon.code') {
54 54
 					$data[$pos] = $code;
55 55
 				} else {
56 56
 					$data[$pos] = '';
Please login to merge, or discard this patch.
controller/common/src/Controller/Common/Order/Export/Csv/Processor/Base.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
30 30
 	 * @param array $mapping Associative list of field position in CSV as key and domain item key as value
31 31
 	 */
32
-	public function __construct( \Aimeos\MShop\Context\Item\Iface $context, array $mapping )
32
+	public function __construct(\Aimeos\MShop\Context\Item\Iface $context, array $mapping)
33 33
 	{
34 34
 		$this->context = $context;
35 35
 		$this->mapping = $mapping;
Please login to merge, or discard this patch.
src/Controller/Common/Order/Export/Csv/Processor/Address/Standard.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -40,28 +40,28 @@
 block discarded – undo
40 40
 	 * @param \Aimeos\MShop\Order\Item\Base\Iface $order Full order with associated items
41 41
 	 * @return array Two dimensional associative list of order data representing the lines in CSV
42 42
 	 */
43
-	public function process( \Aimeos\MShop\Order\Item\Iface $invoice, \Aimeos\MShop\Order\Item\Base\Iface $order )
43
+	public function process(\Aimeos\MShop\Order\Item\Iface $invoice, \Aimeos\MShop\Order\Item\Base\Iface $order)
44 44
 	{
45 45
 		$result = [];
46 46
 		$addresses = $order->getAddresses();
47 47
 
48
-		krsort( $addresses );
48
+		krsort($addresses);
49 49
 
50
-		foreach( $addresses as $item )
50
+		foreach ($addresses as $item)
51 51
 		{
52 52
 			$data = [];
53 53
 			$list = $item->toArray();
54 54
 
55
-			foreach( $this->getMapping() as $pos => $key )
55
+			foreach ($this->getMapping() as $pos => $key)
56 56
 			{
57
-				if( array_key_exists( $key, $list ) ) {
57
+				if (array_key_exists($key, $list)) {
58 58
 					$data[$pos] = $list[$key];
59 59
 				} else {
60 60
 					$data[$pos] = '';
61 61
 				}
62 62
 			}
63 63
 
64
-			ksort( $data );
64
+			ksort($data);
65 65
 			$result[] = $data;
66 66
 		}
67 67
 
Please login to merge, or discard this patch.
src/Controller/Common/Order/Export/Csv/Processor/Invoice/Standard.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -40,21 +40,21 @@
 block discarded – undo
40 40
 	 * @param \Aimeos\MShop\Order\Item\Base\Iface $order Full order with associated items
41 41
 	 * @return array Two dimensional associative list of order data representing the lines in CSV
42 42
 	 */
43
-	public function process( \Aimeos\MShop\Order\Item\Iface $invoice, \Aimeos\MShop\Order\Item\Base\Iface $order )
43
+	public function process(\Aimeos\MShop\Order\Item\Iface $invoice, \Aimeos\MShop\Order\Item\Base\Iface $order)
44 44
 	{
45 45
 		$result = [];
46 46
 		$list = $invoice->toArray() + $order->toArray();
47 47
 
48
-		foreach( $this->getMapping() as $pos => $key )
48
+		foreach ($this->getMapping() as $pos => $key)
49 49
 		{
50
-			if( array_key_exists( $key, $list ) ) {
50
+			if (array_key_exists($key, $list)) {
51 51
 				$result[$pos] = $list[$key];
52 52
 			} else {
53 53
 				$result[$pos] = '';
54 54
 			}
55 55
 		}
56 56
 
57
-		ksort( $result );
57
+		ksort($result);
58 58
 
59 59
 		return [$result];
60 60
 	}
Please login to merge, or discard this patch.
common/src/Controller/Common/Order/Export/Csv/Processor/Iface.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
26 26
 	 * @param array $mapping Associative list of field position in CSV as key and domain item key as value
27 27
 	 */
28
-	public function __construct( \Aimeos\MShop\Context\Item\Iface $context, array $mapping );
28
+	public function __construct(\Aimeos\MShop\Context\Item\Iface $context, array $mapping);
29 29
 
30 30
 
31 31
 	/**
@@ -35,5 +35,5 @@  discard block
 block discarded – undo
35 35
 	 * @param \Aimeos\MShop\Order\Item\Base\Iface $order Full order with associated items
36 36
 	 * @return array Two dimensional associative list of order data representing the lines in CSV
37 37
 	 */
38
-	public function process( \Aimeos\MShop\Order\Item\Iface $invoice, \Aimeos\MShop\Order\Item\Base\Iface $order );
38
+	public function process(\Aimeos\MShop\Order\Item\Iface $invoice, \Aimeos\MShop\Order\Item\Base\Iface $order);
39 39
 }
40 40
\ No newline at end of file
Please login to merge, or discard this patch.
common/src/Controller/Common/Coupon/Import/Csv/Processor/Base.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
 	 * Initializes the object
30 30
 	 *
31 31
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
32
-	 * @param array $mapping Associative list of field position in CSV as key and domain item key as value
32
+	 * @param string[] $mapping Associative list of field position in CSV as key and domain item key as value
33 33
 	 * @param \Aimeos\Controller\Common\Coupon\Import\Csv\Processor\Iface $object Decorated processor
34 34
 	 */
35 35
 	public function __construct( \Aimeos\MShop\Context\Item\Iface $context, array $mapping,
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,8 +32,8 @@  discard block
 block discarded – undo
32 32
 	 * @param array $mapping Associative list of field position in CSV as key and domain item key as value
33 33
 	 * @param \Aimeos\Controller\Common\Coupon\Import\Csv\Processor\Iface $object Decorated processor
34 34
 	 */
35
-	public function __construct( \Aimeos\MShop\Context\Item\Iface $context, array $mapping,
36
-		\Aimeos\Controller\Common\Coupon\Import\Csv\Processor\Iface $object = null )
35
+	public function __construct(\Aimeos\MShop\Context\Item\Iface $context, array $mapping,
36
+		\Aimeos\Controller\Common\Coupon\Import\Csv\Processor\Iface $object = null)
37 37
 	{
38 38
 		$this->context = $context;
39 39
 		$this->mapping = $mapping;
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
 	 */
72 72
 	protected function getObject()
73 73
 	{
74
-		if( $this->object === null ) {
75
-			throw new \Aimeos\Controller\Jobs\Exception( 'No processor object available' );
74
+		if ($this->object === null) {
75
+			throw new \Aimeos\Controller\Jobs\Exception('No processor object available');
76 76
 		}
77 77
 
78 78
 		return $this->object;
Please login to merge, or discard this patch.
common/src/Controller/Common/Coupon/Import/Csv/Processor/Done.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -27,8 +27,8 @@  discard block
 block discarded – undo
27 27
 	 * @param array $mapping Associative list of field position in CSV as key and domain item key as value
28 28
 	 * @param \Aimeos\Controller\Common\Coupon\Import\Csv\Processor\Iface $object Decorated processor
29 29
 	 */
30
-	public function __construct( \Aimeos\MShop\Context\Item\Iface $context, array $mapping,
31
-		\Aimeos\Controller\Common\Coupon\Import\Csv\Processor\Iface $object = null )
30
+	public function __construct(\Aimeos\MShop\Context\Item\Iface $context, array $mapping,
31
+		\Aimeos\Controller\Common\Coupon\Import\Csv\Processor\Iface $object = null)
32 32
 	{
33 33
 	}
34 34
 
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	 * @param array $data List of CSV fields with position as key and data as value
41 41
 	 * @return array List of data which hasn't been imported
42 42
 	 */
43
-	public function process( \Aimeos\MShop\Coupon\Item\Code\Iface $item, array $data )
43
+	public function process(\Aimeos\MShop\Coupon\Item\Code\Iface $item, array $data)
44 44
 	{
45 45
 		return $data;
46 46
 	}
Please login to merge, or discard this patch.
common/src/Controller/Common/Coupon/Import/Csv/Processor/Iface.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
 	 * @param array $mapping Associative list of field position in CSV as key and domain item key as value
27 27
 	 * @param \Aimeos\Controller\Common\Coupon\Import\Csv\Processor\Iface $object Decorated processor
28 28
 	 */
29
-	public function __construct( \Aimeos\MShop\Context\Item\Iface $context, array $mapping,
30
-		\Aimeos\Controller\Common\Coupon\Import\Csv\Processor\Iface $object = null );
29
+	public function __construct(\Aimeos\MShop\Context\Item\Iface $context, array $mapping,
30
+		\Aimeos\Controller\Common\Coupon\Import\Csv\Processor\Iface $object = null);
31 31
 
32 32
 
33 33
 	/**
@@ -37,5 +37,5 @@  discard block
 block discarded – undo
37 37
 	 * @param array $data List of CSV fields with position as key and data as value
38 38
 	 * @return array List of data which hasn't been imported
39 39
 	 */
40
-	public function process( \Aimeos\MShop\Coupon\Item\Code\Iface $item, array $data );
40
+	public function process(\Aimeos\MShop\Coupon\Item\Code\Iface $item, array $data);
41 41
 }
42 42
\ No newline at end of file
Please login to merge, or discard this patch.