Completed
Push — master ( a47bac...cdddba )
by Aimeos
01:49
created
controller/frontend/tests/Controller/Frontend/Attribute/FactoryTest.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -15,31 +15,31 @@
 block discarded – undo
15 15
 	{
16 16
 		$target = '\\Aimeos\\Controller\\Frontend\\Attribute\\Iface';
17 17
 
18
-		$controller = \Aimeos\Controller\Frontend\Attribute\Factory::createController( \TestHelperFrontend::getContext() );
19
-		$this->assertInstanceOf( $target, $controller );
18
+		$controller = \Aimeos\Controller\Frontend\Attribute\Factory::createController(\TestHelperFrontend::getContext());
19
+		$this->assertInstanceOf($target, $controller);
20 20
 
21
-		$controller = \Aimeos\Controller\Frontend\Attribute\Factory::createController( \TestHelperFrontend::getContext(), 'Standard' );
22
-		$this->assertInstanceOf( $target, $controller );
21
+		$controller = \Aimeos\Controller\Frontend\Attribute\Factory::createController(\TestHelperFrontend::getContext(), 'Standard');
22
+		$this->assertInstanceOf($target, $controller);
23 23
 	}
24 24
 
25 25
 
26 26
 	public function testCreateControllerInvalidImplementation()
27 27
 	{
28
-		$this->setExpectedException( '\\Aimeos\\MW\\Common\\Exception' );
29
-		\Aimeos\Controller\Frontend\Attribute\Factory::createController( \TestHelperFrontend::getContext(), 'Invalid' );
28
+		$this->setExpectedException('\\Aimeos\\MW\\Common\\Exception');
29
+		\Aimeos\Controller\Frontend\Attribute\Factory::createController(\TestHelperFrontend::getContext(), 'Invalid');
30 30
 	}
31 31
 
32 32
 
33 33
 	public function testCreateControllerInvalidName()
34 34
 	{
35
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' );
36
-		\Aimeos\Controller\Frontend\Attribute\Factory::createController( \TestHelperFrontend::getContext(), '%^' );
35
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception');
36
+		\Aimeos\Controller\Frontend\Attribute\Factory::createController(\TestHelperFrontend::getContext(), '%^');
37 37
 	}
38 38
 
39 39
 
40 40
 	public function testCreateControllerNotExisting()
41 41
 	{
42
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' );
43
-		\Aimeos\Controller\Frontend\Attribute\Factory::createController( \TestHelperFrontend::getContext(), 'notexist' );
42
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception');
43
+		\Aimeos\Controller\Frontend\Attribute\Factory::createController(\TestHelperFrontend::getContext(), 'notexist');
44 44
 	}
45 45
 }
Please login to merge, or discard this patch.
controller/frontend/tests/Controller/Frontend/Basket/FactoryTest.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -14,31 +14,31 @@
 block discarded – undo
14 14
 	{
15 15
 		$target = '\\Aimeos\\Controller\\Frontend\\Basket\\Iface';
16 16
 
17
-		$controller = \Aimeos\Controller\Frontend\Basket\Factory::createController( \TestHelperFrontend::getContext() );
18
-		$this->assertInstanceOf( $target, $controller );
17
+		$controller = \Aimeos\Controller\Frontend\Basket\Factory::createController(\TestHelperFrontend::getContext());
18
+		$this->assertInstanceOf($target, $controller);
19 19
 
20
-		$controller = \Aimeos\Controller\Frontend\Basket\Factory::createController( \TestHelperFrontend::getContext(), 'Standard' );
21
-		$this->assertInstanceOf( $target, $controller );
20
+		$controller = \Aimeos\Controller\Frontend\Basket\Factory::createController(\TestHelperFrontend::getContext(), 'Standard');
21
+		$this->assertInstanceOf($target, $controller);
22 22
 	}
23 23
 
24 24
 
25 25
 	public function testCreateControllerInvalidImplementation()
26 26
 	{
27
-		$this->setExpectedException( '\\Aimeos\\MW\\Common\\Exception' );
28
-		\Aimeos\Controller\Frontend\Basket\Factory::createController( \TestHelperFrontend::getContext(), 'Invalid' );
27
+		$this->setExpectedException('\\Aimeos\\MW\\Common\\Exception');
28
+		\Aimeos\Controller\Frontend\Basket\Factory::createController(\TestHelperFrontend::getContext(), 'Invalid');
29 29
 	}
30 30
 
31 31
 
32 32
 	public function testCreateControllerInvalidName()
33 33
 	{
34
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' );
35
-		\Aimeos\Controller\Frontend\Basket\Factory::createController( \TestHelperFrontend::getContext(), '%^' );
34
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception');
35
+		\Aimeos\Controller\Frontend\Basket\Factory::createController(\TestHelperFrontend::getContext(), '%^');
36 36
 	}
37 37
 
38 38
 
39 39
 	public function testCreateControllerNotExisting()
40 40
 	{
41
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' );
42
-		\Aimeos\Controller\Frontend\Basket\Factory::createController( \TestHelperFrontend::getContext(), 'notexist' );
41
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception');
42
+		\Aimeos\Controller\Frontend\Basket\Factory::createController(\TestHelperFrontend::getContext(), 'notexist');
43 43
 	}
44 44
 }
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Subscription/Standard.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -27,13 +27,13 @@  discard block
 block discarded – undo
27 27
 	 * @param string $id Unique subscription ID
28 28
 	 * @return \Aimeos\MShop\Subscription\Item\Iface Canceled subscription item
29 29
 	 */
30
-	public function cancel( $id )
30
+	public function cancel($id)
31 31
 	{
32
-		$item = $this->getItem( $id );
33
-		$item->setDateEnd( $item->getDateNext() );
34
-		$item->setReason( \Aimeos\MShop\Subscription\Item\Iface::REASON_CANCEL );
32
+		$item = $this->getItem($id);
33
+		$item->setDateEnd($item->getDateNext());
34
+		$item->setReason(\Aimeos\MShop\Subscription\Item\Iface::REASON_CANCEL);
35 35
 
36
-		return $this->saveItem( $item );
36
+		return $this->saveItem($item);
37 37
 	}
38 38
 
39 39
 
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	 */
45 45
 	public function createFilter()
46 46
 	{
47
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'subscription' )->createSearch();
47
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), 'subscription')->createSearch();
48 48
 	}
49 49
 
50 50
 
@@ -54,25 +54,25 @@  discard block
 block discarded – undo
54 54
 	 * @param string $id Unique subscription ID
55 55
 	 * @return \Aimeos\MShop\Subscription\Item\Iface Subscription object
56 56
 	 */
57
-	public function getItem( $id )
57
+	public function getItem($id)
58 58
 	{
59 59
 		$context = $this->getContext();
60
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'subscription' );
60
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'subscription');
61 61
 
62 62
 		$filter = $manager->createSearch();
63 63
 		$expr = [
64
-			$filter->compare( '==', 'subscription.id', $id ),
65
-			$filter->compare( '==', 'order.base.customerid', $context->getUserId() ),
64
+			$filter->compare('==', 'subscription.id', $id),
65
+			$filter->compare('==', 'order.base.customerid', $context->getUserId()),
66 66
 			$filter->getConditions(),
67 67
 		];
68
-		$filter->setConditions( $filter->combine( '&&', $expr ) );
68
+		$filter->setConditions($filter->combine('&&', $expr));
69 69
 
70
-		$items = $this->searchItems( $filter );
70
+		$items = $this->searchItems($filter);
71 71
 
72
-		if( ( $item = reset( $items ) ) === false )
72
+		if (($item = reset($items)) === false)
73 73
 		{
74 74
 			$msg = 'Invalid subscription ID "%1$s" for customer ID "%2$s"';
75
-			throw new \Aimeos\Controller\Frontend\Subscription\Exception( sprintf( $msg, $id, $context->getUserId() ) );
75
+			throw new \Aimeos\Controller\Frontend\Subscription\Exception(sprintf($msg, $id, $context->getUserId()));
76 76
 		}
77 77
 
78 78
 		return $item;
@@ -87,18 +87,18 @@  discard block
 block discarded – undo
87 87
 	public function getIntervals()
88 88
 	{
89 89
 		$intervals = [];
90
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'attribute' );
90
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'attribute');
91 91
 
92
-		$search = $manager->createSearch( true );
92
+		$search = $manager->createSearch(true);
93 93
 		$expr = array(
94 94
 			$search->getConditions(),
95
-			$search->compare( '==', 'attribute.domain', 'product' ),
96
-			$search->compare( '==', 'attribute.type.code', 'interval' ),
95
+			$search->compare('==', 'attribute.domain', 'product'),
96
+			$search->compare('==', 'attribute.type.code', 'interval'),
97 97
 		);
98
-		$search->setConditions( $search->combine( '&&', $expr ) );
99
-		$search->setSlice( 0, 0x7fffffff );
98
+		$search->setConditions($search->combine('&&', $expr));
99
+		$search->setSlice(0, 0x7fffffff);
100 100
 
101
-		foreach( $manager->searchItems( $search, ['text'] ) as $attrItem ) {
101
+		foreach ($manager->searchItems($search, ['text']) as $attrItem) {
102 102
 			$intervals[$attrItem->getCode()] = $attrItem;
103 103
 		}
104 104
 
@@ -111,9 +111,9 @@  discard block
 block discarded – undo
111 111
 	 * @param \Aimeos\MShop\Subscription\Item\Iface $item Subscription object
112 112
 	 * @return \Aimeos\MShop\Subscription\Item\Iface Saved subscription item
113 113
 	 */
114
-	public function saveItem( \Aimeos\MShop\Subscription\Item\Iface $item )
114
+	public function saveItem(\Aimeos\MShop\Subscription\Item\Iface $item)
115 115
 	{
116
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'subscription' )->saveItem( $item );
116
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), 'subscription')->saveItem($item);
117 117
 	}
118 118
 
119 119
 
@@ -124,17 +124,17 @@  discard block
 block discarded – undo
124 124
 	 * @param integer &$total|null Variable that will contain the total number of available items
125 125
 	 * @return \Aimeos\MShop\Subscription\Item\Iface[] Associative list of IDs as keys and subscription objects as values
126 126
 	 */
127
-	public function searchItems( \Aimeos\MW\Criteria\Iface $filter, &$total = null )
127
+	public function searchItems(\Aimeos\MW\Criteria\Iface $filter, &$total = null)
128 128
 	{
129 129
 		$context = $this->getContext();
130
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'subscription' );
130
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'subscription');
131 131
 
132 132
 		$expr = [
133
-			$filter->compare( '==', 'order.base.customerid', $context->getUserId() ),
133
+			$filter->compare('==', 'order.base.customerid', $context->getUserId()),
134 134
 			$filter->getConditions(),
135 135
 		];
136
-		$filter->setConditions( $filter->combine( '&&', $expr ) );
136
+		$filter->setConditions($filter->combine('&&', $expr));
137 137
 
138
-		return $manager->searchItems( $filter, [], $total );
138
+		return $manager->searchItems($filter, [], $total);
139 139
 	}
140 140
 }
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Basket/Decorator/Bundle.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -36,13 +36,13 @@  discard block
 block discarded – undo
36 36
 	 * @param string $stocktype Unique code of the stock type to deliver the products from
37 37
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception If the product isn't available
38 38
 	 */
39
-	public function addProduct( $prodid, $quantity = 1, $stocktype = 'default', array $variantAttributeIds = [],
40
-		array $configAttributeIds = [], array $hiddenAttributeIds = [], array $customAttributeValues = [] )
39
+	public function addProduct($prodid, $quantity = 1, $stocktype = 'default', array $variantAttributeIds = [],
40
+		array $configAttributeIds = [], array $hiddenAttributeIds = [], array $customAttributeValues = [])
41 41
 	{
42 42
 		$context = $this->getContext();
43
-		$productManager = \Aimeos\MShop\Factory::createManager( $context, 'product' );
43
+		$productManager = \Aimeos\MShop\Factory::createManager($context, 'product');
44 44
 
45
-		if( $productManager->getItem( $prodid, [], true )->getType() !== 'bundle' )
45
+		if ($productManager->getItem($prodid, [], true)->getType() !== 'bundle')
46 46
 		{
47 47
 			return $this->getController()->addProduct(
48 48
 				$prodid, $quantity, $stocktype, $variantAttributeIds,
@@ -51,29 +51,29 @@  discard block
 block discarded – undo
51 51
 		}
52 52
 
53 53
 		$attributeMap = [
54
-			'custom' => array_keys( $customAttributeValues ),
55
-			'config' => array_keys( $configAttributeIds ),
54
+			'custom' => array_keys($customAttributeValues),
55
+			'config' => array_keys($configAttributeIds),
56 56
 		];
57
-		$this->checkListRef( $prodid, 'attribute', $attributeMap );
57
+		$this->checkListRef($prodid, 'attribute', $attributeMap);
58 58
 
59 59
 
60
-		$productItem = $productManager->getItem( $prodid, ['attribute', 'media', 'supplier', 'price', 'product', 'text'], true );
61
-		$prices = $productItem->getRefItems( 'price', 'default', 'default' );
62
-		$hidden = $productItem->getRefItems( 'attribute', null, 'hidden' );
60
+		$productItem = $productManager->getItem($prodid, ['attribute', 'media', 'supplier', 'price', 'product', 'text'], true);
61
+		$prices = $productItem->getRefItems('price', 'default', 'default');
62
+		$hidden = $productItem->getRefItems('attribute', null, 'hidden');
63 63
 
64
-		$orderBaseProductItem = \Aimeos\MShop\Factory::createManager( $context, 'order/base/product' )->createItem();
65
-		$orderBaseProductItem->copyFrom( $productItem )->setQuantity( $quantity )->setStockType( $stocktype );
64
+		$orderBaseProductItem = \Aimeos\MShop\Factory::createManager($context, 'order/base/product')->createItem();
65
+		$orderBaseProductItem->copyFrom($productItem)->setQuantity($quantity)->setStockType($stocktype);
66 66
 
67
-		$this->addBundleProducts( $orderBaseProductItem, $productItem, $variantAttributeIds, $stocktype );
67
+		$this->addBundleProducts($orderBaseProductItem, $productItem, $variantAttributeIds, $stocktype);
68 68
 
69
-		$custAttr = $this->getOrderProductAttributes( 'custom', array_keys( $customAttributeValues ), $customAttributeValues );
70
-		$confAttr = $this->getOrderProductAttributes( 'config', array_keys( $configAttributeIds ), [], $configAttributeIds );
71
-		$attr = array_merge( $custAttr, $confAttr, $this->getOrderProductAttributes( 'hidden', array_keys( $hidden ) ) );
69
+		$custAttr = $this->getOrderProductAttributes('custom', array_keys($customAttributeValues), $customAttributeValues);
70
+		$confAttr = $this->getOrderProductAttributes('config', array_keys($configAttributeIds), [], $configAttributeIds);
71
+		$attr = array_merge($custAttr, $confAttr, $this->getOrderProductAttributes('hidden', array_keys($hidden)));
72 72
 
73
-		$orderBaseProductItem->setAttributeItems( $attr );
74
-		$orderBaseProductItem->setPrice( $this->calcPrice( $orderBaseProductItem, $prices, $quantity ) );
73
+		$orderBaseProductItem->setAttributeItems($attr);
74
+		$orderBaseProductItem->setPrice($this->calcPrice($orderBaseProductItem, $prices, $quantity));
75 75
 
76
-		$this->getController()->get()->addProduct( $orderBaseProductItem );
76
+		$this->getController()->get()->addProduct($orderBaseProductItem);
77 77
 		$this->getController()->save();
78 78
 	}
79 79
 
@@ -86,43 +86,43 @@  discard block
 block discarded – undo
86 86
 	 * @param array $variantAttributeIds List of product variant attribute IDs
87 87
 	 * @param string $stocktype
88 88
 	 */
89
-	protected function addBundleProducts( \Aimeos\MShop\Order\Item\Base\Product\Iface $orderBaseProductItem,
90
-		\Aimeos\MShop\Product\Item\Iface $productItem, array $variantAttributeIds, $stocktype )
89
+	protected function addBundleProducts(\Aimeos\MShop\Order\Item\Base\Product\Iface $orderBaseProductItem,
90
+		\Aimeos\MShop\Product\Item\Iface $productItem, array $variantAttributeIds, $stocktype)
91 91
 	{
92 92
 		$quantity = $orderBaseProductItem->getQuantity();
93 93
 		$products = $subProductIds = $orderProducts = [];
94
-		$orderProductManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order/base/product' );
94
+		$orderProductManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'order/base/product');
95 95
 
96
-		foreach( $productItem->getRefItems( 'product', null, 'default' ) as $item ) {
96
+		foreach ($productItem->getRefItems('product', null, 'default') as $item) {
97 97
 			$subProductIds[] = $item->getId();
98 98
 		}
99 99
 
100
-		if( count( $subProductIds ) > 0 )
100
+		if (count($subProductIds) > 0)
101 101
 		{
102
-			$productManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product' );
102
+			$productManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product');
103 103
 
104
-			$search = $productManager->createSearch( true );
104
+			$search = $productManager->createSearch(true);
105 105
 			$expr = array(
106
-				$search->compare( '==', 'product.id', $subProductIds ),
106
+				$search->compare('==', 'product.id', $subProductIds),
107 107
 				$search->getConditions(),
108 108
 			);
109
-			$search->setConditions( $search->combine( '&&', $expr ) );
109
+			$search->setConditions($search->combine('&&', $expr));
110 110
 
111
-			$products = $productManager->searchItems( $search, array( 'attribute', 'media', 'price', 'text' ) );
111
+			$products = $productManager->searchItems($search, array('attribute', 'media', 'price', 'text'));
112 112
 		}
113 113
 
114
-		foreach( $products as $product )
114
+		foreach ($products as $product)
115 115
 		{
116
-			$prices = $product->getRefItems( 'price', 'default', 'default' );
116
+			$prices = $product->getRefItems('price', 'default', 'default');
117 117
 
118 118
 			$orderProduct = $orderProductManager->createItem();
119
-			$orderProduct->copyFrom( $product );
120
-			$orderProduct->setStockType( $stocktype );
121
-			$orderProduct->setPrice( $this->calcPrice( $orderProduct, $prices, $quantity ) );
119
+			$orderProduct->copyFrom($product);
120
+			$orderProduct->setStockType($stocktype);
121
+			$orderProduct->setPrice($this->calcPrice($orderProduct, $prices, $quantity));
122 122
 
123 123
 			$orderProducts[] = $orderProduct;
124 124
 		}
125 125
 
126
-		$orderBaseProductItem->setProducts( $orderProducts );
126
+		$orderBaseProductItem->setProducts($orderProducts);
127 127
 	}
128 128
 }
Please login to merge, or discard this patch.
frontend/tests/Controller/Frontend/Basket/Decorator/SelectTest.php 1 patch
Spacing   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -19,219 +19,219 @@
 block discarded – undo
19 19
 	protected function setUp()
20 20
 	{
21 21
 		$this->context = \TestHelperFrontend::getContext();
22
-		$this->testItem = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'U:TESTP' );
22
+		$this->testItem = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('U:TESTP');
23 23
 
24
-		$object = new \Aimeos\Controller\Frontend\Basket\Standard( $this->context );
25
-		$this->object = new \Aimeos\Controller\Frontend\Basket\Decorator\Select( $object, $this->context );
24
+		$object = new \Aimeos\Controller\Frontend\Basket\Standard($this->context);
25
+		$this->object = new \Aimeos\Controller\Frontend\Basket\Decorator\Select($object, $this->context);
26 26
 	}
27 27
 
28 28
 
29 29
 	protected function tearDown()
30 30
 	{
31 31
 		$this->object->clear();
32
-		$this->context->getSession()->set( 'aimeos', [] );
32
+		$this->context->getSession()->set('aimeos', []);
33 33
 
34
-		unset( $this->object );
34
+		unset($this->object);
35 35
 	}
36 36
 
37 37
 
38 38
 	public function testAddDeleteProduct()
39 39
 	{
40 40
 		$basket = $this->object->get();
41
-		$this->object->addProduct( $this->testItem->getId(), 2 );
41
+		$this->object->addProduct($this->testItem->getId(), 2);
42 42
 
43
-		$this->assertEquals( 1, count( $basket->getProducts() ) );
44
-		$this->assertEquals( 2, $basket->getProduct( 0 )->getQuantity() );
45
-		$this->assertEquals( 'U:TESTPSUB01', $basket->getProduct( 0 )->getProductCode() );
43
+		$this->assertEquals(1, count($basket->getProducts()));
44
+		$this->assertEquals(2, $basket->getProduct(0)->getQuantity());
45
+		$this->assertEquals('U:TESTPSUB01', $basket->getProduct(0)->getProductCode());
46 46
 	}
47 47
 
48 48
 
49 49
 	public function testAddProductNoSelection()
50 50
 	{
51
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'CNC' );
51
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('CNC');
52 52
 
53
-		$this->object->addProduct( $item->getId(), 1 );
53
+		$this->object->addProduct($item->getId(), 1);
54 54
 
55
-		$this->assertEquals( 1, count( $this->object->get()->getProducts() ) );
56
-		$this->assertEquals( 'CNC', $this->object->get()->getProduct( 0 )->getProductCode() );
57
-		$this->assertEquals( 0, count( $this->object->get()->getProduct( 0 )->getProducts() ) );
55
+		$this->assertEquals(1, count($this->object->get()->getProducts()));
56
+		$this->assertEquals('CNC', $this->object->get()->getProduct(0)->getProductCode());
57
+		$this->assertEquals(0, count($this->object->get()->getProduct(0)->getProducts()));
58 58
 	}
59 59
 
60 60
 
61 61
 	public function testAddProductVariant()
62 62
 	{
63
-		$attributeManager = \Aimeos\MShop\Attribute\Manager\Factory::createManager( \TestHelperFrontend::getContext() );
63
+		$attributeManager = \Aimeos\MShop\Attribute\Manager\Factory::createManager(\TestHelperFrontend::getContext());
64 64
 
65 65
 		$search = $attributeManager->createSearch();
66
-		$search->setConditions( $search->compare( '==', 'attribute.code', array( 'xs', 'white' ) ) );
66
+		$search->setConditions($search->compare('==', 'attribute.code', array('xs', 'white')));
67 67
 
68
-		$attributes = $attributeManager->searchItems( $search );
68
+		$attributes = $attributeManager->searchItems($search);
69 69
 
70
-		if( count( $attributes ) === 0 ) {
71
-			throw new \RuntimeException( 'Attributes not found' );
70
+		if (count($attributes) === 0) {
71
+			throw new \RuntimeException('Attributes not found');
72 72
 		}
73 73
 
74 74
 
75
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'CNC' );
75
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('CNC');
76 76
 
77
-		$this->object->addProduct( $item->getId(), 1, 'default', array_keys( $attributes ), [], [], [] );
77
+		$this->object->addProduct($item->getId(), 1, 'default', array_keys($attributes), [], [], []);
78 78
 
79
-		$this->assertEquals( 1, count( $this->object->get()->getProducts() ) );
80
-		$this->assertEquals( 'CNC', $this->object->get()->getProduct( 0 )->getProductCode() );
79
+		$this->assertEquals(1, count($this->object->get()->getProducts()));
80
+		$this->assertEquals('CNC', $this->object->get()->getProduct(0)->getProductCode());
81 81
 	}
82 82
 
83 83
 
84 84
 	public function testAddProductVariantIncomplete()
85 85
 	{
86
-		$attributeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' );
86
+		$attributeManager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute');
87 87
 
88 88
 		$search = $attributeManager->createSearch();
89 89
 		$expr = array(
90
-			$search->compare( '==', 'attribute.domain', 'product' ),
91
-			$search->compare( '==', 'attribute.code', '30' ),
92
-			$search->compare( '==', 'attribute.type.code', 'length' ),
90
+			$search->compare('==', 'attribute.domain', 'product'),
91
+			$search->compare('==', 'attribute.code', '30'),
92
+			$search->compare('==', 'attribute.type.code', 'length'),
93 93
 		);
94
-		$search->setConditions( $search->combine( '&&', $expr ) );
94
+		$search->setConditions($search->combine('&&', $expr));
95 95
 
96
-		$attributes = $attributeManager->searchItems( $search );
96
+		$attributes = $attributeManager->searchItems($search);
97 97
 
98
-		if( count( $attributes ) === 0 ) {
99
-			throw new \RuntimeException( 'Attributes not found' );
98
+		if (count($attributes) === 0) {
99
+			throw new \RuntimeException('Attributes not found');
100 100
 		}
101 101
 
102 102
 
103
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'U:TEST' );
103
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('U:TEST');
104 104
 
105
-		$this->object->addProduct( $item->getId(), 1, 'default', array_keys( $attributes ) );
105
+		$this->object->addProduct($item->getId(), 1, 'default', array_keys($attributes));
106 106
 
107
-		$this->assertEquals( 1, count( $this->object->get()->getProducts() ) );
108
-		$this->assertEquals( 'U:TESTSUB02', $this->object->get()->getProduct( 0 )->getProductCode() );
109
-		$this->assertEquals( 2, count( $this->object->get()->getProduct( 0 )->getAttributeItems() ) );
107
+		$this->assertEquals(1, count($this->object->get()->getProducts()));
108
+		$this->assertEquals('U:TESTSUB02', $this->object->get()->getProduct(0)->getProductCode());
109
+		$this->assertEquals(2, count($this->object->get()->getProduct(0)->getAttributeItems()));
110 110
 	}
111 111
 
112 112
 
113 113
 	public function testAddProductVariantNonUnique()
114 114
 	{
115
-		$attributeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' );
115
+		$attributeManager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute');
116 116
 
117 117
 		$search = $attributeManager->createSearch();
118 118
 		$expr = array(
119
-			$search->compare( '==', 'attribute.domain', 'product' ),
120
-			$search->compare( '==', 'attribute.code', '30' ),
121
-			$search->compare( '==', 'attribute.type.code', 'width' ),
119
+			$search->compare('==', 'attribute.domain', 'product'),
120
+			$search->compare('==', 'attribute.code', '30'),
121
+			$search->compare('==', 'attribute.type.code', 'width'),
122 122
 		);
123
-		$search->setConditions( $search->combine( '&&', $expr ) );
123
+		$search->setConditions($search->combine('&&', $expr));
124 124
 
125
-		$attributes = $attributeManager->searchItems( $search );
125
+		$attributes = $attributeManager->searchItems($search);
126 126
 
127
-		if( count( $attributes ) === 0 ) {
128
-			throw new \RuntimeException( 'Attributes not found' );
127
+		if (count($attributes) === 0) {
128
+			throw new \RuntimeException('Attributes not found');
129 129
 		}
130 130
 
131 131
 
132
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'U:TEST' );
132
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('U:TEST');
133 133
 
134
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
135
-		$this->object->addProduct( $item->getId(), 1, 'default', array_keys( $attributes ) );
134
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
135
+		$this->object->addProduct($item->getId(), 1, 'default', array_keys($attributes));
136 136
 	}
137 137
 
138 138
 
139 139
 	public function testAddProductVariantNotRequired()
140 140
 	{
141
-		$this->context->getConfig()->set( 'controller/frontend/basket/require-variant', false );
141
+		$this->context->getConfig()->set('controller/frontend/basket/require-variant', false);
142 142
 
143
-		$attributeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' );
143
+		$attributeManager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute');
144 144
 
145 145
 		$search = $attributeManager->createSearch();
146
-		$search->setConditions( $search->compare( '==', 'attribute.code', 'xs' ) );
146
+		$search->setConditions($search->compare('==', 'attribute.code', 'xs'));
147 147
 
148
-		$attributes = $attributeManager->searchItems( $search );
148
+		$attributes = $attributeManager->searchItems($search);
149 149
 
150
-		if( count( $attributes ) === 0 ) {
151
-			throw new \RuntimeException( 'Attribute not found' );
150
+		if (count($attributes) === 0) {
151
+			throw new \RuntimeException('Attribute not found');
152 152
 		}
153 153
 
154
-		$options = array( 'variant' => false );
154
+		$options = array('variant' => false);
155 155
 
156
-		$this->object->addProduct( $this->testItem->getId(), 1, 'default', array_keys( $attributes ) );
156
+		$this->object->addProduct($this->testItem->getId(), 1, 'default', array_keys($attributes));
157 157
 
158
-		$this->assertEquals( 1, count( $this->object->get()->getProducts() ) );
159
-		$this->assertEquals( 'U:TESTP', $this->object->get()->getProduct( 0 )->getProductCode() );
158
+		$this->assertEquals(1, count($this->object->get()->getProducts()));
159
+		$this->assertEquals('U:TESTP', $this->object->get()->getProduct(0)->getProductCode());
160 160
 	}
161 161
 
162 162
 
163 163
 	public function testAddProductEmptySelectionException()
164 164
 	{
165
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'U:noSel' );
165
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('U:noSel');
166 166
 
167
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
168
-		$this->object->addProduct( $item->getId(), 1 );
167
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
168
+		$this->object->addProduct($item->getId(), 1);
169 169
 	}
170 170
 
171 171
 
172 172
 	public function testAddProductSelectionWithPricelessItem()
173 173
 	{
174
-		$this->object->addProduct( $this->testItem->getId(), 1 );
174
+		$this->object->addProduct($this->testItem->getId(), 1);
175 175
 
176
-		$this->assertEquals( 'U:TESTPSUB01', $this->object->get()->getProduct( 0 )->getProductCode() );
176
+		$this->assertEquals('U:TESTPSUB01', $this->object->get()->getProduct(0)->getProductCode());
177 177
 	}
178 178
 
179 179
 
180 180
 	public function testAddProductConfigAttribute()
181 181
 	{
182
-		$attributeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' );
182
+		$attributeManager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute');
183 183
 
184 184
 		$search = $attributeManager->createSearch();
185
-		$search->setConditions( $search->compare( '==', 'attribute.code', 'xs' ) );
185
+		$search->setConditions($search->compare('==', 'attribute.code', 'xs'));
186 186
 
187
-		$attributes = $attributeManager->searchItems( $search );
187
+		$attributes = $attributeManager->searchItems($search);
188 188
 
189
-		if( ( $attribute = reset( $attributes ) ) === false ) {
190
-			throw new \RuntimeException( 'Attribute not found' );
189
+		if (($attribute = reset($attributes)) === false) {
190
+			throw new \RuntimeException('Attribute not found');
191 191
 		}
192 192
 
193
-		$this->object->addProduct( $this->testItem->getId(), 1, 'default', [], [$attribute->getId() => 1] );
193
+		$this->object->addProduct($this->testItem->getId(), 1, 'default', [], [$attribute->getId() => 1]);
194 194
 		$basket = $this->object->get();
195 195
 
196
-		$this->assertEquals( 1, count( $basket->getProducts() ) );
197
-		$this->assertEquals( 'U:TESTPSUB01', $basket->getProduct( 0 )->getProductCode() );
198
-		$this->assertEquals( 'xs', $basket->getProduct( 0 )->getAttribute( 'size', 'config' ) );
196
+		$this->assertEquals(1, count($basket->getProducts()));
197
+		$this->assertEquals('U:TESTPSUB01', $basket->getProduct(0)->getProductCode());
198
+		$this->assertEquals('xs', $basket->getProduct(0)->getAttribute('size', 'config'));
199 199
 	}
200 200
 
201 201
 
202 202
 	public function testAddProductHiddenAttribute()
203 203
 	{
204
-		$attributeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' );
204
+		$attributeManager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute');
205 205
 
206 206
 		$search = $attributeManager->createSearch();
207 207
 		$expr = array(
208
-			$search->compare( '==', 'attribute.code', '29' ),
209
-			$search->compare( '==', 'attribute.type.code', 'width' ),
208
+			$search->compare('==', 'attribute.code', '29'),
209
+			$search->compare('==', 'attribute.type.code', 'width'),
210 210
 		);
211
-		$search->setConditions( $search->combine( '&&', $expr ) );
211
+		$search->setConditions($search->combine('&&', $expr));
212 212
 
213
-		$attributes = $attributeManager->searchItems( $search );
213
+		$attributes = $attributeManager->searchItems($search);
214 214
 
215
-		if( empty( $attributes ) ) {
216
-			throw new \RuntimeException( 'Attribute not found' );
215
+		if (empty($attributes)) {
216
+			throw new \RuntimeException('Attribute not found');
217 217
 		}
218 218
 
219
-		$this->object->addProduct( $this->testItem->getId(), 1, 'default', [], [], array_keys( $attributes ) );
219
+		$this->object->addProduct($this->testItem->getId(), 1, 'default', [], [], array_keys($attributes));
220 220
 
221 221
 		$basket = $this->object->get();
222
-		$this->assertEquals( 1, count( $basket->getProducts() ) );
222
+		$this->assertEquals(1, count($basket->getProducts()));
223 223
 
224
-		$product = $basket->getProduct( 0 );
225
-		$this->assertEquals( 'U:TESTPSUB01', $product->getProductCode() );
224
+		$product = $basket->getProduct(0);
225
+		$this->assertEquals('U:TESTPSUB01', $product->getProductCode());
226 226
 
227 227
 		$attributes = $product->getAttributeItems();
228
-		$this->assertEquals( 1, count( $attributes ) );
228
+		$this->assertEquals(1, count($attributes));
229 229
 
230
-		if( ( $attribute = reset( $attributes ) ) === false ) {
231
-			throw new \RuntimeException( 'No attribute' );
230
+		if (($attribute = reset($attributes)) === false) {
231
+			throw new \RuntimeException('No attribute');
232 232
 		}
233 233
 
234
-		$this->assertEquals( 'hidden', $attribute->getType() );
235
-		$this->assertEquals( '29', $product->getAttribute( 'width', 'hidden' ) );
234
+		$this->assertEquals('hidden', $attribute->getType());
235
+		$this->assertEquals('29', $product->getAttribute('width', 'hidden'));
236 236
 	}
237 237
 }
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Product/Iface.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	 * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching
31 31
 	 * @since 2017.03
32 32
 	 */
33
-	public function addFilterAttribute( \Aimeos\MW\Criteria\Iface $filter, array $attrIds, array $optIds, array $oneIds );
33
+	public function addFilterAttribute(\Aimeos\MW\Criteria\Iface $filter, array $attrIds, array $optIds, array $oneIds);
34 34
 
35 35
 
36 36
 	/**
@@ -43,8 +43,8 @@  discard block
 block discarded – undo
43 43
 	 * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching
44 44
 	 * @since 2017.03
45 45
 	 */
46
-	public function addFilterCategory( \Aimeos\MW\Criteria\Iface $filter, $catId,
47
-		$level = \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE, $listtype = 'default' );
46
+	public function addFilterCategory(\Aimeos\MW\Criteria\Iface $filter, $catId,
47
+		$level = \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE, $listtype = 'default');
48 48
 
49 49
 
50 50
 	/**
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	 * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching
56 56
 	 * @since 2018.07
57 57
 	 */
58
-	public function addFilterSupplier( \Aimeos\MW\Criteria\Iface $filter, array $supIds );
58
+	public function addFilterSupplier(\Aimeos\MW\Criteria\Iface $filter, array $supIds);
59 59
 
60 60
 
61 61
 	/**
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 	 * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching
67 67
 	 * @since 2017.03
68 68
 	 */
69
-	public function addFilterText( \Aimeos\MW\Criteria\Iface $filter, $input );
69
+	public function addFilterText(\Aimeos\MW\Criteria\Iface $filter, $input);
70 70
 
71 71
 
72 72
 	/**
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	 * @return array Associative list of key values as key and the product count for this key as value
78 78
 	 * @since 2017.03
79 79
 	 */
80
-	public function aggregate( \Aimeos\MW\Criteria\Iface $filter, $key );
80
+	public function aggregate(\Aimeos\MW\Criteria\Iface $filter, $key);
81 81
 
82 82
 
83 83
 	/**
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	 * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching
91 91
 	 * @since 2017.03
92 92
 	 */
93
-	public function createFilter( $sort = null, $direction = '+', $start = 0, $size = 100 );
93
+	public function createFilter($sort = null, $direction = '+', $start = 0, $size = 100);
94 94
 
95 95
 
96 96
 	/**
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	 * @return \Aimeos\MShop\Product\Item\Iface Product item including the referenced domains items
102 102
 	 * @since 2017.03
103 103
 	 */
104
-	public function getItem( $productId, array $domains = array( 'attribute', 'media', 'price', 'product', 'product/property', 'text' ) );
104
+	public function getItem($productId, array $domains = array('attribute', 'media', 'price', 'product', 'product/property', 'text'));
105 105
 
106 106
 
107 107
 	/**
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 	 * @return \Aimeos\MShop\Product\Item\Iface[] Associative list of product IDs as keys and product items as values
113 113
 	 * @since 2017.03
114 114
 	 */
115
-	public function getItems( array $productIds, array $domains = array( 'media', 'price', 'text' ) );
115
+	public function getItems(array $productIds, array $domains = array('media', 'price', 'text'));
116 116
 
117 117
 
118 118
 	/**
@@ -124,5 +124,5 @@  discard block
 block discarded – undo
124 124
 	 * @return array Ordered list of product items implementing \Aimeos\MShop\Product\Item\Iface
125 125
 	 * @since 2017.03
126 126
 	 */
127
-	public function searchItems( \Aimeos\MW\Criteria\Iface $filter, array $domains = array( 'media', 'price', 'text' ), &$total = null );
127
+	public function searchItems(\Aimeos\MW\Criteria\Iface $filter, array $domains = array('media', 'price', 'text'), &$total = null);
128 128
 }
Please login to merge, or discard this patch.
controller/frontend/tests/Controller/Frontend/Basket/BaseTest.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -329,6 +329,9 @@
 block discarded – undo
329 329
 	}
330 330
 
331 331
 
332
+	/**
333
+	 * @param string $name
334
+	 */
332 335
 	protected function access( $name )
333 336
 	{
334 337
 		$class = new \ReflectionClass( \Aimeos\Controller\Frontend\Basket\Base::class );
Please login to merge, or discard this patch.
Spacing   +138 added lines, -138 removed lines patch added patch discarded remove patch
@@ -16,53 +16,53 @@  discard block
 block discarded – undo
16 16
 	protected function setUp()
17 17
 	{
18 18
 		$this->context = \TestHelperFrontend::getContext();
19
-		\Aimeos\MShop\Factory::setCache( true );
19
+		\Aimeos\MShop\Factory::setCache(true);
20 20
 	}
21 21
 
22 22
 
23 23
 	protected function tearDown()
24 24
 	{
25
-		\Aimeos\MShop\Factory::setCache( false );
26
-		$this->context->getSession()->set( 'aimeos', [] );
25
+		\Aimeos\MShop\Factory::setCache(false);
26
+		$this->context->getSession()->set('aimeos', []);
27 27
 
28
-		unset( $this->context );
28
+		unset($this->context);
29 29
 	}
30 30
 
31 31
 
32 32
 	public function testCheckLocale()
33 33
 	{
34
-		$object = $this->getMockBuilder( \Aimeos\Controller\Frontend\Basket\Standard::class )
35
-			->setConstructorArgs( [$this->context] )
36
-			->setMethods( null )
34
+		$object = $this->getMockBuilder(\Aimeos\Controller\Frontend\Basket\Standard::class)
35
+			->setConstructorArgs([$this->context])
36
+			->setMethods(null)
37 37
 			->getMock();
38 38
 
39
-		$this->context->getSession()->set( 'aimeos/basket/locale', 'unittest|en|EUR' );
40
-		$this->access( 'checkLocale' )->invokeArgs( $object, [$this->context->getLocale(), 'unittest'] );
39
+		$this->context->getSession()->set('aimeos/basket/locale', 'unittest|en|EUR');
40
+		$this->access('checkLocale')->invokeArgs($object, [$this->context->getLocale(), 'unittest']);
41 41
 	}
42 42
 
43 43
 
44 44
 	public function testCopyAddresses()
45 45
 	{
46
-		$manager = \Aimeos\MShop\Factory::createManager( \TestHelperFrontend::getContext(), 'order/base' );
46
+		$manager = \Aimeos\MShop\Factory::createManager(\TestHelperFrontend::getContext(), 'order/base');
47 47
 		$ordBaseItem = $manager->createItem();
48 48
 
49
-		$address = $this->getAddress( 'Example company' );
50
-		$ordBaseItem->setAddress( $address, \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT );
49
+		$address = $this->getAddress('Example company');
50
+		$ordBaseItem->setAddress($address, \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT);
51 51
 
52 52
 
53
-		$object = $this->getMockBuilder( \Aimeos\Controller\Frontend\Basket\Standard::class )
54
-			->setConstructorArgs( [$this->context] )
55
-			->setMethods( null )
53
+		$object = $this->getMockBuilder(\Aimeos\Controller\Frontend\Basket\Standard::class)
54
+			->setConstructorArgs([$this->context])
55
+			->setMethods(null)
56 56
 			->getMock();
57 57
 
58
-		$result = $this->access( 'copyAddresses' )->invokeArgs( $object, [$ordBaseItem, ['test'], 'unittest|en|EUR'] );
58
+		$result = $this->access('copyAddresses')->invokeArgs($object, [$ordBaseItem, ['test'], 'unittest|en|EUR']);
59 59
 
60 60
 
61
-		$this->assertEquals( ['test'], $result );
62
-		$this->assertEquals( 1, count( $object->get()->getAddresses() ) );
61
+		$this->assertEquals(['test'], $result);
62
+		$this->assertEquals(1, count($object->get()->getAddresses()));
63 63
 
64
-		$addr = $object->get()->getAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT );
65
-		$this->assertInstanceOf( \Aimeos\MShop\Order\Item\Base\Address\Iface::class, $addr );
64
+		$addr = $object->get()->getAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT);
65
+		$this->assertInstanceOf(\Aimeos\MShop\Order\Item\Base\Address\Iface::class, $addr);
66 66
 
67 67
 		$object->clear();
68 68
 	}
@@ -70,54 +70,54 @@  discard block
 block discarded – undo
70 70
 
71 71
 	public function testCopyAddressesException()
72 72
 	{
73
-		$manager = \Aimeos\MShop\Factory::createManager( \TestHelperFrontend::getContext(), 'order/base' );
73
+		$manager = \Aimeos\MShop\Factory::createManager(\TestHelperFrontend::getContext(), 'order/base');
74 74
 		$ordBaseItem = $manager->createItem();
75 75
 
76
-		$address = $this->getAddress( 'Example company' );
77
-		$ordBaseItem->setAddress( $address, \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT );
76
+		$address = $this->getAddress('Example company');
77
+		$ordBaseItem->setAddress($address, \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT);
78 78
 
79 79
 
80
-		$object = $this->getMockBuilder( \Aimeos\Controller\Frontend\Basket\Standard::class )
81
-			->setConstructorArgs( [$this->context] )
82
-			->setMethods( ['setAddress'] )
80
+		$object = $this->getMockBuilder(\Aimeos\Controller\Frontend\Basket\Standard::class)
81
+			->setConstructorArgs([$this->context])
82
+			->setMethods(['setAddress'])
83 83
 			->getMock();
84 84
 
85
-		$object->expects( $this->once() )->method( 'setAddress' )->will( $this->throwException( new \Exception() ) );
85
+		$object->expects($this->once())->method('setAddress')->will($this->throwException(new \Exception()));
86 86
 
87
-		$result = $this->access( 'copyAddresses' )->invokeArgs( $object, [$ordBaseItem, [], 'unittest|en|EUR'] );
87
+		$result = $this->access('copyAddresses')->invokeArgs($object, [$ordBaseItem, [], 'unittest|en|EUR']);
88 88
 
89
-		$this->assertEquals( 1, count( $result ) );
90
-		$this->assertArrayHasKey( 'address', $result );
89
+		$this->assertEquals(1, count($result));
90
+		$this->assertArrayHasKey('address', $result);
91 91
 	}
92 92
 
93 93
 
94 94
 	public function testCopyCoupon()
95 95
 	{
96
-		$manager = \Aimeos\MShop\Factory::createManager( \TestHelperFrontend::getContext(), 'order/base' );
96
+		$manager = \Aimeos\MShop\Factory::createManager(\TestHelperFrontend::getContext(), 'order/base');
97 97
 		$ordBaseItem = $manager->createItem();
98 98
 
99
-		$product = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'CNC', ['price'] );
100
-		$ordProdManager = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base/product' );
101
-		$ordProdItem = $ordProdManager->createItem()->copyFrom( $product );
99
+		$product = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('CNC', ['price']);
100
+		$ordProdManager = \Aimeos\MShop\Factory::createManager($this->context, 'order/base/product');
101
+		$ordProdItem = $ordProdManager->createItem()->copyFrom($product);
102 102
 
103
-		$priceItems = $product->getRefItems( 'price' );
104
-		$ordProdItem->setPrice( reset( $priceItems ) );
103
+		$priceItems = $product->getRefItems('price');
104
+		$ordProdItem->setPrice(reset($priceItems));
105 105
 
106
-		$ordBaseItem->addProduct( $ordProdItem );
107
-		$ordBaseItem->addCoupon( 'OPQR', [] );
106
+		$ordBaseItem->addProduct($ordProdItem);
107
+		$ordBaseItem->addCoupon('OPQR', []);
108 108
 
109 109
 
110
-		$object = $this->getMockBuilder( \Aimeos\Controller\Frontend\Basket\Standard::class )
111
-			->setConstructorArgs( [$this->context] )
112
-			->setMethods( null )
110
+		$object = $this->getMockBuilder(\Aimeos\Controller\Frontend\Basket\Standard::class)
111
+			->setConstructorArgs([$this->context])
112
+			->setMethods(null)
113 113
 			->getMock();
114 114
 
115
-		$object->addProduct( $product->getId() );
115
+		$object->addProduct($product->getId());
116 116
 
117
-		$result = $this->access( 'copyCoupons' )->invokeArgs( $object, [$ordBaseItem, ['test'], 'unittest|en|EUR'] );
117
+		$result = $this->access('copyCoupons')->invokeArgs($object, [$ordBaseItem, ['test'], 'unittest|en|EUR']);
118 118
 
119 119
 
120
-		$this->assertEquals( ['test'], $result );
120
+		$this->assertEquals(['test'], $result);
121 121
 
122 122
 		$object->clear();
123 123
 	}
@@ -125,48 +125,48 @@  discard block
 block discarded – undo
125 125
 
126 126
 	public function testCopyCouponException()
127 127
 	{
128
-		$manager = \Aimeos\MShop\Factory::createManager( \TestHelperFrontend::getContext(), 'order/base' );
128
+		$manager = \Aimeos\MShop\Factory::createManager(\TestHelperFrontend::getContext(), 'order/base');
129 129
 		$ordBaseItem = $manager->createItem();
130 130
 
131
-		$ordBaseItem->addCoupon( '90AB', [] );
131
+		$ordBaseItem->addCoupon('90AB', []);
132 132
 
133 133
 
134
-		$object = $this->getMockBuilder( \Aimeos\Controller\Frontend\Basket\Standard::class )
135
-			->setConstructorArgs( [$this->context] )
136
-			->setMethods( ['addCoupon'] )
134
+		$object = $this->getMockBuilder(\Aimeos\Controller\Frontend\Basket\Standard::class)
135
+			->setConstructorArgs([$this->context])
136
+			->setMethods(['addCoupon'])
137 137
 			->getMock();
138 138
 
139
-		$object->expects( $this->once() )->method( 'addCoupon' )->will( $this->throwException( new \Exception() ) );
139
+		$object->expects($this->once())->method('addCoupon')->will($this->throwException(new \Exception()));
140 140
 
141
-		$result = $this->access( 'copyCoupons' )->invokeArgs( $object, [$ordBaseItem, [], 'unittest|en|EUR'] );
141
+		$result = $this->access('copyCoupons')->invokeArgs($object, [$ordBaseItem, [], 'unittest|en|EUR']);
142 142
 
143
-		$this->assertEquals( 1, count( $result ) );
144
-		$this->assertArrayHasKey( 'coupon', $result );
143
+		$this->assertEquals(1, count($result));
144
+		$this->assertArrayHasKey('coupon', $result);
145 145
 	}
146 146
 
147 147
 
148 148
 	public function testCopyProduct()
149 149
 	{
150
-		$manager = \Aimeos\MShop\Factory::createManager( \TestHelperFrontend::getContext(), 'order/base' );
150
+		$manager = \Aimeos\MShop\Factory::createManager(\TestHelperFrontend::getContext(), 'order/base');
151 151
 		$ordBaseItem = $manager->createItem();
152 152
 
153
-		$product = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'CNC' );
154
-		$ordProdManager = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base/product' );
155
-		$ordProdItem = $ordProdManager->createItem()->copyFrom( $product );
156
-		$ordBaseItem->addProduct( $ordProdItem );
153
+		$product = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('CNC');
154
+		$ordProdManager = \Aimeos\MShop\Factory::createManager($this->context, 'order/base/product');
155
+		$ordProdItem = $ordProdManager->createItem()->copyFrom($product);
156
+		$ordBaseItem->addProduct($ordProdItem);
157 157
 
158 158
 
159
-		$object = $this->getMockBuilder( \Aimeos\Controller\Frontend\Basket\Standard::class )
160
-			->setConstructorArgs( [$this->context] )
161
-			->setMethods( null )
159
+		$object = $this->getMockBuilder(\Aimeos\Controller\Frontend\Basket\Standard::class)
160
+			->setConstructorArgs([$this->context])
161
+			->setMethods(null)
162 162
 			->getMock();
163 163
 
164
-		$result = $this->access( 'copyProducts' )->invokeArgs( $object, [$ordBaseItem, ['test'], 'unittest|en|EUR'] );
164
+		$result = $this->access('copyProducts')->invokeArgs($object, [$ordBaseItem, ['test'], 'unittest|en|EUR']);
165 165
 
166 166
 
167
-		$this->assertEquals( ['test'], $result );
168
-		$this->assertEquals( 1, count( $object->get()->getProducts() ) );
169
-		$this->assertInstanceOf( \Aimeos\MShop\Order\Item\Base\Product\Iface::class, $object->get()->getProduct( 0 ) );
167
+		$this->assertEquals(['test'], $result);
168
+		$this->assertEquals(1, count($object->get()->getProducts()));
169
+		$this->assertInstanceOf(\Aimeos\MShop\Order\Item\Base\Product\Iface::class, $object->get()->getProduct(0));
170 170
 
171 171
 		$object->clear();
172 172
 	}
@@ -174,58 +174,58 @@  discard block
 block discarded – undo
174 174
 
175 175
 	public function testCopyProductException()
176 176
 	{
177
-		$manager = \Aimeos\MShop\Factory::createManager( \TestHelperFrontend::getContext(), 'order/base' );
177
+		$manager = \Aimeos\MShop\Factory::createManager(\TestHelperFrontend::getContext(), 'order/base');
178 178
 		$ordBaseItem = $manager->createItem();
179 179
 
180
-		$product = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'CNC' );
181
-		$ordProdManager = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base/product' );
182
-		$ordProdItem = $ordProdManager->createItem()->copyFrom( $product );
183
-		$ordBaseItem->addProduct( $ordProdItem );
180
+		$product = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('CNC');
181
+		$ordProdManager = \Aimeos\MShop\Factory::createManager($this->context, 'order/base/product');
182
+		$ordProdItem = $ordProdManager->createItem()->copyFrom($product);
183
+		$ordBaseItem->addProduct($ordProdItem);
184 184
 
185 185
 
186
-		$object = $this->getMockBuilder( \Aimeos\Controller\Frontend\Basket\Standard::class )
187
-			->setConstructorArgs( [$this->context] )
188
-			->setMethods( ['addProduct'] )
186
+		$object = $this->getMockBuilder(\Aimeos\Controller\Frontend\Basket\Standard::class)
187
+			->setConstructorArgs([$this->context])
188
+			->setMethods(['addProduct'])
189 189
 			->getMock();
190 190
 
191
-		$object->expects( $this->once() )->method( 'addProduct' )->will( $this->throwException( new \Exception() ) );
191
+		$object->expects($this->once())->method('addProduct')->will($this->throwException(new \Exception()));
192 192
 
193
-		$result = $this->access( 'copyProducts' )->invokeArgs( $object, [$ordBaseItem, [], 'unittest|en|EUR'] );
193
+		$result = $this->access('copyProducts')->invokeArgs($object, [$ordBaseItem, [], 'unittest|en|EUR']);
194 194
 
195
-		$this->assertEquals( 1, count( $result ) );
196
-		$this->assertArrayHasKey( 'product', $result );
195
+		$this->assertEquals(1, count($result));
196
+		$this->assertArrayHasKey('product', $result);
197 197
 	}
198 198
 
199 199
 
200 200
 	public function testCopyServices()
201 201
 	{
202
-		$manager = \Aimeos\MShop\Factory::createManager( \TestHelperFrontend::getContext(), 'order/base' );
202
+		$manager = \Aimeos\MShop\Factory::createManager(\TestHelperFrontend::getContext(), 'order/base');
203 203
 		$ordBaseItem = $manager->createItem();
204 204
 
205
-		$serviceManager = \Aimeos\MShop\Factory::createManager( $this->context, 'service' );
206
-		$ordServManager = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base/service' );
205
+		$serviceManager = \Aimeos\MShop\Factory::createManager($this->context, 'service');
206
+		$ordServManager = \Aimeos\MShop\Factory::createManager($this->context, 'order/base/service');
207 207
 
208
-		$serviceItem = $serviceManager->findItem( 'unitcode', [], 'service', 'delivery' );
209
-		$ordServItem = $ordServManager->createItem()->copyFrom( $serviceItem );
208
+		$serviceItem = $serviceManager->findItem('unitcode', [], 'service', 'delivery');
209
+		$ordServItem = $ordServManager->createItem()->copyFrom($serviceItem);
210 210
 
211
-		$ordBaseItem->addService( $ordServItem, \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_DELIVERY );
211
+		$ordBaseItem->addService($ordServItem, \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_DELIVERY);
212 212
 
213 213
 
214
-		$object = $this->getMockBuilder( \Aimeos\Controller\Frontend\Basket\Standard::class )
215
-			->setConstructorArgs( [$this->context] )
216
-			->setMethods( null )
214
+		$object = $this->getMockBuilder(\Aimeos\Controller\Frontend\Basket\Standard::class)
215
+			->setConstructorArgs([$this->context])
216
+			->setMethods(null)
217 217
 			->getMock();
218 218
 
219
-		$result = $this->access( 'copyServices' )->invokeArgs( $object, [$ordBaseItem, ['test'], 'unittest|en|EUR'] );
219
+		$result = $this->access('copyServices')->invokeArgs($object, [$ordBaseItem, ['test'], 'unittest|en|EUR']);
220 220
 
221 221
 
222
-		$this->assertEquals( ['test'], $result );
223
-		$this->assertEquals( 1, count( $object->get()->getServices() ) );
222
+		$this->assertEquals(['test'], $result);
223
+		$this->assertEquals(1, count($object->get()->getServices()));
224 224
 
225
-		$services = $object->get()->getService( \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_DELIVERY );
225
+		$services = $object->get()->getService(\Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_DELIVERY);
226 226
 
227
-		foreach( $services as $service ) {
228
-			$this->assertInstanceOf( \Aimeos\MShop\Order\Item\Base\Service\Iface::class, $service );
227
+		foreach ($services as $service) {
228
+			$this->assertInstanceOf(\Aimeos\MShop\Order\Item\Base\Service\Iface::class, $service);
229 229
 		}
230 230
 
231 231
 		$object->clear();
@@ -234,106 +234,106 @@  discard block
 block discarded – undo
234 234
 
235 235
 	public function testCopyServicesException()
236 236
 	{
237
-		$manager = \Aimeos\MShop\Factory::createManager( \TestHelperFrontend::getContext(), 'order/base' );
237
+		$manager = \Aimeos\MShop\Factory::createManager(\TestHelperFrontend::getContext(), 'order/base');
238 238
 		$ordBaseItem = $manager->createItem();
239 239
 
240
-		$serviceManager = \Aimeos\MShop\Factory::createManager( $this->context, 'service' );
241
-		$ordServManager = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base/service' );
240
+		$serviceManager = \Aimeos\MShop\Factory::createManager($this->context, 'service');
241
+		$ordServManager = \Aimeos\MShop\Factory::createManager($this->context, 'order/base/service');
242 242
 
243
-		$serviceItem = $serviceManager->findItem( 'unitcode', [], 'service', 'delivery' );
244
-		$ordServItem = $ordServManager->createItem()->copyFrom( $serviceItem );
243
+		$serviceItem = $serviceManager->findItem('unitcode', [], 'service', 'delivery');
244
+		$ordServItem = $ordServManager->createItem()->copyFrom($serviceItem);
245 245
 
246
-		$ordBaseItem->addService( $ordServItem, \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_DELIVERY );
246
+		$ordBaseItem->addService($ordServItem, \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_DELIVERY);
247 247
 
248 248
 
249
-		$object = $this->getMockBuilder( \Aimeos\Controller\Frontend\Basket\Standard::class )
250
-			->setConstructorArgs( [$this->context] )
251
-			->setMethods( ['addService'] )
249
+		$object = $this->getMockBuilder(\Aimeos\Controller\Frontend\Basket\Standard::class)
250
+			->setConstructorArgs([$this->context])
251
+			->setMethods(['addService'])
252 252
 			->getMock();
253 253
 
254
-		$object->expects( $this->once() )->method( 'addService' )->will( $this->throwException( new \Exception() ) );
254
+		$object->expects($this->once())->method('addService')->will($this->throwException(new \Exception()));
255 255
 
256
-		$result = $this->access( 'copyServices' )->invokeArgs( $object, [$ordBaseItem, [], 'unittest|en|EUR'] );
256
+		$result = $this->access('copyServices')->invokeArgs($object, [$ordBaseItem, [], 'unittest|en|EUR']);
257 257
 
258
-		$this->assertEquals( 0, count( $result ) );
258
+		$this->assertEquals(0, count($result));
259 259
 	}
260 260
 
261 261
 
262 262
 	public function testCreateSubscriptions()
263 263
 	{
264
-		$baseManager = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base' );
264
+		$baseManager = \Aimeos\MShop\Factory::createManager($this->context, 'order/base');
265 265
 
266 266
 		$search = $baseManager->createSearch();
267
-		$search->setConditions( $search->compare( '==', 'order.base.price', '53.50' ) );
267
+		$search->setConditions($search->compare('==', 'order.base.price', '53.50'));
268 268
 
269
-		$items = $baseManager->searchItems( $search, ['order/base/product'] );
269
+		$items = $baseManager->searchItems($search, ['order/base/product']);
270 270
 
271
-		if( ( $basket = reset( $items ) ) === false ) {
272
-			throw new \Exception( sprintf( 'No order base item found for price "%1$s"', '53,50' ) );
271
+		if (($basket = reset($items)) === false) {
272
+			throw new \Exception(sprintf('No order base item found for price "%1$s"', '53,50'));
273 273
 		}
274 274
 
275
-		$object = $this->getMockBuilder( \Aimeos\Controller\Frontend\Basket\Standard::class )
276
-			->setConstructorArgs( [$this->context] )
277
-			->setMethods( ['getAttributes'] )
275
+		$object = $this->getMockBuilder(\Aimeos\Controller\Frontend\Basket\Standard::class)
276
+			->setConstructorArgs([$this->context])
277
+			->setMethods(['getAttributes'])
278 278
 			->getMock();
279 279
 
280
-		$stub = $this->getMockBuilder( \Aimeos\MShop\Subscription\Manager\Standard::class )
281
-			->setConstructorArgs( [$this->context] )
282
-			->setMethods( ['saveItem'] )
280
+		$stub = $this->getMockBuilder(\Aimeos\MShop\Subscription\Manager\Standard::class)
281
+			->setConstructorArgs([$this->context])
282
+			->setMethods(['saveItem'])
283 283
 			->getMock();
284 284
 
285
-		\Aimeos\MShop\Factory::injectManager( $this->context, 'subscription', $stub );
285
+		\Aimeos\MShop\Factory::injectManager($this->context, 'subscription', $stub);
286 286
 
287
-		$stub->expects( $this->exactly( 2 ) )->method( 'saveItem' );
287
+		$stub->expects($this->exactly(2))->method('saveItem');
288 288
 
289
-		$this->access( 'createSubscriptions' )->invokeArgs( $object, [$basket] );
289
+		$this->access('createSubscriptions')->invokeArgs($object, [$basket]);
290 290
 	}
291 291
 
292 292
 
293 293
 	public function testGetOrderProductAttributes()
294 294
 	{
295
-		$object = $this->getMockBuilder( \Aimeos\Controller\Frontend\Basket\Standard::class )
296
-			->setConstructorArgs( [$this->context] )
297
-			->setMethods( ['getAttributes'] )
295
+		$object = $this->getMockBuilder(\Aimeos\Controller\Frontend\Basket\Standard::class)
296
+			->setConstructorArgs([$this->context])
297
+			->setMethods(['getAttributes'])
298 298
 			->getMock();
299 299
 
300
-		$list = [1 => new \Aimeos\MShop\Attribute\Item\Standard( ['attribute.code' => 'special_instructions'] )];
301
-		$object->expects( $this->once() )->method( 'getAttributes' )->will( $this->returnValue( $list ) );
300
+		$list = [1 => new \Aimeos\MShop\Attribute\Item\Standard(['attribute.code' => 'special_instructions'])];
301
+		$object->expects($this->once())->method('getAttributes')->will($this->returnValue($list));
302 302
 
303
-		$result = $this->access( 'getOrderProductAttributes' )->invokeArgs( $object, ['test', ['1'], ['1' => 'test']] );
303
+		$result = $this->access('getOrderProductAttributes')->invokeArgs($object, ['test', ['1'], ['1' => 'test']]);
304 304
 
305
-		$this->assertEquals( 1, count( $result ) );
306
-		$this->assertEquals( 'test', $result[0]->getValue() );
305
+		$this->assertEquals(1, count($result));
306
+		$this->assertEquals('test', $result[0]->getValue());
307 307
 	}
308 308
 
309 309
 
310 310
 	/**
311 311
 	 * @param string $company
312 312
 	 */
313
-	protected function getAddress( $company )
313
+	protected function getAddress($company)
314 314
 	{
315
-		$manager = \Aimeos\MShop\Factory::createManager( \TestHelperFrontend::getContext(), 'customer/address' );
315
+		$manager = \Aimeos\MShop\Factory::createManager(\TestHelperFrontend::getContext(), 'customer/address');
316 316
 
317 317
 		$search = $manager->createSearch();
318
-		$search->setConditions( $search->compare( '==', 'customer.address.company', $company ) );
319
-		$items = $manager->searchItems( $search );
318
+		$search->setConditions($search->compare('==', 'customer.address.company', $company));
319
+		$items = $manager->searchItems($search);
320 320
 
321
-		if( ( $item = reset( $items ) ) === false ) {
322
-			throw new \RuntimeException( sprintf( 'No address item with company "%1$s" found', $company ) );
321
+		if (($item = reset($items)) === false) {
322
+			throw new \RuntimeException(sprintf('No address item with company "%1$s" found', $company));
323 323
 		}
324 324
 
325
-		$ordAddrManager = \Aimeos\MShop\Factory::createManager( \TestHelperFrontend::getContext(), 'order/base/address' );
326
-		$ordAddrItem = $ordAddrManager->createItem()->copyFrom( $item );
325
+		$ordAddrManager = \Aimeos\MShop\Factory::createManager(\TestHelperFrontend::getContext(), 'order/base/address');
326
+		$ordAddrItem = $ordAddrManager->createItem()->copyFrom($item);
327 327
 
328 328
 		return $ordAddrItem;
329 329
 	}
330 330
 
331 331
 
332
-	protected function access( $name )
332
+	protected function access($name)
333 333
 	{
334
-		$class = new \ReflectionClass( \Aimeos\Controller\Frontend\Basket\Base::class );
335
-		$method = $class->getMethod( $name );
336
-		$method->setAccessible( true );
334
+		$class = new \ReflectionClass(\Aimeos\Controller\Frontend\Basket\Base::class);
335
+		$method = $class->getMethod($name);
336
+		$method->setAccessible(true);
337 337
 
338 338
 		return $method;
339 339
 	}
Please login to merge, or discard this patch.
controller/frontend/tests/Controller/Frontend/Service/StandardTest.php 1 patch
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -19,124 +19,124 @@  discard block
 block discarded – undo
19 19
 
20 20
 	protected function setUp()
21 21
 	{
22
-		\Aimeos\MShop\Factory::setCache( true );
22
+		\Aimeos\MShop\Factory::setCache(true);
23 23
 
24 24
 		$this->context = \TestHelperFrontend::getContext();
25
-		$this->object = new \Aimeos\Controller\Frontend\Service\Standard( $this->context );
25
+		$this->object = new \Aimeos\Controller\Frontend\Service\Standard($this->context);
26 26
 	}
27 27
 
28 28
 
29 29
 	public static function setUpBeforeClass()
30 30
 	{
31
-		$orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager( \TestHelperFrontend::getContext() );
32
-		$orderBaseMgr = $orderManager->getSubManager( 'base' );
31
+		$orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager(\TestHelperFrontend::getContext());
32
+		$orderBaseMgr = $orderManager->getSubManager('base');
33 33
 		self::$basket = $orderBaseMgr->createItem();
34 34
 	}
35 35
 
36 36
 
37 37
 	protected function tearDown()
38 38
 	{
39
-		unset( $this->object, $this->context );
39
+		unset($this->object, $this->context);
40 40
 
41
-		\Aimeos\MShop\Factory::setCache( false );
41
+		\Aimeos\MShop\Factory::setCache(false);
42 42
 		\Aimeos\MShop\Factory::clear();
43 43
 	}
44 44
 
45 45
 
46 46
 	public function testCheckAttributes()
47 47
 	{
48
-		$attributes = $this->object->checkAttributes( $this->getServiceItem()->getId(), [] );
49
-		$this->assertEquals( [], $attributes );
48
+		$attributes = $this->object->checkAttributes($this->getServiceItem()->getId(), []);
49
+		$this->assertEquals([], $attributes);
50 50
 	}
51 51
 
52 52
 
53 53
 	public function testGetProviders()
54 54
 	{
55
-		$providers = $this->object->getProviders( 'delivery' );
56
-		$this->assertGreaterThan( 0, count( $providers ) );
55
+		$providers = $this->object->getProviders('delivery');
56
+		$this->assertGreaterThan(0, count($providers));
57 57
 
58
-		foreach( $providers as $provider ) {
59
-			$this->assertInstanceOf( '\\Aimeos\\MShop\\Service\\Provider\\Iface', $provider );
58
+		foreach ($providers as $provider) {
59
+			$this->assertInstanceOf('\\Aimeos\\MShop\\Service\\Provider\\Iface', $provider);
60 60
 		}
61 61
 	}
62 62
 
63 63
 
64 64
 	public function testGetProvider()
65 65
 	{
66
-		$provider = $this->object->getProvider( $this->getServiceItem()->getId() );
67
-		$this->assertInstanceOf( '\\Aimeos\\MShop\\Service\\Provider\\Iface', $provider );
66
+		$provider = $this->object->getProvider($this->getServiceItem()->getId());
67
+		$this->assertInstanceOf('\\Aimeos\\MShop\\Service\\Provider\\Iface', $provider);
68 68
 	}
69 69
 
70 70
 
71 71
 	public function testProcess()
72 72
 	{
73 73
 		$form = new \Aimeos\MShop\Common\Item\Helper\Form\Standard();
74
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem();
75
-		$serviceId = \Aimeos\MShop\Factory::createManager( $this->context, 'service' )->findItem( 'unitcode' )->getId();
74
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'order')->createItem();
75
+		$serviceId = \Aimeos\MShop\Factory::createManager($this->context, 'service')->findItem('unitcode')->getId();
76 76
 
77
-		$provider = $this->getMockBuilder( '\\Aimeos\\MShop\\Service\\Provider\\Delivery\\Standard' )
77
+		$provider = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Provider\\Delivery\\Standard')
78 78
 			->disableOriginalConstructor()
79
-			->setMethods( ['process'] )
79
+			->setMethods(['process'])
80 80
 			->getMock();
81 81
 
82
-		$manager = $this->getMockBuilder( '\\Aimeos\\MShop\\Service\\Manager\\Standard' )
83
-			->setConstructorArgs( [$this->context] )
84
-			->setMethods( ['getProvider'] )
82
+		$manager = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Manager\\Standard')
83
+			->setConstructorArgs([$this->context])
84
+			->setMethods(['getProvider'])
85 85
 			->getMock();
86 86
 
87
-		\Aimeos\MShop\Factory::injectManager( $this->context, 'service', $manager );
87
+		\Aimeos\MShop\Factory::injectManager($this->context, 'service', $manager);
88 88
 
89
-		$provider->expects( $this->once() )->method( 'process' )->will( $this->returnValue( $form ) );
90
-		$manager->expects( $this->once() )->method( 'getProvider' )->will( $this->returnValue( $provider ) );
89
+		$provider->expects($this->once())->method('process')->will($this->returnValue($form));
90
+		$manager->expects($this->once())->method('getProvider')->will($this->returnValue($provider));
91 91
 
92 92
 
93
-		$result = $this->object->process( $item, $serviceId, [], [] );
94
-		$this->assertInstanceOf( \Aimeos\MShop\Common\Item\Helper\Form\Iface::class, $result );
93
+		$result = $this->object->process($item, $serviceId, [], []);
94
+		$this->assertInstanceOf(\Aimeos\MShop\Common\Item\Helper\Form\Iface::class, $result);
95 95
 	}
96 96
 
97 97
 
98 98
 	public function testUpdatePush()
99 99
 	{
100
-		$request = $this->getMockBuilder( \Psr\Http\Message\ServerRequestInterface::class )->getMock();
101
-		$response = $this->getMockBuilder( \Psr\Http\Message\ResponseInterface::class )->getMock();
100
+		$request = $this->getMockBuilder(\Psr\Http\Message\ServerRequestInterface::class)->getMock();
101
+		$response = $this->getMockBuilder(\Psr\Http\Message\ResponseInterface::class)->getMock();
102 102
 
103
-		$response->expects( $this->once() )->method( 'withStatus' )->will( $this->returnValue( $response ) );
103
+		$response->expects($this->once())->method('withStatus')->will($this->returnValue($response));
104 104
 
105
-		$this->assertInstanceOf( \Psr\Http\Message\ResponseInterface::class, $this->object->updatePush( $request, $response, 'unitcode' ) );
105
+		$this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $this->object->updatePush($request, $response, 'unitcode'));
106 106
 	}
107 107
 
108 108
 
109 109
 	public function testUpdateSync()
110 110
 	{
111
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem();
112
-		$request = $this->getMockBuilder( \Psr\Http\Message\ServerRequestInterface::class )->getMock();
111
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'order')->createItem();
112
+		$request = $this->getMockBuilder(\Psr\Http\Message\ServerRequestInterface::class)->getMock();
113 113
 
114
-		$provider = $this->getMockBuilder( '\\Aimeos\\MShop\\Service\\Provider\\Delivery\\Standard' )
115
-			->setMethods( ['updateSync', 'query', 'isImplemented'] )
114
+		$provider = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Provider\\Delivery\\Standard')
115
+			->setMethods(['updateSync', 'query', 'isImplemented'])
116 116
 			->disableOriginalConstructor()
117 117
 			->getMock();
118 118
 
119
-		$orderManager = $this->getMockBuilder( '\\Aimeos\\MShop\\Order\\Manager\\Standard' )
120
-			->setConstructorArgs( array( $this->context ) )
121
-			->setMethods( ['getItem'] )
119
+		$orderManager = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Standard')
120
+			->setConstructorArgs(array($this->context))
121
+			->setMethods(['getItem'])
122 122
 			->getMock();
123 123
 
124
-		$serviceManager = $this->getMockBuilder( '\\Aimeos\\MShop\\Service\\Manager\\Standard' )
125
-			->setConstructorArgs( array( $this->context ) )
126
-			->setMethods( ['getProvider'] )
124
+		$serviceManager = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Manager\\Standard')
125
+			->setConstructorArgs(array($this->context))
126
+			->setMethods(['getProvider'])
127 127
 			->getMock();
128 128
 
129
-		\Aimeos\MShop\Factory::injectManager( $this->context, 'order', $orderManager );
130
-		\Aimeos\MShop\Factory::injectManager( $this->context, 'service', $serviceManager );
129
+		\Aimeos\MShop\Factory::injectManager($this->context, 'order', $orderManager);
130
+		\Aimeos\MShop\Factory::injectManager($this->context, 'service', $serviceManager);
131 131
 
132 132
 
133
-		$orderManager->expects( $this->once() )->method( 'getItem' )->will( $this->returnValue( $item ) );
134
-		$serviceManager->expects( $this->once() )->method( 'getProvider' )->will( $this->returnValue( $provider ) );
135
-		$provider->expects( $this->once() )->method( 'updateSync' )->will( $this->returnValue( $item ) );
136
-		$provider->expects( $this->once() )->method( 'isImplemented' )->will( $this->returnValue( true ) );
137
-		$provider->expects( $this->once() )->method( 'query' );
133
+		$orderManager->expects($this->once())->method('getItem')->will($this->returnValue($item));
134
+		$serviceManager->expects($this->once())->method('getProvider')->will($this->returnValue($provider));
135
+		$provider->expects($this->once())->method('updateSync')->will($this->returnValue($item));
136
+		$provider->expects($this->once())->method('isImplemented')->will($this->returnValue(true));
137
+		$provider->expects($this->once())->method('query');
138 138
 
139
-		$this->object->updateSync( $request, 'unitcode', -1 );
139
+		$this->object->updateSync($request, 'unitcode', -1);
140 140
 	}
141 141
 
142 142
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 	 */
146 146
 	protected function getServiceItem()
147 147
 	{
148
-		$manager = \Aimeos\MShop\Service\Manager\Factory::createManager( \TestHelperFrontend::getContext() );
149
-		return $manager->findItem( 'unitcode' );
148
+		$manager = \Aimeos\MShop\Service\Manager\Factory::createManager(\TestHelperFrontend::getContext());
149
+		return $manager->findItem('unitcode');
150 150
 	}
151 151
 }
Please login to merge, or discard this patch.
frontend/tests/Controller/Frontend/Service/Decorator/BaseTest.php 1 patch
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -20,130 +20,130 @@
 block discarded – undo
20 20
 	{
21 21
 		$this->context = \TestHelperFrontend::getContext();
22 22
 
23
-		$this->stub = $this->getMockBuilder( \Aimeos\Controller\Frontend\Service\Standard::class )
23
+		$this->stub = $this->getMockBuilder(\Aimeos\Controller\Frontend\Service\Standard::class)
24 24
 			->disableOriginalConstructor()
25 25
 			->getMock();
26 26
 
27
-		$this->object = $this->getMockBuilder( \Aimeos\Controller\Frontend\Service\Decorator\Base::class )
28
-			->setConstructorArgs( [$this->stub, $this->context] )
27
+		$this->object = $this->getMockBuilder(\Aimeos\Controller\Frontend\Service\Decorator\Base::class)
28
+			->setConstructorArgs([$this->stub, $this->context])
29 29
 			->getMockForAbstractClass();
30 30
 	}
31 31
 
32 32
 
33 33
 	protected function tearDown()
34 34
 	{
35
-		unset( $this->context, $this->object, $this->stub );
35
+		unset($this->context, $this->object, $this->stub);
36 36
 	}
37 37
 
38 38
 
39 39
 	public function testConstructException()
40 40
 	{
41
-		$stub = $this->getMockBuilder( \Aimeos\Controller\Frontend\Iface::class )->getMock();
41
+		$stub = $this->getMockBuilder(\Aimeos\Controller\Frontend\Iface::class)->getMock();
42 42
 
43
-		$this->setExpectedException( \Aimeos\MW\Common\Exception::class );
43
+		$this->setExpectedException(\Aimeos\MW\Common\Exception::class);
44 44
 
45
-		$this->getMockBuilder( \Aimeos\Controller\Frontend\Service\Decorator\Base::class )
46
-			->setConstructorArgs( [$stub, $this->context] )
45
+		$this->getMockBuilder(\Aimeos\Controller\Frontend\Service\Decorator\Base::class)
46
+			->setConstructorArgs([$stub, $this->context])
47 47
 			->getMockForAbstractClass();
48 48
 	}
49 49
 
50 50
 
51 51
 	public function testCall()
52 52
 	{
53
-		$stub = $this->getMockBuilder( \Aimeos\Controller\Frontend\Service\Standard::class )
53
+		$stub = $this->getMockBuilder(\Aimeos\Controller\Frontend\Service\Standard::class)
54 54
 			->disableOriginalConstructor()
55
-			->setMethods( ['invalid'] )
55
+			->setMethods(['invalid'])
56 56
 			->getMock();
57 57
 
58
-		$object = $this->getMockBuilder( \Aimeos\Controller\Frontend\Service\Decorator\Base::class )
59
-			->setConstructorArgs( [$stub, $this->context] )
58
+		$object = $this->getMockBuilder(\Aimeos\Controller\Frontend\Service\Decorator\Base::class)
59
+			->setConstructorArgs([$stub, $this->context])
60 60
 			->getMockForAbstractClass();
61 61
 
62
-		$stub->expects( $this->once() )->method( 'invalid' )->will( $this->returnValue( true ) );
62
+		$stub->expects($this->once())->method('invalid')->will($this->returnValue(true));
63 63
 
64
-		$this->assertTrue( $object->invalid() );
64
+		$this->assertTrue($object->invalid());
65 65
 	}
66 66
 
67 67
 
68 68
 	public function testCheckAttributes()
69 69
 	{
70
-		$this->stub->expects( $this->once() )->method( 'checkAttributes' )
71
-			->will( $this->returnValue( [] ) );
70
+		$this->stub->expects($this->once())->method('checkAttributes')
71
+			->will($this->returnValue([]));
72 72
 
73
-		$this->assertEquals( [], $this->object->checkAttributes( -1, [] ) );
73
+		$this->assertEquals([], $this->object->checkAttributes( -1, [] ));
74 74
 	}
75 75
 
76 76
 
77 77
 	public function testGetProvider()
78 78
 	{
79
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'service' );
80
-		$provider = $manager->getProvider( $manager->findItem( 'unitcode', [], 'service', 'delivery' ), 'delivery' );
79
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'service');
80
+		$provider = $manager->getProvider($manager->findItem('unitcode', [], 'service', 'delivery'), 'delivery');
81 81
 
82
-		$this->stub->expects( $this->once() )->method( 'getProvider' )
83
-			->will( $this->returnValue( $provider ) );
82
+		$this->stub->expects($this->once())->method('getProvider')
83
+			->will($this->returnValue($provider));
84 84
 
85
-		$this->assertSame( $provider, $this->object->getProvider( -1 ) );
85
+		$this->assertSame($provider, $this->object->getProvider( -1 ));
86 86
 	}
87 87
 
88 88
 
89 89
 	public function testGetProviders()
90 90
 	{
91
-		$this->stub->expects( $this->once() )->method( 'getProviders' )
92
-			->will( $this->returnValue( [] ) );
91
+		$this->stub->expects($this->once())->method('getProviders')
92
+			->will($this->returnValue([]));
93 93
 
94
-		$this->assertEquals( [], $this->object->getProviders( 'payment' ) );
94
+		$this->assertEquals([], $this->object->getProviders('payment'));
95 95
 	}
96 96
 
97 97
 
98 98
 	public function testProcess()
99 99
 	{
100
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem();
100
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'order')->createItem();
101 101
 
102
-		$this->stub->expects( $this->once() )->method( 'process' )
103
-			->will( $this->returnValue( new \Aimeos\MShop\Common\Item\Helper\Form\Standard() ) );
102
+		$this->stub->expects($this->once())->method('process')
103
+			->will($this->returnValue(new \Aimeos\MShop\Common\Item\Helper\Form\Standard()));
104 104
 
105
-		$this->assertInstanceOf( 'Aimeos\MShop\Common\Item\Helper\Form\Iface', $this->object->process( $item, -1, [], [] ) );
105
+		$this->assertInstanceOf('Aimeos\MShop\Common\Item\Helper\Form\Iface', $this->object->process($item, -1, [], []));
106 106
 	}
107 107
 
108 108
 
109 109
 	public function testUpdatePush()
110 110
 	{
111
-		$response = $this->getMockBuilder( \Psr\Http\Message\ResponseInterface::class )->getMock();
112
-		$request = $this->getMockBuilder( \Psr\Http\Message\ServerRequestInterface::class )->getMock();
111
+		$response = $this->getMockBuilder(\Psr\Http\Message\ResponseInterface::class)->getMock();
112
+		$request = $this->getMockBuilder(\Psr\Http\Message\ServerRequestInterface::class)->getMock();
113 113
 
114
-		$this->stub->expects( $this->once() )->method( 'updatePush' )
115
-			->will( $this->returnValue( $response ) );
114
+		$this->stub->expects($this->once())->method('updatePush')
115
+			->will($this->returnValue($response));
116 116
 
117
-		$this->assertInstanceOf( \Psr\Http\Message\ResponseInterface::class, $this->object->updatePush( $request, $response, 'test' ) );
117
+		$this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $this->object->updatePush($request, $response, 'test'));
118 118
 	}
119 119
 
120 120
 
121 121
 	public function testUpdateSync()
122 122
 	{
123
-		$response = $this->getMockBuilder( \Psr\Http\Message\ResponseInterface::class )->getMock();
124
-		$request = $this->getMockBuilder( \Psr\Http\Message\ServerRequestInterface::class )->getMock();
125
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem();
123
+		$response = $this->getMockBuilder(\Psr\Http\Message\ResponseInterface::class)->getMock();
124
+		$request = $this->getMockBuilder(\Psr\Http\Message\ServerRequestInterface::class)->getMock();
125
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'order')->createItem();
126 126
 
127
-		$this->stub->expects( $this->once() )->method( 'updateSync' )
128
-			->will( $this->returnValue( $item ) );
127
+		$this->stub->expects($this->once())->method('updateSync')
128
+			->will($this->returnValue($item));
129 129
 
130
-		$this->assertInstanceOf( 'Aimeos\MShop\Order\Item\Iface', $this->object->updateSync( $request, $response, [], 'test', -1 ) );
130
+		$this->assertInstanceOf('Aimeos\MShop\Order\Item\Iface', $this->object->updateSync($request, $response, [], 'test', -1));
131 131
 	}
132 132
 
133 133
 
134 134
 	public function testGetController()
135 135
 	{
136
-		$result = $this->access( 'getController' )->invokeArgs( $this->object, [] );
136
+		$result = $this->access('getController')->invokeArgs($this->object, []);
137 137
 
138
-		$this->assertSame( $this->stub, $result );
138
+		$this->assertSame($this->stub, $result);
139 139
 	}
140 140
 
141 141
 
142
-	protected function access( $name )
142
+	protected function access($name)
143 143
 	{
144
-		$class = new \ReflectionClass( \Aimeos\Controller\Frontend\Service\Decorator\Base::class );
145
-		$method = $class->getMethod( $name );
146
-		$method->setAccessible( true );
144
+		$class = new \ReflectionClass(\Aimeos\Controller\Frontend\Service\Decorator\Base::class);
145
+		$method = $class->getMethod($name);
146
+		$method->setAccessible(true);
147 147
 
148 148
 		return $method;
149 149
 	}
Please login to merge, or discard this patch.