@@ -18,183 +18,183 @@ |
||
18 | 18 | |
19 | 19 | protected function setUp() |
20 | 20 | { |
21 | - \Aimeos\MShop\Factory::setCache( true ); |
|
21 | + \Aimeos\MShop\Factory::setCache(true); |
|
22 | 22 | |
23 | 23 | $this->context = \TestHelperFrontend::getContext(); |
24 | - $this->object = new \Aimeos\Controller\Frontend\Order\Standard( $this->context ); |
|
24 | + $this->object = new \Aimeos\Controller\Frontend\Order\Standard($this->context); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | |
28 | 28 | protected function tearDown() |
29 | 29 | { |
30 | - unset( $this->object, $this->context ); |
|
30 | + unset($this->object, $this->context); |
|
31 | 31 | |
32 | - \Aimeos\MShop\Factory::setCache( false ); |
|
32 | + \Aimeos\MShop\Factory::setCache(false); |
|
33 | 33 | \Aimeos\MShop\Factory::clear(); |
34 | 34 | } |
35 | 35 | |
36 | 36 | |
37 | 37 | public function testAddItem() |
38 | 38 | { |
39 | - $manager = $this->getMockBuilder( '\\Aimeos\\MShop\\Order\\Manager\\Standard' ) |
|
40 | - ->setConstructorArgs( [$this->context] ) |
|
41 | - ->setMethods( ['saveItem'] ) |
|
39 | + $manager = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Standard') |
|
40 | + ->setConstructorArgs([$this->context]) |
|
41 | + ->setMethods(['saveItem']) |
|
42 | 42 | ->getMock(); |
43 | 43 | |
44 | - \Aimeos\MShop\Factory::injectManager( $this->context, 'order', $manager ); |
|
44 | + \Aimeos\MShop\Factory::injectManager($this->context, 'order', $manager); |
|
45 | 45 | |
46 | - $manager->expects( $this->once() )->method( 'saveItem' ); |
|
46 | + $manager->expects($this->once())->method('saveItem'); |
|
47 | 47 | |
48 | - $this->assertInstanceOf( '\Aimeos\MShop\Order\Item\Iface', $this->object->addItem( -1, 'test' ) ); |
|
48 | + $this->assertInstanceOf('\Aimeos\MShop\Order\Item\Iface', $this->object->addItem( -1, 'test' )); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | |
52 | 52 | public function testAddItemLimit() |
53 | 53 | { |
54 | - $this->context->getConfig()->set( 'controller/frontend/order/limit-seconds', 86400 * 365 ); |
|
54 | + $this->context->getConfig()->set('controller/frontend/order/limit-seconds', 86400 * 365); |
|
55 | 55 | |
56 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base' ); |
|
57 | - $result = $manager->searchItems( $manager->createSearch()->setSlice( 0, 1 ) ); |
|
56 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'order/base'); |
|
57 | + $result = $manager->searchItems($manager->createSearch()->setSlice(0, 1)); |
|
58 | 58 | |
59 | - if( ( $item = reset( $result ) ) === false ) { |
|
60 | - throw new \RuntimeException( 'No order item found' ); |
|
59 | + if (($item = reset($result)) === false) { |
|
60 | + throw new \RuntimeException('No order item found'); |
|
61 | 61 | } |
62 | 62 | |
63 | - $this->setExpectedException( '\Aimeos\Controller\Frontend\Order\Exception' ); |
|
64 | - $this->object->addItem( $item->getId(), 'test' ); |
|
63 | + $this->setExpectedException('\Aimeos\Controller\Frontend\Order\Exception'); |
|
64 | + $this->object->addItem($item->getId(), 'test'); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | |
68 | 68 | public function testCreateFilter() |
69 | 69 | { |
70 | - $this->assertInstanceOf( '\Aimeos\MW\Criteria\Iface', $this->object->createFilter() ); |
|
70 | + $this->assertInstanceOf('\Aimeos\MW\Criteria\Iface', $this->object->createFilter()); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | |
74 | 74 | public function testGetItem() |
75 | 75 | { |
76 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' ); |
|
77 | - $customerItem = $manager->findItem( 'UTC001' ); |
|
76 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'customer'); |
|
77 | + $customerItem = $manager->findItem('UTC001'); |
|
78 | 78 | |
79 | - $this->context->setEditor( 'core:unittest' ); |
|
79 | + $this->context->setEditor('core:unittest'); |
|
80 | 80 | |
81 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'order' ); |
|
82 | - $search = $manager->createSearch()->setSlice( 0, 1 ); |
|
83 | - $search->setConditions( $search->compare( '==', 'order.base.customerid', $customerItem->getId() ) ); |
|
84 | - $result = $manager->searchItems( $search ); |
|
81 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'order'); |
|
82 | + $search = $manager->createSearch()->setSlice(0, 1); |
|
83 | + $search->setConditions($search->compare('==', 'order.base.customerid', $customerItem->getId())); |
|
84 | + $result = $manager->searchItems($search); |
|
85 | 85 | |
86 | - if( ( $item = reset( $result ) ) === false ) { |
|
87 | - throw new \RuntimeException( 'No order item found' ); |
|
86 | + if (($item = reset($result)) === false) { |
|
87 | + throw new \RuntimeException('No order item found'); |
|
88 | 88 | } |
89 | 89 | |
90 | - $this->assertInstanceOf( '\Aimeos\MShop\Order\Item\Iface', $this->object->getItem( $item->getId() ) ); |
|
90 | + $this->assertInstanceOf('\Aimeos\MShop\Order\Item\Iface', $this->object->getItem($item->getId())); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | |
94 | 94 | public function testGetItemException() |
95 | 95 | { |
96 | - $this->setExpectedException( '\Aimeos\Controller\Frontend\Order\Exception' ); |
|
96 | + $this->setExpectedException('\Aimeos\Controller\Frontend\Order\Exception'); |
|
97 | 97 | $this->object->getItem( -1 ); |
98 | 98 | } |
99 | 99 | |
100 | 100 | |
101 | 101 | public function testSearchItems() |
102 | 102 | { |
103 | - $this->assertGreaterThan( 1, $this->object->searchItems( $this->object->createFilter() ) ); |
|
103 | + $this->assertGreaterThan(1, $this->object->searchItems($this->object->createFilter())); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | |
107 | 107 | public function testStore() |
108 | 108 | { |
109 | 109 | $name = 'ControllerFrontendOrderStore'; |
110 | - $this->context->getConfig()->set( 'mshop/order/manager/name', $name ); |
|
110 | + $this->context->getConfig()->set('mshop/order/manager/name', $name); |
|
111 | 111 | |
112 | 112 | |
113 | - $orderManagerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Order\\Manager\\Standard' ) |
|
114 | - ->setMethods( array( 'saveItem', 'getSubManager' ) ) |
|
115 | - ->setConstructorArgs( array( $this->context ) ) |
|
113 | + $orderManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Standard') |
|
114 | + ->setMethods(array('saveItem', 'getSubManager')) |
|
115 | + ->setConstructorArgs(array($this->context)) |
|
116 | 116 | ->getMock(); |
117 | 117 | |
118 | - $orderBaseManagerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Order\\Manager\\Base\\Standard' ) |
|
119 | - ->setMethods( array( 'store' ) ) |
|
120 | - ->setConstructorArgs( array( $this->context ) ) |
|
118 | + $orderBaseManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Base\\Standard') |
|
119 | + ->setMethods(array('store')) |
|
120 | + ->setConstructorArgs(array($this->context)) |
|
121 | 121 | ->getMock(); |
122 | 122 | |
123 | - \Aimeos\MShop\Order\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Order\\Manager\\' . $name, $orderManagerStub ); |
|
123 | + \Aimeos\MShop\Order\Manager\Factory::injectManager('\\Aimeos\\MShop\\Order\\Manager\\' . $name, $orderManagerStub); |
|
124 | 124 | |
125 | 125 | |
126 | 126 | $orderBaseItem = $orderBaseManagerStub->createItem(); |
127 | - $orderBaseItem->setId( 1 ); |
|
127 | + $orderBaseItem->setId(1); |
|
128 | 128 | |
129 | 129 | |
130 | - $orderBaseManagerStub->expects( $this->once() )->method( 'store' ); |
|
130 | + $orderBaseManagerStub->expects($this->once())->method('store'); |
|
131 | 131 | |
132 | - $orderManagerStub->expects( $this->once() )->method( 'getSubManager' ) |
|
133 | - ->will( $this->returnValue( $orderBaseManagerStub ) ); |
|
132 | + $orderManagerStub->expects($this->once())->method('getSubManager') |
|
133 | + ->will($this->returnValue($orderBaseManagerStub)); |
|
134 | 134 | |
135 | - $orderManagerStub->expects( $this->once() )->method( 'saveItem' ); |
|
135 | + $orderManagerStub->expects($this->once())->method('saveItem'); |
|
136 | 136 | |
137 | 137 | |
138 | - $this->object->store( $orderBaseItem ); |
|
138 | + $this->object->store($orderBaseItem); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | |
142 | 142 | public function testBlock() |
143 | 143 | { |
144 | 144 | $name = 'ControllerFrontendOrderBlock'; |
145 | - $this->context->getConfig()->set( 'controller/common/order/name', $name ); |
|
145 | + $this->context->getConfig()->set('controller/common/order/name', $name); |
|
146 | 146 | |
147 | 147 | |
148 | - $orderCntlStub = $this->getMockBuilder( '\\Aimeos\\Controller\\Common\\Order\\Standard' ) |
|
149 | - ->setMethods( array( 'block' ) ) |
|
150 | - ->setConstructorArgs( array( $this->context ) ) |
|
148 | + $orderCntlStub = $this->getMockBuilder('\\Aimeos\\Controller\\Common\\Order\\Standard') |
|
149 | + ->setMethods(array('block')) |
|
150 | + ->setConstructorArgs(array($this->context)) |
|
151 | 151 | ->getMock(); |
152 | 152 | |
153 | - \Aimeos\Controller\Common\Order\Factory::injectController( '\\Aimeos\\Controller\\Common\\Order\\' . $name, $orderCntlStub ); |
|
153 | + \Aimeos\Controller\Common\Order\Factory::injectController('\\Aimeos\\Controller\\Common\\Order\\' . $name, $orderCntlStub); |
|
154 | 154 | |
155 | - $orderCntlStub->expects( $this->once() )->method( 'block' ); |
|
155 | + $orderCntlStub->expects($this->once())->method('block'); |
|
156 | 156 | |
157 | 157 | |
158 | - $this->object->block( \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem() ); |
|
158 | + $this->object->block(\Aimeos\MShop\Factory::createManager($this->context, 'order')->createItem()); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | |
162 | 162 | public function testUnblock() |
163 | 163 | { |
164 | 164 | $name = 'ControllerFrontendOrderUnblock'; |
165 | - $this->context->getConfig()->set( 'controller/common/order/name', $name ); |
|
165 | + $this->context->getConfig()->set('controller/common/order/name', $name); |
|
166 | 166 | |
167 | 167 | |
168 | - $orderCntlStub = $this->getMockBuilder( '\\Aimeos\\Controller\\Common\\Order\\Standard' ) |
|
169 | - ->setMethods( array( 'unblock' ) ) |
|
170 | - ->setConstructorArgs( array( $this->context ) ) |
|
168 | + $orderCntlStub = $this->getMockBuilder('\\Aimeos\\Controller\\Common\\Order\\Standard') |
|
169 | + ->setMethods(array('unblock')) |
|
170 | + ->setConstructorArgs(array($this->context)) |
|
171 | 171 | ->getMock(); |
172 | 172 | |
173 | - \Aimeos\Controller\Common\Order\Factory::injectController( '\\Aimeos\\Controller\\Common\\Order\\' . $name, $orderCntlStub ); |
|
173 | + \Aimeos\Controller\Common\Order\Factory::injectController('\\Aimeos\\Controller\\Common\\Order\\' . $name, $orderCntlStub); |
|
174 | 174 | |
175 | - $orderCntlStub->expects( $this->once() )->method( 'unblock' ); |
|
175 | + $orderCntlStub->expects($this->once())->method('unblock'); |
|
176 | 176 | |
177 | 177 | |
178 | - $this->object->unblock( \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem() ); |
|
178 | + $this->object->unblock(\Aimeos\MShop\Factory::createManager($this->context, 'order')->createItem()); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | |
182 | 182 | public function testUpdate() |
183 | 183 | { |
184 | 184 | $name = 'ControllerFrontendOrderUpdate'; |
185 | - $this->context->getConfig()->set( 'controller/common/order/name', $name ); |
|
185 | + $this->context->getConfig()->set('controller/common/order/name', $name); |
|
186 | 186 | |
187 | 187 | |
188 | - $orderCntlStub = $this->getMockBuilder( '\\Aimeos\\Controller\\Common\\Order\\Standard' ) |
|
189 | - ->setMethods( array( 'update' ) ) |
|
190 | - ->setConstructorArgs( array( $this->context ) ) |
|
188 | + $orderCntlStub = $this->getMockBuilder('\\Aimeos\\Controller\\Common\\Order\\Standard') |
|
189 | + ->setMethods(array('update')) |
|
190 | + ->setConstructorArgs(array($this->context)) |
|
191 | 191 | ->getMock(); |
192 | 192 | |
193 | - \Aimeos\Controller\Common\Order\Factory::injectController( '\\Aimeos\\Controller\\Common\\Order\\' . $name, $orderCntlStub ); |
|
193 | + \Aimeos\Controller\Common\Order\Factory::injectController('\\Aimeos\\Controller\\Common\\Order\\' . $name, $orderCntlStub); |
|
194 | 194 | |
195 | - $orderCntlStub->expects( $this->once() )->method( 'update' ); |
|
195 | + $orderCntlStub->expects($this->once())->method('update'); |
|
196 | 196 | |
197 | 197 | |
198 | - $this->object->update( \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem() ); |
|
198 | + $this->object->update(\Aimeos\MShop\Factory::createManager($this->context, 'order')->createItem()); |
|
199 | 199 | } |
200 | 200 | } |
@@ -29,11 +29,11 @@ discard block |
||
29 | 29 | * @param string $type Arbitrary order type (max. eight chars) |
30 | 30 | * @return \Aimeos\MShop\Order\Item\Iface Created order object |
31 | 31 | */ |
32 | - public function addItem( $baseId, $type ) |
|
32 | + public function addItem($baseId, $type) |
|
33 | 33 | { |
34 | 34 | $total = 0; |
35 | 35 | $context = $this->getContext(); |
36 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'order' ); |
|
36 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'order'); |
|
37 | 37 | |
38 | 38 | /** controller/frontend/order/limit-seconds |
39 | 39 | * Order limitation time frame in seconds |
@@ -51,24 +51,24 @@ discard block |
||
51 | 51 | * @see controller/frontend/basket/limit-count |
52 | 52 | * @see controller/frontend/basket/limit-seconds |
53 | 53 | */ |
54 | - $seconds = $context->getConfig()->get( 'controller/frontend/order/limit-seconds', 300 ); |
|
54 | + $seconds = $context->getConfig()->get('controller/frontend/order/limit-seconds', 300); |
|
55 | 55 | |
56 | 56 | $search = $manager->createSearch(); |
57 | 57 | $expr = [ |
58 | - $search->compare( '==', 'order.baseid', $baseId ), |
|
59 | - $search->compare( '>=', 'order.ctime', date( 'Y-m-d H:i:s', time() - $seconds ) ), |
|
58 | + $search->compare('==', 'order.baseid', $baseId), |
|
59 | + $search->compare('>=', 'order.ctime', date('Y-m-d H:i:s', time() - $seconds)), |
|
60 | 60 | ]; |
61 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
62 | - $search->setSlice( 0, 0 ); |
|
61 | + $search->setConditions($search->combine('&&', $expr)); |
|
62 | + $search->setSlice(0, 0); |
|
63 | 63 | |
64 | - $manager->searchItems( $search, [], $total ); |
|
64 | + $manager->searchItems($search, [], $total); |
|
65 | 65 | |
66 | - if( $total > 0 ) { |
|
67 | - throw new \Aimeos\Controller\Frontend\Order\Exception( sprintf( 'The order has already been created' ) ); |
|
66 | + if ($total > 0) { |
|
67 | + throw new \Aimeos\Controller\Frontend\Order\Exception(sprintf('The order has already been created')); |
|
68 | 68 | } |
69 | 69 | |
70 | - $item = $manager->createItem()->setBaseId( $baseId )->setType( $type ); |
|
71 | - $manager->saveItem( $item ); |
|
70 | + $item = $manager->createItem()->setBaseId($baseId)->setType($type); |
|
71 | + $manager->saveItem($item); |
|
72 | 72 | |
73 | 73 | return $item; |
74 | 74 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function createFilter() |
83 | 83 | { |
84 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order' )->createSearch( true ); |
|
84 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'order')->createSearch(true); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | |
@@ -92,30 +92,30 @@ discard block |
||
92 | 92 | * @param boolean $default Use default criteria to limit orders |
93 | 93 | * @return \Aimeos\MShop\Order\Item\Iface Order object |
94 | 94 | */ |
95 | - public function getItem( $id, $default = true ) |
|
95 | + public function getItem($id, $default = true) |
|
96 | 96 | { |
97 | 97 | $context = $this->getContext(); |
98 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'order' ); |
|
98 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'order'); |
|
99 | 99 | |
100 | - $search = $manager->createSearch( true ); |
|
100 | + $search = $manager->createSearch(true); |
|
101 | 101 | $expr = [ |
102 | - $search->compare( '==', 'order.id', $id ), |
|
102 | + $search->compare('==', 'order.id', $id), |
|
103 | 103 | $search->getConditions(), |
104 | 104 | ]; |
105 | 105 | |
106 | - if( $default !== false ) { |
|
107 | - $expr[] = $search->compare( '==', 'order.editor', $context->getEditor() ); |
|
106 | + if ($default !== false) { |
|
107 | + $expr[] = $search->compare('==', 'order.editor', $context->getEditor()); |
|
108 | 108 | } |
109 | 109 | |
110 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
110 | + $search->setConditions($search->combine('&&', $expr)); |
|
111 | 111 | |
112 | - $items = $manager->searchItems( $search ); |
|
112 | + $items = $manager->searchItems($search); |
|
113 | 113 | |
114 | - if( ( $item = reset( $items ) ) !== false ) { |
|
114 | + if (($item = reset($items)) !== false) { |
|
115 | 115 | return $item; |
116 | 116 | } |
117 | 117 | |
118 | - throw new \Aimeos\Controller\Frontend\Order\Exception( sprintf( 'No order item for ID "%1$s" found', $id ) ); |
|
118 | + throw new \Aimeos\Controller\Frontend\Order\Exception(sprintf('No order item for ID "%1$s" found', $id)); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | |
@@ -126,18 +126,18 @@ discard block |
||
126 | 126 | * @param integer|null &$total Variable that will contain the total number of available items |
127 | 127 | * @return \Aimeos\MShop\Order\Item\Iface[] Associative list of IDs as keys and order objects as values |
128 | 128 | */ |
129 | - public function searchItems( \Aimeos\MW\Criteria\Iface $filter, &$total = null ) |
|
129 | + public function searchItems(\Aimeos\MW\Criteria\Iface $filter, &$total = null) |
|
130 | 130 | { |
131 | 131 | $context = $this->getContext(); |
132 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'order' ); |
|
132 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'order'); |
|
133 | 133 | |
134 | 134 | $expr = [ |
135 | 135 | $filter->getConditions(), |
136 | - $filter->compare( '==', 'order.base.customerid', $context->getUserId() ), |
|
136 | + $filter->compare('==', 'order.base.customerid', $context->getUserId()), |
|
137 | 137 | ]; |
138 | - $filter->setConditions( $filter->combine( '&&', $expr ) ); |
|
138 | + $filter->setConditions($filter->combine('&&', $expr)); |
|
139 | 139 | |
140 | - return $manager->searchItems( $filter, [], $total ); |
|
140 | + return $manager->searchItems($filter, [], $total); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | |
@@ -159,9 +159,9 @@ discard block |
||
159 | 159 | * |
160 | 160 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
161 | 161 | */ |
162 | - public function block( \Aimeos\MShop\Order\Item\Iface $orderItem ) |
|
162 | + public function block(\Aimeos\MShop\Order\Item\Iface $orderItem) |
|
163 | 163 | { |
164 | - \Aimeos\Controller\Common\Order\Factory::createController( $this->getContext() )->block( $orderItem ); |
|
164 | + \Aimeos\Controller\Common\Order\Factory::createController($this->getContext())->block($orderItem); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | |
@@ -183,9 +183,9 @@ discard block |
||
183 | 183 | * |
184 | 184 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
185 | 185 | */ |
186 | - public function unblock( \Aimeos\MShop\Order\Item\Iface $orderItem ) |
|
186 | + public function unblock(\Aimeos\MShop\Order\Item\Iface $orderItem) |
|
187 | 187 | { |
188 | - \Aimeos\Controller\Common\Order\Factory::createController( $this->getContext() )->unblock( $orderItem ); |
|
188 | + \Aimeos\Controller\Common\Order\Factory::createController($this->getContext())->unblock($orderItem); |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | |
@@ -203,9 +203,9 @@ discard block |
||
203 | 203 | * |
204 | 204 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
205 | 205 | */ |
206 | - public function update( \Aimeos\MShop\Order\Item\Iface $orderItem ) |
|
206 | + public function update(\Aimeos\MShop\Order\Item\Iface $orderItem) |
|
207 | 207 | { |
208 | - \Aimeos\Controller\Common\Order\Factory::createController( $this->getContext() )->update( $orderItem ); |
|
208 | + \Aimeos\Controller\Common\Order\Factory::createController($this->getContext())->update($orderItem); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | |
@@ -220,22 +220,22 @@ discard block |
||
220 | 220 | * @return \Aimeos\MShop\Order\Item\Iface Order item that belongs to the stored basket |
221 | 221 | * @deprecated 2017.04 Use store() from basket controller instead |
222 | 222 | */ |
223 | - public function store( \Aimeos\MShop\Order\Item\Base\Iface $basket ) |
|
223 | + public function store(\Aimeos\MShop\Order\Item\Base\Iface $basket) |
|
224 | 224 | { |
225 | 225 | $context = $this->getContext(); |
226 | 226 | |
227 | - $orderManager = \Aimeos\MShop\Factory::createManager( $context, 'order' ); |
|
228 | - $orderBaseManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base' ); |
|
227 | + $orderManager = \Aimeos\MShop\Factory::createManager($context, 'order'); |
|
228 | + $orderBaseManager = \Aimeos\MShop\Factory::createManager($context, 'order/base'); |
|
229 | 229 | |
230 | 230 | |
231 | 231 | $orderBaseManager->begin(); |
232 | - $orderBaseManager->store( $basket ); |
|
232 | + $orderBaseManager->store($basket); |
|
233 | 233 | $orderBaseManager->commit(); |
234 | 234 | |
235 | 235 | $orderItem = $orderManager->createItem(); |
236 | - $orderItem->setBaseId( $basket->getId() ); |
|
237 | - $orderItem->setType( \Aimeos\MShop\Order\Item\Base::TYPE_WEB ); |
|
238 | - $orderManager->saveItem( $orderItem ); |
|
236 | + $orderItem->setBaseId($basket->getId()); |
|
237 | + $orderItem->setType(\Aimeos\MShop\Order\Item\Base::TYPE_WEB); |
|
238 | + $orderManager->saveItem($orderItem); |
|
239 | 239 | |
240 | 240 | |
241 | 241 | return $orderItem; |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @param string $type Arbitrary order type (max. eight chars) |
28 | 28 | * @return \Aimeos\MShop\Order\Item\Iface Created order object |
29 | 29 | */ |
30 | - public function addItem( $baseId, $type ); |
|
30 | + public function addItem($baseId, $type); |
|
31 | 31 | |
32 | 32 | |
33 | 33 | /** |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @param boolean $default Use default criteria to limit orders |
46 | 46 | * @return \Aimeos\MShop\Order\Item\Iface Order object |
47 | 47 | */ |
48 | - public function getItem( $id, $default = true ); |
|
48 | + public function getItem($id, $default = true); |
|
49 | 49 | |
50 | 50 | |
51 | 51 | /** |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | * @param integer &$total|null Variable that will contain the total number of available items |
56 | 56 | * @return \Aimeos\MShop\Order\Item\Iface[] Associative list of IDs as keys and order objects as values |
57 | 57 | */ |
58 | - public function searchItems( \Aimeos\MW\Criteria\Iface $filter, &$total = null ); |
|
58 | + public function searchItems(\Aimeos\MW\Criteria\Iface $filter, &$total = null); |
|
59 | 59 | |
60 | 60 | |
61 | 61 | /** |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
78 | 78 | * @return void |
79 | 79 | */ |
80 | - public function block( \Aimeos\MShop\Order\Item\Iface $orderItem ); |
|
80 | + public function block(\Aimeos\MShop\Order\Item\Iface $orderItem); |
|
81 | 81 | |
82 | 82 | |
83 | 83 | /** |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
100 | 100 | * @return void |
101 | 101 | */ |
102 | - public function unblock( \Aimeos\MShop\Order\Item\Iface $orderItem ); |
|
102 | + public function unblock(\Aimeos\MShop\Order\Item\Iface $orderItem); |
|
103 | 103 | |
104 | 104 | |
105 | 105 | /** |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
118 | 118 | * @return void |
119 | 119 | */ |
120 | - public function update( \Aimeos\MShop\Order\Item\Iface $orderItem ); |
|
120 | + public function update(\Aimeos\MShop\Order\Item\Iface $orderItem); |
|
121 | 121 | |
122 | 122 | |
123 | 123 | /** |
@@ -131,5 +131,5 @@ discard block |
||
131 | 131 | * @return \Aimeos\MShop\Order\Item\Iface Order item that belongs to the stored basket |
132 | 132 | * @deprecated 2017.04 Use store() from basket controller instead |
133 | 133 | */ |
134 | - public function store( \Aimeos\MShop\Order\Item\Base\Iface $basket ); |
|
134 | + public function store(\Aimeos\MShop\Order\Item\Base\Iface $basket); |
|
135 | 135 | } |
@@ -17,125 +17,125 @@ discard block |
||
17 | 17 | |
18 | 18 | protected function setUp() |
19 | 19 | { |
20 | - \Aimeos\MShop\Factory::setCache( true ); |
|
20 | + \Aimeos\MShop\Factory::setCache(true); |
|
21 | 21 | |
22 | 22 | $this->context = \TestHelperFrontend::getContext(); |
23 | - $this->object = new \Aimeos\Controller\Frontend\Service\Standard( $this->context ); |
|
23 | + $this->object = new \Aimeos\Controller\Frontend\Service\Standard($this->context); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | |
27 | 27 | public static function setUpBeforeClass() |
28 | 28 | { |
29 | - $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
30 | - $orderBaseMgr = $orderManager->getSubManager( 'base' ); |
|
29 | + $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
30 | + $orderBaseMgr = $orderManager->getSubManager('base'); |
|
31 | 31 | self::$basket = $orderBaseMgr->createItem(); |
32 | 32 | } |
33 | 33 | |
34 | 34 | |
35 | 35 | protected function tearDown() |
36 | 36 | { |
37 | - unset( $this->object, $this->context ); |
|
37 | + unset($this->object, $this->context); |
|
38 | 38 | |
39 | - \Aimeos\MShop\Factory::setCache( false ); |
|
39 | + \Aimeos\MShop\Factory::setCache(false); |
|
40 | 40 | \Aimeos\MShop\Factory::clear(); |
41 | 41 | } |
42 | 42 | |
43 | 43 | |
44 | 44 | public function testCheckAttributes() |
45 | 45 | { |
46 | - $attributes = $this->object->checkAttributes( $this->getServiceItem()->getId(), [] ); |
|
47 | - $this->assertEquals( [], $attributes ); |
|
46 | + $attributes = $this->object->checkAttributes($this->getServiceItem()->getId(), []); |
|
47 | + $this->assertEquals([], $attributes); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | |
51 | 51 | public function testGetProviders() |
52 | 52 | { |
53 | - $providers = $this->object->getProviders( 'delivery' ); |
|
54 | - $this->assertGreaterThan( 0, count( $providers ) ); |
|
53 | + $providers = $this->object->getProviders('delivery'); |
|
54 | + $this->assertGreaterThan(0, count($providers)); |
|
55 | 55 | |
56 | - foreach( $providers as $provider ) { |
|
57 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Service\\Provider\\Iface', $provider ); |
|
56 | + foreach ($providers as $provider) { |
|
57 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Service\\Provider\\Iface', $provider); |
|
58 | 58 | } |
59 | 59 | } |
60 | 60 | |
61 | 61 | |
62 | 62 | public function testGetProvider() |
63 | 63 | { |
64 | - $provider = $this->object->getProvider( $this->getServiceItem()->getId() ); |
|
65 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Service\\Provider\\Iface', $provider ); |
|
64 | + $provider = $this->object->getProvider($this->getServiceItem()->getId()); |
|
65 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Service\\Provider\\Iface', $provider); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | |
69 | 69 | public function testProcess() |
70 | 70 | { |
71 | 71 | $form = new \Aimeos\MShop\Common\Item\Helper\Form\Standard(); |
72 | - $item = \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem(); |
|
73 | - $serviceId = \Aimeos\MShop\Factory::createManager( $this->context, 'service' )->findItem( 'unitcode' )->getId(); |
|
72 | + $item = \Aimeos\MShop\Factory::createManager($this->context, 'order')->createItem(); |
|
73 | + $serviceId = \Aimeos\MShop\Factory::createManager($this->context, 'service')->findItem('unitcode')->getId(); |
|
74 | 74 | |
75 | - $provider = $this->getMockBuilder( '\\Aimeos\\MShop\\Service\\Provider\\Delivery\\Standard' ) |
|
75 | + $provider = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Provider\\Delivery\\Standard') |
|
76 | 76 | ->disableOriginalConstructor() |
77 | - ->setMethods( ['process'] ) |
|
77 | + ->setMethods(['process']) |
|
78 | 78 | ->getMock(); |
79 | 79 | |
80 | - $manager = $this->getMockBuilder( '\\Aimeos\\MShop\\Service\\Manager\\Standard' ) |
|
81 | - ->setConstructorArgs( [$this->context] ) |
|
82 | - ->setMethods( ['getProvider'] ) |
|
80 | + $manager = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Manager\\Standard') |
|
81 | + ->setConstructorArgs([$this->context]) |
|
82 | + ->setMethods(['getProvider']) |
|
83 | 83 | ->getMock(); |
84 | 84 | |
85 | - \Aimeos\MShop\Factory::injectManager( $this->context, 'service', $manager ); |
|
85 | + \Aimeos\MShop\Factory::injectManager($this->context, 'service', $manager); |
|
86 | 86 | |
87 | - $provider->expects( $this->once() )->method( 'process' )->will( $this->returnValue( $form ) ); |
|
88 | - $manager->expects( $this->once() )->method( 'getProvider' )->will( $this->returnValue( $provider ) ); |
|
87 | + $provider->expects($this->once())->method('process')->will($this->returnValue($form)); |
|
88 | + $manager->expects($this->once())->method('getProvider')->will($this->returnValue($provider)); |
|
89 | 89 | |
90 | 90 | |
91 | - $result = $this->object->process( $item, $serviceId, [], [] ); |
|
92 | - $this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Helper\Form\Iface', $result ); |
|
91 | + $result = $this->object->process($item, $serviceId, [], []); |
|
92 | + $this->assertInstanceOf('\Aimeos\MShop\Common\Item\Helper\Form\Iface', $result); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | |
96 | 96 | public function testUpdateSync() |
97 | 97 | { |
98 | - $item = \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem(); |
|
98 | + $item = \Aimeos\MShop\Factory::createManager($this->context, 'order')->createItem(); |
|
99 | 99 | |
100 | - $stream = $this->getMockBuilder( 'Psr\Http\Message\StreamInterface' )->getMock(); |
|
101 | - $request = $this->getMockBuilder( '\Psr\Http\Message\ServerRequestInterface' )->getMock(); |
|
102 | - $response = $this->getMockBuilder( '\Aimeos\MW\View\Helper\Response\Iface' ) |
|
100 | + $stream = $this->getMockBuilder('Psr\Http\Message\StreamInterface')->getMock(); |
|
101 | + $request = $this->getMockBuilder('\Psr\Http\Message\ServerRequestInterface')->getMock(); |
|
102 | + $response = $this->getMockBuilder('\Aimeos\MW\View\Helper\Response\Iface') |
|
103 | 103 | ->getMock(); |
104 | 104 | |
105 | - $provider = $this->getMockBuilder( '\\Aimeos\\MShop\\Service\\Provider\\Delivery\\Standard' ) |
|
106 | - ->setMethods( ['updateSync', 'query', 'isImplemented'] ) |
|
105 | + $provider = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Provider\\Delivery\\Standard') |
|
106 | + ->setMethods(['updateSync', 'query', 'isImplemented']) |
|
107 | 107 | ->disableOriginalConstructor() |
108 | 108 | ->getMock(); |
109 | 109 | |
110 | - $manager = $this->getMockBuilder( '\\Aimeos\\MShop\\Service\\Manager\\Standard' ) |
|
111 | - ->setConstructorArgs( array( $this->context ) ) |
|
112 | - ->setMethods( ['getProvider'] ) |
|
110 | + $manager = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Manager\\Standard') |
|
111 | + ->setConstructorArgs(array($this->context)) |
|
112 | + ->setMethods(['getProvider']) |
|
113 | 113 | ->getMock(); |
114 | 114 | |
115 | - \Aimeos\MShop\Factory::injectManager( $this->context, 'service', $manager ); |
|
115 | + \Aimeos\MShop\Factory::injectManager($this->context, 'service', $manager); |
|
116 | 116 | |
117 | 117 | |
118 | - $request->expects( $this->once() )->method( 'getQueryParams' )->will( $this->returnValue( ['code' => 'unitcode'] ) ); |
|
119 | - $response->expects( $this->once() )->method( 'createStreamFromString' )->will( $this->returnValue( $stream ) ); |
|
120 | - $manager->expects( $this->once() )->method( 'getProvider' )->will( $this->returnValue( $provider ) ); |
|
121 | - $provider->expects( $this->once() )->method( 'updateSync' )->will( $this->returnValue( $item ) ); |
|
122 | - $provider->expects( $this->once() )->method( 'isImplemented' )->will( $this->returnValue( true ) ); |
|
123 | - $provider->expects( $this->once() )->method( 'query' ); |
|
118 | + $request->expects($this->once())->method('getQueryParams')->will($this->returnValue(['code' => 'unitcode'])); |
|
119 | + $response->expects($this->once())->method('createStreamFromString')->will($this->returnValue($stream)); |
|
120 | + $manager->expects($this->once())->method('getProvider')->will($this->returnValue($provider)); |
|
121 | + $provider->expects($this->once())->method('updateSync')->will($this->returnValue($item)); |
|
122 | + $provider->expects($this->once())->method('isImplemented')->will($this->returnValue(true)); |
|
123 | + $provider->expects($this->once())->method('query'); |
|
124 | 124 | |
125 | - $this->object->updateSync( $request, $response, [], 'paypalexpress', -1 ); |
|
125 | + $this->object->updateSync($request, $response, [], 'paypalexpress', -1); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | |
129 | 129 | public function testGetServices() |
130 | 130 | { |
131 | - $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
132 | - $basket = $orderManager->getSubManager( 'base' )->createItem(); |
|
131 | + $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
132 | + $basket = $orderManager->getSubManager('base')->createItem(); |
|
133 | 133 | |
134 | - $services = $this->object->getServices( 'delivery', $basket ); |
|
135 | - $this->assertGreaterThan( 0, count( $services ) ); |
|
134 | + $services = $this->object->getServices('delivery', $basket); |
|
135 | + $this->assertGreaterThan(0, count($services)); |
|
136 | 136 | |
137 | - foreach( $services as $service ) { |
|
138 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Service\\Item\\Iface', $service ); |
|
137 | + foreach ($services as $service) { |
|
138 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Service\\Item\\Iface', $service); |
|
139 | 139 | } |
140 | 140 | } |
141 | 141 | |
@@ -143,83 +143,83 @@ discard block |
||
143 | 143 | public function testGetServiceAttributes() |
144 | 144 | { |
145 | 145 | $service = $this->getServiceItem(); |
146 | - $attributes = $this->object->getServiceAttributes( 'delivery', $service->getId(), self::$basket ); |
|
146 | + $attributes = $this->object->getServiceAttributes('delivery', $service->getId(), self::$basket); |
|
147 | 147 | |
148 | - $this->assertEquals( 0, count( $attributes ) ); |
|
148 | + $this->assertEquals(0, count($attributes)); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | |
152 | 152 | public function testGetServiceAttributesCache() |
153 | 153 | { |
154 | - $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
155 | - $basket = $orderManager->getSubManager( 'base' )->createItem(); |
|
154 | + $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
155 | + $basket = $orderManager->getSubManager('base')->createItem(); |
|
156 | 156 | |
157 | - $services = $this->object->getServices( 'delivery', $basket ); |
|
157 | + $services = $this->object->getServices('delivery', $basket); |
|
158 | 158 | |
159 | - if( ( $service = reset( $services ) ) === false ) { |
|
160 | - throw new \RuntimeException( 'No service item found' ); |
|
159 | + if (($service = reset($services)) === false) { |
|
160 | + throw new \RuntimeException('No service item found'); |
|
161 | 161 | } |
162 | 162 | |
163 | - $attributes = $this->object->getServiceAttributes( 'delivery', $service->getId(), self::$basket ); |
|
163 | + $attributes = $this->object->getServiceAttributes('delivery', $service->getId(), self::$basket); |
|
164 | 164 | |
165 | - $this->assertEquals( 0, count( $attributes ) ); |
|
165 | + $this->assertEquals(0, count($attributes)); |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | |
169 | 169 | public function testGetServiceAttributesNoItems() |
170 | 170 | { |
171 | - $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
172 | - $this->object->getServiceAttributes( 'invalid', -1, self::$basket ); |
|
171 | + $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
172 | + $this->object->getServiceAttributes('invalid', -1, self::$basket); |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | |
176 | 176 | public function testGetServicePrice() |
177 | 177 | { |
178 | - $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
179 | - $basket = $orderManager->getSubManager( 'base' )->createItem(); |
|
178 | + $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
179 | + $basket = $orderManager->getSubManager('base')->createItem(); |
|
180 | 180 | |
181 | 181 | $service = $this->getServiceItem(); |
182 | - $price = $this->object->getServicePrice( 'delivery', $service->getId(), $basket ); |
|
182 | + $price = $this->object->getServicePrice('delivery', $service->getId(), $basket); |
|
183 | 183 | |
184 | - $this->assertEquals( '12.95', $price->getValue() ); |
|
185 | - $this->assertEquals( '1.99', $price->getCosts() ); |
|
184 | + $this->assertEquals('12.95', $price->getValue()); |
|
185 | + $this->assertEquals('1.99', $price->getCosts()); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | |
189 | 189 | public function testGetServicePriceCache() |
190 | 190 | { |
191 | - $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
192 | - $basket = $orderManager->getSubManager( 'base' )->createItem(); |
|
191 | + $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
192 | + $basket = $orderManager->getSubManager('base')->createItem(); |
|
193 | 193 | |
194 | - $services = $this->object->getServices( 'delivery', $basket ); |
|
194 | + $services = $this->object->getServices('delivery', $basket); |
|
195 | 195 | |
196 | - if( ( $service = reset( $services ) ) === false ) { |
|
197 | - throw new \RuntimeException( 'No service item found' ); |
|
196 | + if (($service = reset($services)) === false) { |
|
197 | + throw new \RuntimeException('No service item found'); |
|
198 | 198 | } |
199 | 199 | |
200 | - $price = $this->object->getServicePrice( 'delivery', $service->getId(), $basket ); |
|
200 | + $price = $this->object->getServicePrice('delivery', $service->getId(), $basket); |
|
201 | 201 | |
202 | - $this->assertEquals( '12.95', $price->getValue() ); |
|
203 | - $this->assertEquals( '1.99', $price->getCosts() ); |
|
202 | + $this->assertEquals('12.95', $price->getValue()); |
|
203 | + $this->assertEquals('1.99', $price->getCosts()); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | |
207 | 207 | public function testGetServicePriceNoItems() |
208 | 208 | { |
209 | - $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
210 | - $basket = $orderManager->getSubManager( 'base' )->createItem(); |
|
209 | + $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
210 | + $basket = $orderManager->getSubManager('base')->createItem(); |
|
211 | 211 | |
212 | - $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
213 | - $this->object->getServicePrice( 'invalid', -1, $basket ); |
|
212 | + $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
213 | + $this->object->getServicePrice('invalid', -1, $basket); |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | |
217 | 217 | public function testCheckServiceAttributes() |
218 | 218 | { |
219 | 219 | $service = $this->getServiceItem(); |
220 | - $attributes = $this->object->checkServiceAttributes( 'delivery', $service->getId(), [] ); |
|
220 | + $attributes = $this->object->checkServiceAttributes('delivery', $service->getId(), []); |
|
221 | 221 | |
222 | - $this->assertEquals( [], $attributes ); |
|
222 | + $this->assertEquals([], $attributes); |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | */ |
229 | 229 | protected function getServiceItem() |
230 | 230 | { |
231 | - $manager = \Aimeos\MShop\Service\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
232 | - return $manager->findItem( 'unitcode' ); |
|
231 | + $manager = \Aimeos\MShop\Service\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
232 | + return $manager->findItem('unitcode'); |
|
233 | 233 | } |
234 | 234 | } |
@@ -20,161 +20,161 @@ |
||
20 | 20 | { |
21 | 21 | $this->context = \TestHelperFrontend::getContext(); |
22 | 22 | |
23 | - $this->stub = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Service\Standard' ) |
|
23 | + $this->stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Service\Standard') |
|
24 | 24 | ->disableOriginalConstructor() |
25 | 25 | ->getMock(); |
26 | 26 | |
27 | - $this->object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Service\Decorator\Base' ) |
|
28 | - ->setConstructorArgs( [$this->stub, $this->context] ) |
|
27 | + $this->object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Service\Decorator\Base') |
|
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' )->getMock(); |
|
41 | + $stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Iface')->getMock(); |
|
42 | 42 | |
43 | - $this->setExpectedException( '\Aimeos\Controller\Frontend\Exception' ); |
|
43 | + $this->setExpectedException('\Aimeos\Controller\Frontend\Exception'); |
|
44 | 44 | |
45 | - $this->getMockBuilder( '\Aimeos\Controller\Frontend\Service\Decorator\Base' ) |
|
46 | - ->setConstructorArgs( [$stub, $this->context] ) |
|
45 | + $this->getMockBuilder('\Aimeos\Controller\Frontend\Service\Decorator\Base') |
|
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' ) |
|
53 | + $stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Service\Standard') |
|
54 | 54 | ->disableOriginalConstructor() |
55 | - ->setMethods( ['invalid'] ) |
|
55 | + ->setMethods(['invalid']) |
|
56 | 56 | ->getMock(); |
57 | 57 | |
58 | - $object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Service\Decorator\Base' ) |
|
59 | - ->setConstructorArgs( [$stub, $this->context] ) |
|
58 | + $object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Service\Decorator\Base') |
|
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' ) ); |
|
79 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'service'); |
|
80 | + $provider = $manager->getProvider($manager->findItem('unitcode', [], 'service', '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 testUpdateSync() |
110 | 110 | { |
111 | - $response = $this->getMockBuilder( '\Psr\Http\Message\ResponseInterface' )->getMock(); |
|
112 | - $request = $this->getMockBuilder( '\Psr\Http\Message\ServerRequestInterface' )->getMock(); |
|
113 | - $item = \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem(); |
|
111 | + $response = $this->getMockBuilder('\Psr\Http\Message\ResponseInterface')->getMock(); |
|
112 | + $request = $this->getMockBuilder('\Psr\Http\Message\ServerRequestInterface')->getMock(); |
|
113 | + $item = \Aimeos\MShop\Factory::createManager($this->context, 'order')->createItem(); |
|
114 | 114 | |
115 | - $this->stub->expects( $this->once() )->method( 'updateSync' ) |
|
116 | - ->will( $this->returnValue( $item ) ); |
|
115 | + $this->stub->expects($this->once())->method('updateSync') |
|
116 | + ->will($this->returnValue($item)); |
|
117 | 117 | |
118 | - $this->assertInstanceOf( 'Aimeos\MShop\Order\Item\Iface', $this->object->updateSync( $request, $response, [], 'test', -1 ) ); |
|
118 | + $this->assertInstanceOf('Aimeos\MShop\Order\Item\Iface', $this->object->updateSync($request, $response, [], 'test', -1)); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | |
122 | 122 | public function testGetServices() |
123 | 123 | { |
124 | - $basket = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base' )->createItem(); |
|
124 | + $basket = \Aimeos\MShop\Factory::createManager($this->context, 'order/base')->createItem(); |
|
125 | 125 | |
126 | - $this->stub->expects( $this->once() )->method( 'getServices' ) |
|
127 | - ->will( $this->returnValue( [] ) ); |
|
126 | + $this->stub->expects($this->once())->method('getServices') |
|
127 | + ->will($this->returnValue([])); |
|
128 | 128 | |
129 | - $this->assertEquals( [], $this->object->getServices( 'payment', $basket ) ); |
|
129 | + $this->assertEquals([], $this->object->getServices('payment', $basket)); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | |
133 | 133 | public function testGetServiceAttributes() |
134 | 134 | { |
135 | - $basket = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base' )->createItem(); |
|
135 | + $basket = \Aimeos\MShop\Factory::createManager($this->context, 'order/base')->createItem(); |
|
136 | 136 | |
137 | - $this->stub->expects( $this->once() )->method( 'getServiceAttributes' ) |
|
138 | - ->will( $this->returnValue( [] ) ); |
|
137 | + $this->stub->expects($this->once())->method('getServiceAttributes') |
|
138 | + ->will($this->returnValue([])); |
|
139 | 139 | |
140 | - $this->assertEquals( [], $this->object->getServiceAttributes( 'payment', -1, $basket ) ); |
|
140 | + $this->assertEquals([], $this->object->getServiceAttributes('payment', -1, $basket)); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | |
144 | 144 | public function testGetServicePrice() |
145 | 145 | { |
146 | - $priceItem = \Aimeos\MShop\Factory::createManager( $this->context, 'price' )->createItem(); |
|
147 | - $basket = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base' )->createItem(); |
|
146 | + $priceItem = \Aimeos\MShop\Factory::createManager($this->context, 'price')->createItem(); |
|
147 | + $basket = \Aimeos\MShop\Factory::createManager($this->context, 'order/base')->createItem(); |
|
148 | 148 | |
149 | - $this->stub->expects( $this->once() )->method( 'getServicePrice' ) |
|
150 | - ->will( $this->returnValue( $priceItem ) ); |
|
149 | + $this->stub->expects($this->once())->method('getServicePrice') |
|
150 | + ->will($this->returnValue($priceItem)); |
|
151 | 151 | |
152 | - $this->assertInstanceOf( '\Aimeos\MShop\Price\Item\Iface', $this->object->getServicePrice( 'payment', -1, $basket ) ); |
|
152 | + $this->assertInstanceOf('\Aimeos\MShop\Price\Item\Iface', $this->object->getServicePrice('payment', -1, $basket)); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | |
156 | 156 | public function testCheckServiceAttributes() |
157 | 157 | { |
158 | - $this->stub->expects( $this->once() )->method( 'checkServiceAttributes' ) |
|
159 | - ->will( $this->returnValue( [] ) ); |
|
158 | + $this->stub->expects($this->once())->method('checkServiceAttributes') |
|
159 | + ->will($this->returnValue([])); |
|
160 | 160 | |
161 | - $this->assertEquals( [], $this->object->checkServiceAttributes( 'payment', -1, [] ) ); |
|
161 | + $this->assertEquals([], $this->object->checkServiceAttributes('payment', -1, [])); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | |
165 | 165 | public function testGetController() |
166 | 166 | { |
167 | - $result = $this->access( 'getController' )->invokeArgs( $this->object, [] ); |
|
167 | + $result = $this->access('getController')->invokeArgs($this->object, []); |
|
168 | 168 | |
169 | - $this->assertSame( $this->stub, $result ); |
|
169 | + $this->assertSame($this->stub, $result); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | |
173 | - protected function access( $name ) |
|
173 | + protected function access($name) |
|
174 | 174 | { |
175 | - $class = new \ReflectionClass( '\Aimeos\Controller\Frontend\Service\Decorator\Base' ); |
|
176 | - $method = $class->getMethod( $name ); |
|
177 | - $method->setAccessible( true ); |
|
175 | + $class = new \ReflectionClass('\Aimeos\Controller\Frontend\Service\Decorator\Base'); |
|
176 | + $method = $class->getMethod($name); |
|
177 | + $method->setAccessible(true); |
|
178 | 178 | |
179 | 179 | return $method; |
180 | 180 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * @param string[] $attributes List of attribute codes as keys and strings entered by the customer as value |
31 | 31 | * @return string[] List of attributes codes as keys and error messages as values for invalid or missing values |
32 | 32 | */ |
33 | - public function checkAttributes( $serviceId, array $attributes ); |
|
33 | + public function checkAttributes($serviceId, array $attributes); |
|
34 | 34 | |
35 | 35 | /** |
36 | 36 | * Returns the service item for the given ID |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | * @param array $ref List of domains for which the items referenced by the services should be fetched too |
40 | 40 | * @return \Aimeos\MShop\Service\Provider\Iface Service provider object |
41 | 41 | */ |
42 | - public function getProvider( $serviceId, $ref = ['media', 'price', 'text'] ); |
|
42 | + public function getProvider($serviceId, $ref = ['media', 'price', 'text']); |
|
43 | 43 | |
44 | 44 | /** |
45 | 45 | * Returns the service providers for the given type |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * @param array $ref List of domains for which the items referenced by the services should be fetched too |
49 | 49 | * @return \Aimeos\MShop\Service\Provider\Iface[] List of service IDs as keys and service provider objects as values |
50 | 50 | */ |
51 | - public function getProviders( $type = null, $ref = ['media', 'price', 'text'] ); |
|
51 | + public function getProviders($type = null, $ref = ['media', 'price', 'text']); |
|
52 | 52 | |
53 | 53 | /** |
54 | 54 | * Processes the service for the given order, e.g. payment and delivery services |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * @return \Aimeos\MShop\Common\Item\Helper\Form\Iface|null Form object with URL, parameters, etc. |
62 | 62 | * or null if no form data is required |
63 | 63 | */ |
64 | - public function process( \Aimeos\MShop\Order\Item\Iface $orderItem, $serviceId, array $urls, array $params ); |
|
64 | + public function process(\Aimeos\MShop\Order\Item\Iface $orderItem, $serviceId, array $urls, array $params); |
|
65 | 65 | |
66 | 66 | /** |
67 | 67 | * Updates the payment or delivery status for the given request |
@@ -74,5 +74,5 @@ discard block |
||
74 | 74 | * @param string $orderid Unique ID of the order whose payment status should be updated |
75 | 75 | * @return \Aimeos\MShop\Order\Item\Iface $orderItem Order item that has been updated |
76 | 76 | */ |
77 | - public function updateSync( ServerRequestInterface $request, ResponseInterface $response, array $urls, $code, $orderid ); |
|
77 | + public function updateSync(ServerRequestInterface $request, ResponseInterface $response, array $urls, $code, $orderid); |
|
78 | 78 | } |