@@ -18,184 +18,184 @@ |
||
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' ) |
|
47 | - ->will( $this->returnValue( $manager->createItem() ) ); |
|
46 | + $manager->expects($this->once())->method('saveItem') |
|
47 | + ->will($this->returnValue($manager->createItem())); |
|
48 | 48 | |
49 | - $this->assertInstanceOf( '\Aimeos\MShop\Order\Item\Iface', $this->object->addItem( -1, 'test' ) ); |
|
49 | + $this->assertInstanceOf('\Aimeos\MShop\Order\Item\Iface', $this->object->addItem( -1, 'test' )); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | |
53 | 53 | public function testAddItemLimit() |
54 | 54 | { |
55 | - $this->context->getConfig()->set( 'controller/frontend/order/limit-seconds', 86400 * 365 ); |
|
55 | + $this->context->getConfig()->set('controller/frontend/order/limit-seconds', 86400 * 365); |
|
56 | 56 | |
57 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base' ); |
|
58 | - $result = $manager->searchItems( $manager->createSearch()->setSlice( 0, 1 ) ); |
|
57 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'order/base'); |
|
58 | + $result = $manager->searchItems($manager->createSearch()->setSlice(0, 1)); |
|
59 | 59 | |
60 | - if( ( $item = reset( $result ) ) === false ) { |
|
61 | - throw new \RuntimeException( 'No order item found' ); |
|
60 | + if (($item = reset($result)) === false) { |
|
61 | + throw new \RuntimeException('No order item found'); |
|
62 | 62 | } |
63 | 63 | |
64 | - $this->setExpectedException( '\Aimeos\Controller\Frontend\Order\Exception' ); |
|
65 | - $this->object->addItem( $item->getId(), 'test' ); |
|
64 | + $this->setExpectedException('\Aimeos\Controller\Frontend\Order\Exception'); |
|
65 | + $this->object->addItem($item->getId(), 'test'); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | |
69 | 69 | public function testCreateFilter() |
70 | 70 | { |
71 | - $this->assertInstanceOf( '\Aimeos\MW\Criteria\Iface', $this->object->createFilter() ); |
|
71 | + $this->assertInstanceOf('\Aimeos\MW\Criteria\Iface', $this->object->createFilter()); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | |
75 | 75 | public function testGetItem() |
76 | 76 | { |
77 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' ); |
|
78 | - $customerItem = $manager->findItem( 'UTC001' ); |
|
77 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'customer'); |
|
78 | + $customerItem = $manager->findItem('UTC001'); |
|
79 | 79 | |
80 | - $this->context->setEditor( 'core:unittest' ); |
|
80 | + $this->context->setEditor('core:unittest'); |
|
81 | 81 | |
82 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'order' ); |
|
83 | - $search = $manager->createSearch()->setSlice( 0, 1 ); |
|
84 | - $search->setConditions( $search->compare( '==', 'order.base.customerid', $customerItem->getId() ) ); |
|
85 | - $result = $manager->searchItems( $search ); |
|
82 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'order'); |
|
83 | + $search = $manager->createSearch()->setSlice(0, 1); |
|
84 | + $search->setConditions($search->compare('==', 'order.base.customerid', $customerItem->getId())); |
|
85 | + $result = $manager->searchItems($search); |
|
86 | 86 | |
87 | - if( ( $item = reset( $result ) ) === false ) { |
|
88 | - throw new \RuntimeException( 'No order item found' ); |
|
87 | + if (($item = reset($result)) === false) { |
|
88 | + throw new \RuntimeException('No order item found'); |
|
89 | 89 | } |
90 | 90 | |
91 | - $this->assertInstanceOf( '\Aimeos\MShop\Order\Item\Iface', $this->object->getItem( $item->getId() ) ); |
|
91 | + $this->assertInstanceOf('\Aimeos\MShop\Order\Item\Iface', $this->object->getItem($item->getId())); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | |
95 | 95 | public function testGetItemException() |
96 | 96 | { |
97 | - $this->setExpectedException( '\Aimeos\Controller\Frontend\Order\Exception' ); |
|
97 | + $this->setExpectedException('\Aimeos\Controller\Frontend\Order\Exception'); |
|
98 | 98 | $this->object->getItem( -1 ); |
99 | 99 | } |
100 | 100 | |
101 | 101 | |
102 | 102 | public function testSearchItems() |
103 | 103 | { |
104 | - $this->assertGreaterThan( 1, $this->object->searchItems( $this->object->createFilter() ) ); |
|
104 | + $this->assertGreaterThan(1, $this->object->searchItems($this->object->createFilter())); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | |
108 | 108 | public function testStore() |
109 | 109 | { |
110 | 110 | $name = 'ControllerFrontendOrderStore'; |
111 | - $this->context->getConfig()->set( 'mshop/order/manager/name', $name ); |
|
111 | + $this->context->getConfig()->set('mshop/order/manager/name', $name); |
|
112 | 112 | |
113 | 113 | |
114 | - $orderManagerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Order\\Manager\\Standard' ) |
|
115 | - ->setMethods( array( 'saveItem', 'getSubManager' ) ) |
|
116 | - ->setConstructorArgs( array( $this->context ) ) |
|
114 | + $orderManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Standard') |
|
115 | + ->setMethods(array('saveItem', 'getSubManager')) |
|
116 | + ->setConstructorArgs(array($this->context)) |
|
117 | 117 | ->getMock(); |
118 | 118 | |
119 | - $orderBaseManagerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Order\\Manager\\Base\\Standard' ) |
|
120 | - ->setMethods( array( 'store' ) ) |
|
121 | - ->setConstructorArgs( array( $this->context ) ) |
|
119 | + $orderBaseManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Base\\Standard') |
|
120 | + ->setMethods(array('store')) |
|
121 | + ->setConstructorArgs(array($this->context)) |
|
122 | 122 | ->getMock(); |
123 | 123 | |
124 | - \Aimeos\MShop\Order\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Order\\Manager\\' . $name, $orderManagerStub ); |
|
124 | + \Aimeos\MShop\Order\Manager\Factory::injectManager('\\Aimeos\\MShop\\Order\\Manager\\' . $name, $orderManagerStub); |
|
125 | 125 | |
126 | 126 | |
127 | 127 | $orderBaseItem = $orderBaseManagerStub->createItem(); |
128 | - $orderBaseItem->setId( 1 ); |
|
128 | + $orderBaseItem->setId(1); |
|
129 | 129 | |
130 | 130 | |
131 | - $orderBaseManagerStub->expects( $this->once() )->method( 'store' ); |
|
131 | + $orderBaseManagerStub->expects($this->once())->method('store'); |
|
132 | 132 | |
133 | - $orderManagerStub->expects( $this->once() )->method( 'getSubManager' ) |
|
134 | - ->will( $this->returnValue( $orderBaseManagerStub ) ); |
|
133 | + $orderManagerStub->expects($this->once())->method('getSubManager') |
|
134 | + ->will($this->returnValue($orderBaseManagerStub)); |
|
135 | 135 | |
136 | - $orderManagerStub->expects( $this->once() )->method( 'saveItem' ); |
|
136 | + $orderManagerStub->expects($this->once())->method('saveItem'); |
|
137 | 137 | |
138 | 138 | |
139 | - $this->object->store( $orderBaseItem ); |
|
139 | + $this->object->store($orderBaseItem); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | |
143 | 143 | public function testBlock() |
144 | 144 | { |
145 | 145 | $name = 'ControllerFrontendOrderBlock'; |
146 | - $this->context->getConfig()->set( 'controller/common/order/name', $name ); |
|
146 | + $this->context->getConfig()->set('controller/common/order/name', $name); |
|
147 | 147 | |
148 | 148 | |
149 | - $orderCntlStub = $this->getMockBuilder( '\\Aimeos\\Controller\\Common\\Order\\Standard' ) |
|
150 | - ->setMethods( array( 'block' ) ) |
|
151 | - ->setConstructorArgs( array( $this->context ) ) |
|
149 | + $orderCntlStub = $this->getMockBuilder('\\Aimeos\\Controller\\Common\\Order\\Standard') |
|
150 | + ->setMethods(array('block')) |
|
151 | + ->setConstructorArgs(array($this->context)) |
|
152 | 152 | ->getMock(); |
153 | 153 | |
154 | - \Aimeos\Controller\Common\Order\Factory::injectController( '\\Aimeos\\Controller\\Common\\Order\\' . $name, $orderCntlStub ); |
|
154 | + \Aimeos\Controller\Common\Order\Factory::injectController('\\Aimeos\\Controller\\Common\\Order\\' . $name, $orderCntlStub); |
|
155 | 155 | |
156 | - $orderCntlStub->expects( $this->once() )->method( 'block' ); |
|
156 | + $orderCntlStub->expects($this->once())->method('block'); |
|
157 | 157 | |
158 | 158 | |
159 | - $this->object->block( \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem() ); |
|
159 | + $this->object->block(\Aimeos\MShop\Factory::createManager($this->context, 'order')->createItem()); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | |
163 | 163 | public function testUnblock() |
164 | 164 | { |
165 | 165 | $name = 'ControllerFrontendOrderUnblock'; |
166 | - $this->context->getConfig()->set( 'controller/common/order/name', $name ); |
|
166 | + $this->context->getConfig()->set('controller/common/order/name', $name); |
|
167 | 167 | |
168 | 168 | |
169 | - $orderCntlStub = $this->getMockBuilder( '\\Aimeos\\Controller\\Common\\Order\\Standard' ) |
|
170 | - ->setMethods( array( 'unblock' ) ) |
|
171 | - ->setConstructorArgs( array( $this->context ) ) |
|
169 | + $orderCntlStub = $this->getMockBuilder('\\Aimeos\\Controller\\Common\\Order\\Standard') |
|
170 | + ->setMethods(array('unblock')) |
|
171 | + ->setConstructorArgs(array($this->context)) |
|
172 | 172 | ->getMock(); |
173 | 173 | |
174 | - \Aimeos\Controller\Common\Order\Factory::injectController( '\\Aimeos\\Controller\\Common\\Order\\' . $name, $orderCntlStub ); |
|
174 | + \Aimeos\Controller\Common\Order\Factory::injectController('\\Aimeos\\Controller\\Common\\Order\\' . $name, $orderCntlStub); |
|
175 | 175 | |
176 | - $orderCntlStub->expects( $this->once() )->method( 'unblock' ); |
|
176 | + $orderCntlStub->expects($this->once())->method('unblock'); |
|
177 | 177 | |
178 | 178 | |
179 | - $this->object->unblock( \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem() ); |
|
179 | + $this->object->unblock(\Aimeos\MShop\Factory::createManager($this->context, 'order')->createItem()); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | |
183 | 183 | public function testUpdate() |
184 | 184 | { |
185 | 185 | $name = 'ControllerFrontendOrderUpdate'; |
186 | - $this->context->getConfig()->set( 'controller/common/order/name', $name ); |
|
186 | + $this->context->getConfig()->set('controller/common/order/name', $name); |
|
187 | 187 | |
188 | 188 | |
189 | - $orderCntlStub = $this->getMockBuilder( '\\Aimeos\\Controller\\Common\\Order\\Standard' ) |
|
190 | - ->setMethods( array( 'update' ) ) |
|
191 | - ->setConstructorArgs( array( $this->context ) ) |
|
189 | + $orderCntlStub = $this->getMockBuilder('\\Aimeos\\Controller\\Common\\Order\\Standard') |
|
190 | + ->setMethods(array('update')) |
|
191 | + ->setConstructorArgs(array($this->context)) |
|
192 | 192 | ->getMock(); |
193 | 193 | |
194 | - \Aimeos\Controller\Common\Order\Factory::injectController( '\\Aimeos\\Controller\\Common\\Order\\' . $name, $orderCntlStub ); |
|
194 | + \Aimeos\Controller\Common\Order\Factory::injectController('\\Aimeos\\Controller\\Common\\Order\\' . $name, $orderCntlStub); |
|
195 | 195 | |
196 | - $orderCntlStub->expects( $this->once() )->method( 'update' ); |
|
196 | + $orderCntlStub->expects($this->once())->method('update'); |
|
197 | 197 | |
198 | 198 | |
199 | - $this->object->update( \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem() ); |
|
199 | + $this->object->update(\Aimeos\MShop\Factory::createManager($this->context, 'order')->createItem()); |
|
200 | 200 | } |
201 | 201 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item |
27 | 27 | * @since 2017.04 |
28 | 28 | */ |
29 | - public function addItem( array $values ); |
|
29 | + public function addItem(array $values); |
|
30 | 30 | |
31 | 31 | |
32 | 32 | /** |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item |
36 | 36 | * @since 2017.04 |
37 | 37 | */ |
38 | - public function createItem( array $values = [] ); |
|
38 | + public function createItem(array $values = []); |
|
39 | 39 | |
40 | 40 | |
41 | 41 | /** |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * @param string $id Unique customer ID |
45 | 45 | * @since 2017.04 |
46 | 46 | */ |
47 | - public function deleteItem( $id ); |
|
47 | + public function deleteItem($id); |
|
48 | 48 | |
49 | 49 | |
50 | 50 | /** |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item |
56 | 56 | * @since 2017.04 |
57 | 57 | */ |
58 | - public function editItem( $id, array $values ); |
|
58 | + public function editItem($id, array $values); |
|
59 | 59 | |
60 | 60 | |
61 | 61 | /** |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item including the referenced domains items |
67 | 67 | * @since 2017.04 |
68 | 68 | */ |
69 | - public function getItem( $id = null, array $domains = [] ); |
|
69 | + public function getItem($id = null, array $domains = []); |
|
70 | 70 | |
71 | 71 | |
72 | 72 | /** |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item including the referenced domains items |
80 | 80 | * @since 2017.04 |
81 | 81 | */ |
82 | - public function findItem( $code, array $domains = [] ); |
|
82 | + public function findItem($code, array $domains = []); |
|
83 | 83 | |
84 | 84 | |
85 | 85 | /** |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item including the generated ID |
90 | 90 | * @since 2017.04 |
91 | 91 | */ |
92 | - public function saveItem( \Aimeos\MShop\Customer\Item\Iface $item ); |
|
92 | + public function saveItem(\Aimeos\MShop\Customer\Item\Iface $item); |
|
93 | 93 | |
94 | 94 | |
95 | 95 | /** |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * @return \Aimeos\MShop\Customer\Item\Iface Customer address item |
100 | 100 | * @since 2017.04 |
101 | 101 | */ |
102 | - public function addAddressItem( array $values ); |
|
102 | + public function addAddressItem(array $values); |
|
103 | 103 | |
104 | 104 | |
105 | 105 | /** |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
109 | 109 | * @since 2017.04 |
110 | 110 | */ |
111 | - public function createAddressItem( array $values = [] ); |
|
111 | + public function createAddressItem(array $values = []); |
|
112 | 112 | |
113 | 113 | |
114 | 114 | /** |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * @param string $id Unique customer address ID |
118 | 118 | * @since 2017.04 |
119 | 119 | */ |
120 | - public function deleteAddressItem( $id ); |
|
120 | + public function deleteAddressItem($id); |
|
121 | 121 | |
122 | 122 | |
123 | 123 | /** |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * @return \Aimeos\MShop\Customer\Item\Iface Customer address item |
129 | 129 | * @since 2017.04 |
130 | 130 | */ |
131 | - public function editAddressItem( $id, array $values ); |
|
131 | + public function editAddressItem($id, array $values); |
|
132 | 132 | |
133 | 133 | |
134 | 134 | /** |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
139 | 139 | * @since 2017.04 |
140 | 140 | */ |
141 | - public function getAddressItem( $id ); |
|
141 | + public function getAddressItem($id); |
|
142 | 142 | |
143 | 143 | |
144 | 144 | /** |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item including the generated ID |
149 | 149 | * @since 2017.04 |
150 | 150 | */ |
151 | - public function saveAddressItem( \Aimeos\MShop\Customer\Item\Address\Iface $item ); |
|
151 | + public function saveAddressItem(\Aimeos\MShop\Customer\Item\Address\Iface $item); |
|
152 | 152 | |
153 | 153 | /** |
154 | 154 | * Creates and returns a new list item object |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * @return \Aimeos\MShop\Common\Item\Lists\Iface Customer lists item |
158 | 158 | * @since 2017.06 |
159 | 159 | */ |
160 | - public function addListItem( array $values ); |
|
160 | + public function addListItem(array $values); |
|
161 | 161 | |
162 | 162 | /** |
163 | 163 | * Returns a new customer lists filter criteria object |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | * @param string $id Unique customer address ID |
174 | 174 | * @since 2017.06 |
175 | 175 | */ |
176 | - public function deleteListItem( $id ); |
|
176 | + public function deleteListItem($id); |
|
177 | 177 | |
178 | 178 | /** |
179 | 179 | * Saves a modified customer lists item object |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | * @return \Aimeos\MShop\Common\Item\Lists\Iface Customer lists item |
184 | 184 | * @since 2017.06 |
185 | 185 | */ |
186 | - public function editListItem( $id, array $values ); |
|
186 | + public function editListItem($id, array $values); |
|
187 | 187 | |
188 | 188 | /** |
189 | 189 | * Returns the customer item for the given customer ID |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
193 | 193 | * @since 2017.06 |
194 | 194 | */ |
195 | - public function getListItem( $id ); |
|
195 | + public function getListItem($id); |
|
196 | 196 | |
197 | 197 | /** |
198 | 198 | * Returns the customer lists items filtered by the given criteria |
@@ -202,5 +202,5 @@ discard block |
||
202 | 202 | * @return \Aimeos\MShop\Common\Item\Lists\Iface[] Customer list items |
203 | 203 | * @since 2017.06 |
204 | 204 | */ |
205 | - public function searchListItems( \Aimeos\MW\Criteria\Iface $filter, &$total = null ); |
|
205 | + public function searchListItems(\Aimeos\MW\Criteria\Iface $filter, &$total = null); |
|
206 | 206 | } |
@@ -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 | - return $manager->saveItem( $item ); |
|
70 | + $item = $manager->createItem()->setBaseId($baseId)->setType($type); |
|
71 | + return $manager->saveItem($item); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function createFilter() |
81 | 81 | { |
82 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order' )->createSearch( true ); |
|
82 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'order')->createSearch(true); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | |
@@ -90,30 +90,30 @@ discard block |
||
90 | 90 | * @param boolean $default Use default criteria to limit orders |
91 | 91 | * @return \Aimeos\MShop\Order\Item\Iface Order object |
92 | 92 | */ |
93 | - public function getItem( $id, $default = true ) |
|
93 | + public function getItem($id, $default = true) |
|
94 | 94 | { |
95 | 95 | $context = $this->getContext(); |
96 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'order' ); |
|
96 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'order'); |
|
97 | 97 | |
98 | - $search = $manager->createSearch( true ); |
|
98 | + $search = $manager->createSearch(true); |
|
99 | 99 | $expr = [ |
100 | - $search->compare( '==', 'order.id', $id ), |
|
100 | + $search->compare('==', 'order.id', $id), |
|
101 | 101 | $search->getConditions(), |
102 | 102 | ]; |
103 | 103 | |
104 | - if( $default !== false ) { |
|
105 | - $expr[] = $search->compare( '==', 'order.editor', $context->getEditor() ); |
|
104 | + if ($default !== false) { |
|
105 | + $expr[] = $search->compare('==', 'order.editor', $context->getEditor()); |
|
106 | 106 | } |
107 | 107 | |
108 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
108 | + $search->setConditions($search->combine('&&', $expr)); |
|
109 | 109 | |
110 | - $items = $manager->searchItems( $search ); |
|
110 | + $items = $manager->searchItems($search); |
|
111 | 111 | |
112 | - if( ( $item = reset( $items ) ) !== false ) { |
|
112 | + if (($item = reset($items)) !== false) { |
|
113 | 113 | return $item; |
114 | 114 | } |
115 | 115 | |
116 | - throw new \Aimeos\Controller\Frontend\Order\Exception( sprintf( 'No order item for ID "%1$s" found', $id ) ); |
|
116 | + throw new \Aimeos\Controller\Frontend\Order\Exception(sprintf('No order item for ID "%1$s" found', $id)); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | |
@@ -124,18 +124,18 @@ discard block |
||
124 | 124 | * @param integer|null &$total Variable that will contain the total number of available items |
125 | 125 | * @return \Aimeos\MShop\Order\Item\Iface[] Associative list of IDs as keys and order 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, 'order' ); |
|
130 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'order'); |
|
131 | 131 | |
132 | 132 | $expr = [ |
133 | 133 | $filter->getConditions(), |
134 | - $filter->compare( '==', 'order.base.customerid', $context->getUserId() ), |
|
134 | + $filter->compare('==', 'order.base.customerid', $context->getUserId()), |
|
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 | |
141 | 141 | |
@@ -157,9 +157,9 @@ discard block |
||
157 | 157 | * |
158 | 158 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
159 | 159 | */ |
160 | - public function block( \Aimeos\MShop\Order\Item\Iface $orderItem ) |
|
160 | + public function block(\Aimeos\MShop\Order\Item\Iface $orderItem) |
|
161 | 161 | { |
162 | - \Aimeos\Controller\Common\Order\Factory::createController( $this->getContext() )->block( $orderItem ); |
|
162 | + \Aimeos\Controller\Common\Order\Factory::createController($this->getContext())->block($orderItem); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | |
@@ -181,9 +181,9 @@ discard block |
||
181 | 181 | * |
182 | 182 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
183 | 183 | */ |
184 | - public function unblock( \Aimeos\MShop\Order\Item\Iface $orderItem ) |
|
184 | + public function unblock(\Aimeos\MShop\Order\Item\Iface $orderItem) |
|
185 | 185 | { |
186 | - \Aimeos\Controller\Common\Order\Factory::createController( $this->getContext() )->unblock( $orderItem ); |
|
186 | + \Aimeos\Controller\Common\Order\Factory::createController($this->getContext())->unblock($orderItem); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | |
@@ -201,9 +201,9 @@ discard block |
||
201 | 201 | * |
202 | 202 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
203 | 203 | */ |
204 | - public function update( \Aimeos\MShop\Order\Item\Iface $orderItem ) |
|
204 | + public function update(\Aimeos\MShop\Order\Item\Iface $orderItem) |
|
205 | 205 | { |
206 | - \Aimeos\Controller\Common\Order\Factory::createController( $this->getContext() )->update( $orderItem ); |
|
206 | + \Aimeos\Controller\Common\Order\Factory::createController($this->getContext())->update($orderItem); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | |
@@ -218,22 +218,22 @@ discard block |
||
218 | 218 | * @return \Aimeos\MShop\Order\Item\Iface Order item that belongs to the stored basket |
219 | 219 | * @deprecated 2017.04 Use store() from basket controller instead |
220 | 220 | */ |
221 | - public function store( \Aimeos\MShop\Order\Item\Base\Iface $basket ) |
|
221 | + public function store(\Aimeos\MShop\Order\Item\Base\Iface $basket) |
|
222 | 222 | { |
223 | 223 | $context = $this->getContext(); |
224 | 224 | |
225 | - $orderManager = \Aimeos\MShop\Factory::createManager( $context, 'order' ); |
|
226 | - $orderBaseManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base' ); |
|
225 | + $orderManager = \Aimeos\MShop\Factory::createManager($context, 'order'); |
|
226 | + $orderBaseManager = \Aimeos\MShop\Factory::createManager($context, 'order/base'); |
|
227 | 227 | |
228 | 228 | |
229 | 229 | $orderBaseManager->begin(); |
230 | - $orderBaseManager->store( $basket ); |
|
230 | + $orderBaseManager->store($basket); |
|
231 | 231 | $orderBaseManager->commit(); |
232 | 232 | |
233 | 233 | $orderItem = $orderManager->createItem(); |
234 | - $orderItem->setBaseId( $basket->getId() ); |
|
235 | - $orderItem->setType( \Aimeos\MShop\Order\Item\Base::TYPE_WEB ); |
|
234 | + $orderItem->setBaseId($basket->getId()); |
|
235 | + $orderItem->setType(\Aimeos\MShop\Order\Item\Base::TYPE_WEB); |
|
236 | 236 | |
237 | - return $orderManager->saveItem( $orderItem ); |
|
237 | + return $orderManager->saveItem($orderItem); |
|
238 | 238 | } |
239 | 239 | } |
@@ -15,15 +15,15 @@ discard block |
||
15 | 15 | public static function bootstrap() |
16 | 16 | { |
17 | 17 | self::getAimeos(); |
18 | - \Aimeos\MShop\Factory::setCache( false ); |
|
19 | - \Aimeos\Controller\Frontend\Factory::setCache( false ); |
|
18 | + \Aimeos\MShop\Factory::setCache(false); |
|
19 | + \Aimeos\Controller\Frontend\Factory::setCache(false); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | |
23 | - public static function getContext( $site = 'unittest' ) |
|
23 | + public static function getContext($site = 'unittest') |
|
24 | 24 | { |
25 | - if( !isset( self::$context[$site] ) ) { |
|
26 | - self::$context[$site] = self::createContext( $site ); |
|
25 | + if (!isset(self::$context[$site])) { |
|
26 | + self::$context[$site] = self::createContext($site); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | return clone self::$context[$site]; |
@@ -32,13 +32,13 @@ discard block |
||
32 | 32 | |
33 | 33 | private static function getAimeos() |
34 | 34 | { |
35 | - if( !isset( self::$aimeos ) ) |
|
35 | + if (!isset(self::$aimeos)) |
|
36 | 36 | { |
37 | 37 | require_once 'Bootstrap.php'; |
38 | - spl_autoload_register( 'Aimeos\\Bootstrap::autoload' ); |
|
38 | + spl_autoload_register('Aimeos\\Bootstrap::autoload'); |
|
39 | 39 | |
40 | - $extdir = dirname( dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) ); |
|
41 | - self::$aimeos = new \Aimeos\Bootstrap( array( $extdir ), true ); |
|
40 | + $extdir = dirname(dirname(dirname(dirname(dirname(__FILE__))))); |
|
41 | + self::$aimeos = new \Aimeos\Bootstrap(array($extdir), true); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | return self::$aimeos; |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | /** |
49 | 49 | * @param string $site |
50 | 50 | */ |
51 | - private static function createContext( $site ) |
|
51 | + private static function createContext($site) |
|
52 | 52 | { |
53 | 53 | $ctx = new \Aimeos\MShop\Context\Item\Standard(); |
54 | 54 | $aimeos = self::getAimeos(); |
@@ -58,38 +58,38 @@ discard block |
||
58 | 58 | $paths[] = __DIR__ . DIRECTORY_SEPARATOR . 'config'; |
59 | 59 | $file = __DIR__ . DIRECTORY_SEPARATOR . 'confdoc.ser'; |
60 | 60 | |
61 | - $conf = new \Aimeos\MW\Config\PHPArray( [], $paths ); |
|
62 | - $conf = new \Aimeos\MW\Config\Decorator\Memory( $conf ); |
|
63 | - $conf = new \Aimeos\MW\Config\Decorator\Documentor( $conf, $file ); |
|
64 | - $ctx->setConfig( $conf ); |
|
61 | + $conf = new \Aimeos\MW\Config\PHPArray([], $paths); |
|
62 | + $conf = new \Aimeos\MW\Config\Decorator\Memory($conf); |
|
63 | + $conf = new \Aimeos\MW\Config\Decorator\Documentor($conf, $file); |
|
64 | + $ctx->setConfig($conf); |
|
65 | 65 | |
66 | 66 | |
67 | - $dbm = new \Aimeos\MW\DB\Manager\PDO( $conf ); |
|
68 | - $ctx->setDatabaseManager( $dbm ); |
|
67 | + $dbm = new \Aimeos\MW\DB\Manager\PDO($conf); |
|
68 | + $ctx->setDatabaseManager($dbm); |
|
69 | 69 | |
70 | 70 | |
71 | - $mq = new \Aimeos\MW\MQueue\Manager\Standard( $conf ); |
|
72 | - $ctx->setMessageQueueManager( $mq ); |
|
71 | + $mq = new \Aimeos\MW\MQueue\Manager\Standard($conf); |
|
72 | + $ctx->setMessageQueueManager($mq); |
|
73 | 73 | |
74 | 74 | |
75 | - $logger = new \Aimeos\MW\Logger\File( 'unittest.log', \Aimeos\MW\Logger\Base::DEBUG ); |
|
76 | - $ctx->setLogger( $logger ); |
|
75 | + $logger = new \Aimeos\MW\Logger\File('unittest.log', \Aimeos\MW\Logger\Base::DEBUG); |
|
76 | + $ctx->setLogger($logger); |
|
77 | 77 | |
78 | 78 | |
79 | - $i18n = new \Aimeos\MW\Translation\None( 'de' ); |
|
80 | - $ctx->setI18n( array( 'de' => $i18n ) ); |
|
79 | + $i18n = new \Aimeos\MW\Translation\None('de'); |
|
80 | + $ctx->setI18n(array('de' => $i18n)); |
|
81 | 81 | |
82 | 82 | |
83 | 83 | $session = new \Aimeos\MW\Session\None(); |
84 | - $ctx->setSession( $session ); |
|
84 | + $ctx->setSession($session); |
|
85 | 85 | |
86 | 86 | |
87 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $ctx ); |
|
88 | - $locale = $localeManager->bootstrap( $site, '', '', false ); |
|
89 | - $ctx->setLocale( $locale ); |
|
87 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($ctx); |
|
88 | + $locale = $localeManager->bootstrap($site, '', '', false); |
|
89 | + $ctx->setLocale($locale); |
|
90 | 90 | |
91 | 91 | |
92 | - $ctx->setEditor( 'core:controller/frontend' ); |
|
92 | + $ctx->setEditor('core:controller/frontend'); |
|
93 | 93 | |
94 | 94 | return $ctx; |
95 | 95 | } |
@@ -39,8 +39,7 @@ |
||
39 | 39 | try |
40 | 40 | { |
41 | 41 | $item = $manager->findItem( $values['customer.code'] ); |
42 | - } |
|
43 | - catch( \Aimeos\MShop\Exception $e ) |
|
42 | + } catch( \Aimeos\MShop\Exception $e ) |
|
44 | 43 | { |
45 | 44 | $this->checkLimit( $values ); |
46 | 45 |
@@ -28,28 +28,28 @@ discard block |
||
28 | 28 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item |
29 | 29 | * @since 2017.04 |
30 | 30 | */ |
31 | - public function addItem( array $values ) |
|
31 | + public function addItem(array $values) |
|
32 | 32 | { |
33 | 33 | $context = $this->getContext(); |
34 | 34 | $config = $context->getConfig(); |
35 | 35 | |
36 | 36 | // Show only generated passwords in account creation e-mails |
37 | - $pass = ( isset( $values['customer.password'] ) ? false : true ); |
|
37 | + $pass = (isset($values['customer.password']) ? false : true); |
|
38 | 38 | |
39 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' ); |
|
40 | - $values = $this->addItemDefaults( $values ); |
|
39 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer'); |
|
40 | + $values = $this->addItemDefaults($values); |
|
41 | 41 | |
42 | 42 | try |
43 | 43 | { |
44 | - $item = $manager->findItem( $values['customer.code'] ); |
|
44 | + $item = $manager->findItem($values['customer.code']); |
|
45 | 45 | } |
46 | - catch( \Aimeos\MShop\Exception $e ) |
|
46 | + catch (\Aimeos\MShop\Exception $e) |
|
47 | 47 | { |
48 | - $this->checkLimit( $values ); |
|
48 | + $this->checkLimit($values); |
|
49 | 49 | |
50 | 50 | $item = $manager->createItem(); |
51 | - $item->fromArray( $values ); |
|
52 | - $item->setId( null ); |
|
51 | + $item->fromArray($values); |
|
52 | + $item->setId(null); |
|
53 | 53 | |
54 | 54 | /** controller/frontend/customer/groupids |
55 | 55 | * List of groups new customers should be assigned to |
@@ -63,14 +63,14 @@ discard block |
||
63 | 63 | * @category User |
64 | 64 | * @category Developer |
65 | 65 | */ |
66 | - $gids = $config->get( 'client/html/checkout/standard/order/account/standard/groupids', [] ); // @deprecated |
|
67 | - $item->setGroups( (array) $config->get( 'controller/frontend/customer/groupids', $gids ) ); |
|
66 | + $gids = $config->get('client/html/checkout/standard/order/account/standard/groupids', []); // @deprecated |
|
67 | + $item->setGroups((array) $config->get('controller/frontend/customer/groupids', $gids)); |
|
68 | 68 | |
69 | - $item = $manager->saveItem( $item ); |
|
69 | + $item = $manager->saveItem($item); |
|
70 | 70 | |
71 | 71 | $msg = $item->toArray(); |
72 | - $msg['customer.password'] = ( $pass ? $values['customer.password'] : null ); |
|
73 | - $context->getMessageQueue( 'mq-email', 'customer/email/account' )->add( json_encode( $msg ) ); |
|
72 | + $msg['customer.password'] = ($pass ? $values['customer.password'] : null); |
|
73 | + $context->getMessageQueue('mq-email', 'customer/email/account')->add(json_encode($msg)); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | return $item; |
@@ -82,14 +82,14 @@ discard block |
||
82 | 82 | * |
83 | 83 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item |
84 | 84 | */ |
85 | - public function createItem( array $values = [] ) |
|
85 | + public function createItem(array $values = []) |
|
86 | 86 | { |
87 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' ); |
|
87 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer'); |
|
88 | 88 | |
89 | 89 | $item = $manager->createItem(); |
90 | - $item->fromArray( $values ); |
|
91 | - $item->setId( null ); |
|
92 | - $item->setStatus( 1 ); |
|
90 | + $item->fromArray($values); |
|
91 | + $item->setId(null); |
|
92 | + $item->setStatus(1); |
|
93 | 93 | |
94 | 94 | return $item; |
95 | 95 | } |
@@ -101,12 +101,12 @@ discard block |
||
101 | 101 | * @param string $id Unique customer ID |
102 | 102 | * @since 2017.04 |
103 | 103 | */ |
104 | - public function deleteItem( $id ) |
|
104 | + public function deleteItem($id) |
|
105 | 105 | { |
106 | - $this->checkUser( $id ); |
|
106 | + $this->checkUser($id); |
|
107 | 107 | |
108 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' ); |
|
109 | - $manager->deleteItem( $id ); |
|
108 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer'); |
|
109 | + $manager->deleteItem($id); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | |
@@ -118,17 +118,17 @@ discard block |
||
118 | 118 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item |
119 | 119 | * @since 2017.04 |
120 | 120 | */ |
121 | - public function editItem( $id, array $values ) |
|
121 | + public function editItem($id, array $values) |
|
122 | 122 | { |
123 | - $this->checkUser( $id ); |
|
123 | + $this->checkUser($id); |
|
124 | 124 | |
125 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' ); |
|
126 | - $item = $manager->getItem( $id, [], true ); |
|
125 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer'); |
|
126 | + $item = $manager->getItem($id, [], true); |
|
127 | 127 | |
128 | - unset( $values['customer.id'] ); |
|
129 | - $item->fromArray( $values ); |
|
128 | + unset($values['customer.id']); |
|
129 | + $item->fromArray($values); |
|
130 | 130 | |
131 | - return $manager->saveItem( $item ); |
|
131 | + return $manager->saveItem($item); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | |
@@ -140,17 +140,17 @@ discard block |
||
140 | 140 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item including the referenced domains items |
141 | 141 | * @since 2017.04 |
142 | 142 | */ |
143 | - public function getItem( $id = null, array $domains = [] ) |
|
143 | + public function getItem($id = null, array $domains = []) |
|
144 | 144 | { |
145 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' ); |
|
145 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer'); |
|
146 | 146 | |
147 | - if( $id == null ) { |
|
148 | - return $manager->getItem( $this->getContext()->getUserId(), $domains, true ); |
|
147 | + if ($id == null) { |
|
148 | + return $manager->getItem($this->getContext()->getUserId(), $domains, true); |
|
149 | 149 | } |
150 | 150 | |
151 | - $this->checkUser( $id ); |
|
151 | + $this->checkUser($id); |
|
152 | 152 | |
153 | - return $manager->getItem( $id, $domains, true ); |
|
153 | + return $manager->getItem($id, $domains, true); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | |
@@ -164,9 +164,9 @@ discard block |
||
164 | 164 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item including the referenced domains items |
165 | 165 | * @since 2017.04 |
166 | 166 | */ |
167 | - public function findItem( $code, array $domains = [] ) |
|
167 | + public function findItem($code, array $domains = []) |
|
168 | 168 | { |
169 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' )->findItem( $code, $domains ); |
|
169 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer')->findItem($code, $domains); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | |
@@ -176,9 +176,9 @@ discard block |
||
176 | 176 | * @param \Aimeos\MShop\Customer\Item\Iface $item Customer item |
177 | 177 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item including the generated ID |
178 | 178 | */ |
179 | - public function saveItem( \Aimeos\MShop\Customer\Item\Iface $item ) |
|
179 | + public function saveItem(\Aimeos\MShop\Customer\Item\Iface $item) |
|
180 | 180 | { |
181 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' )->saveItem( $item ); |
|
181 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer')->saveItem($item); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | |
@@ -189,17 +189,17 @@ discard block |
||
189 | 189 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
190 | 190 | * @since 2017.04 |
191 | 191 | */ |
192 | - public function addAddressItem( array $values ) |
|
192 | + public function addAddressItem(array $values) |
|
193 | 193 | { |
194 | 194 | $context = $this->getContext(); |
195 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/address' ); |
|
195 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/address'); |
|
196 | 196 | |
197 | 197 | $item = $manager->createItem(); |
198 | - $item->fromArray( $values ); |
|
199 | - $item->setId( null ); |
|
200 | - $item->setParentId( $context->getUserId() ); |
|
198 | + $item->fromArray($values); |
|
199 | + $item->setId(null); |
|
200 | + $item->setParentId($context->getUserId()); |
|
201 | 201 | |
202 | - return $manager->saveItem( $item ); |
|
202 | + return $manager->saveItem($item); |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | |
@@ -208,16 +208,16 @@ discard block |
||
208 | 208 | * |
209 | 209 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
210 | 210 | */ |
211 | - public function createAddressItem( array $values = [] ) |
|
211 | + public function createAddressItem(array $values = []) |
|
212 | 212 | { |
213 | 213 | $context = $this->getContext(); |
214 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/address' ); |
|
214 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/address'); |
|
215 | 215 | |
216 | 216 | $item = $manager->createItem(); |
217 | - $item->fromArray( $values ); |
|
218 | - $item->setId( null ); |
|
217 | + $item->fromArray($values); |
|
218 | + $item->setId(null); |
|
219 | 219 | |
220 | - $item->setParentId( $context->getUserId() ); |
|
220 | + $item->setParentId($context->getUserId()); |
|
221 | 221 | |
222 | 222 | return $item; |
223 | 223 | } |
@@ -229,13 +229,13 @@ discard block |
||
229 | 229 | * @param string $id Unique customer address ID |
230 | 230 | * @since 2017.04 |
231 | 231 | */ |
232 | - public function deleteAddressItem( $id ) |
|
232 | + public function deleteAddressItem($id) |
|
233 | 233 | { |
234 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/address' ); |
|
234 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/address'); |
|
235 | 235 | |
236 | - $this->checkUser( $manager->getItem( $id, [], true )->getParentId() ); |
|
236 | + $this->checkUser($manager->getItem($id, [], true)->getParentId()); |
|
237 | 237 | |
238 | - $manager->deleteItem( $id ); |
|
238 | + $manager->deleteItem($id); |
|
239 | 239 | } |
240 | 240 | |
241 | 241 | |
@@ -247,17 +247,17 @@ discard block |
||
247 | 247 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
248 | 248 | * @since 2017.04 |
249 | 249 | */ |
250 | - public function editAddressItem( $id, array $values ) |
|
250 | + public function editAddressItem($id, array $values) |
|
251 | 251 | { |
252 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/address' ); |
|
252 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/address'); |
|
253 | 253 | |
254 | - $item = $manager->getItem( $id, [], true ); |
|
255 | - $this->checkUser( $item->getParentId() ); |
|
254 | + $item = $manager->getItem($id, [], true); |
|
255 | + $this->checkUser($item->getParentId()); |
|
256 | 256 | |
257 | - unset( $values['customer.address.id'] ); |
|
258 | - $item->fromArray( $values ); |
|
257 | + unset($values['customer.address.id']); |
|
258 | + $item->fromArray($values); |
|
259 | 259 | |
260 | - return $manager->saveItem( $item ); |
|
260 | + return $manager->saveItem($item); |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | |
@@ -268,12 +268,12 @@ discard block |
||
268 | 268 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
269 | 269 | * @since 2017.04 |
270 | 270 | */ |
271 | - public function getAddressItem( $id ) |
|
271 | + public function getAddressItem($id) |
|
272 | 272 | { |
273 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/address' ); |
|
273 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/address'); |
|
274 | 274 | |
275 | - $item = $manager->getItem( $id ); |
|
276 | - $this->checkUser( $item->getParentId() ); |
|
275 | + $item = $manager->getItem($id); |
|
276 | + $this->checkUser($item->getParentId()); |
|
277 | 277 | |
278 | 278 | return $item; |
279 | 279 | } |
@@ -285,9 +285,9 @@ discard block |
||
285 | 285 | * @param \Aimeos\MShop\Customer\Item\Address\Iface $item Customer address item |
286 | 286 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item including the generated ID |
287 | 287 | */ |
288 | - public function saveAddressItem( \Aimeos\MShop\Customer\Item\Address\Iface $item ) |
|
288 | + public function saveAddressItem(\Aimeos\MShop\Customer\Item\Address\Iface $item) |
|
289 | 289 | { |
290 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/address' )->saveItem( $item ); |
|
290 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/address')->saveItem($item); |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | |
@@ -298,32 +298,32 @@ discard block |
||
298 | 298 | * @return \Aimeos\MShop\Common\Item\Lists\Iface Customer lists item |
299 | 299 | * @since 2017.06 |
300 | 300 | */ |
301 | - public function addListItem( array $values ) |
|
301 | + public function addListItem(array $values) |
|
302 | 302 | { |
303 | 303 | $context = $this->getContext(); |
304 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists' ); |
|
304 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists'); |
|
305 | 305 | |
306 | - if( !isset( $values['customer.lists.typeid'] ) ) |
|
306 | + if (!isset($values['customer.lists.typeid'])) |
|
307 | 307 | { |
308 | - if( !isset( $values['customer.lists.type'] ) ) { |
|
309 | - throw new \Aimeos\Controller\Frontend\Customer\Exception( sprintf( 'No customer lists type code' ) ); |
|
308 | + if (!isset($values['customer.lists.type'])) { |
|
309 | + throw new \Aimeos\Controller\Frontend\Customer\Exception(sprintf('No customer lists type code')); |
|
310 | 310 | } |
311 | 311 | |
312 | - if( !isset( $values['customer.lists.domain'] ) ) { |
|
313 | - throw new \Aimeos\Controller\Frontend\Customer\Exception( sprintf( 'No customer lists domain' ) ); |
|
312 | + if (!isset($values['customer.lists.domain'])) { |
|
313 | + throw new \Aimeos\Controller\Frontend\Customer\Exception(sprintf('No customer lists domain')); |
|
314 | 314 | } |
315 | 315 | |
316 | - $typeManager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists/type' ); |
|
317 | - $typeItem = $typeManager->findItem( $values['customer.lists.type'], [], $values['customer.lists.domain'] ); |
|
316 | + $typeManager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists/type'); |
|
317 | + $typeItem = $typeManager->findItem($values['customer.lists.type'], [], $values['customer.lists.domain']); |
|
318 | 318 | $values['customer.lists.typeid'] = $typeItem->getId(); |
319 | 319 | } |
320 | 320 | |
321 | 321 | $item = $manager->createItem(); |
322 | - $item->fromArray( $values ); |
|
323 | - $item->setId( null ); |
|
324 | - $item->setParentId( $context->getUserId() ); |
|
322 | + $item->fromArray($values); |
|
323 | + $item->setId(null); |
|
324 | + $item->setParentId($context->getUserId()); |
|
325 | 325 | |
326 | - return $manager->saveItem( $item ); |
|
326 | + return $manager->saveItem($item); |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | |
@@ -336,10 +336,10 @@ discard block |
||
336 | 336 | public function createListsFilter() |
337 | 337 | { |
338 | 338 | $context = $this->getContext(); |
339 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists' ); |
|
339 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists'); |
|
340 | 340 | |
341 | 341 | $filter = $manager->createSearch(); |
342 | - $filter->setConditions( $filter->compare( '==', 'customer.lists.parentid', $context->getUserId() ) ); |
|
342 | + $filter->setConditions($filter->compare('==', 'customer.lists.parentid', $context->getUserId())); |
|
343 | 343 | |
344 | 344 | return $filter; |
345 | 345 | } |
@@ -351,13 +351,13 @@ discard block |
||
351 | 351 | * @param string $id Unique customer address ID |
352 | 352 | * @since 2017.06 |
353 | 353 | */ |
354 | - public function deleteListItem( $id ) |
|
354 | + public function deleteListItem($id) |
|
355 | 355 | { |
356 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/lists' ); |
|
356 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/lists'); |
|
357 | 357 | |
358 | - $this->checkUser( $manager->getItem( $id )->getParentId() ); |
|
358 | + $this->checkUser($manager->getItem($id)->getParentId()); |
|
359 | 359 | |
360 | - $manager->deleteItem( $id ); |
|
360 | + $manager->deleteItem($id); |
|
361 | 361 | } |
362 | 362 | |
363 | 363 | |
@@ -369,33 +369,33 @@ discard block |
||
369 | 369 | * @return \Aimeos\MShop\Common\Item\Lists\Iface Customer lists item |
370 | 370 | * @since 2017.06 |
371 | 371 | */ |
372 | - public function editListItem( $id, array $values ) |
|
372 | + public function editListItem($id, array $values) |
|
373 | 373 | { |
374 | 374 | $context = $this->getContext(); |
375 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists' ); |
|
375 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists'); |
|
376 | 376 | |
377 | - $item = $manager->getItem( $id, [], true ); |
|
378 | - $this->checkUser( $item->getParentId() ); |
|
377 | + $item = $manager->getItem($id, [], true); |
|
378 | + $this->checkUser($item->getParentId()); |
|
379 | 379 | |
380 | - if( !isset( $values['customer.lists.typeid'] ) ) |
|
380 | + if (!isset($values['customer.lists.typeid'])) |
|
381 | 381 | { |
382 | - if( !isset( $values['customer.lists.type'] ) ) { |
|
383 | - throw new \Aimeos\Controller\Frontend\Customer\Exception( sprintf( 'No customer lists type code' ) ); |
|
382 | + if (!isset($values['customer.lists.type'])) { |
|
383 | + throw new \Aimeos\Controller\Frontend\Customer\Exception(sprintf('No customer lists type code')); |
|
384 | 384 | } |
385 | 385 | |
386 | - if( !isset( $values['customer.lists.domain'] ) ) { |
|
387 | - throw new \Aimeos\Controller\Frontend\Customer\Exception( sprintf( 'No customer lists domain' ) ); |
|
386 | + if (!isset($values['customer.lists.domain'])) { |
|
387 | + throw new \Aimeos\Controller\Frontend\Customer\Exception(sprintf('No customer lists domain')); |
|
388 | 388 | } |
389 | 389 | |
390 | - $typeManager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists/type' ); |
|
391 | - $typeItem = $typeManager->findItem( $values['customer.lists.type'], [], $values['customer.lists.domain'] ); |
|
390 | + $typeManager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists/type'); |
|
391 | + $typeItem = $typeManager->findItem($values['customer.lists.type'], [], $values['customer.lists.domain']); |
|
392 | 392 | $values['customer.lists.typeid'] = $typeItem->getId(); |
393 | 393 | } |
394 | 394 | |
395 | - unset( $values['customer.lists.id'] ); |
|
396 | - $item->fromArray( $values ); |
|
395 | + unset($values['customer.lists.id']); |
|
396 | + $item->fromArray($values); |
|
397 | 397 | |
398 | - return $manager->saveItem( $item ); |
|
398 | + return $manager->saveItem($item); |
|
399 | 399 | } |
400 | 400 | |
401 | 401 | |
@@ -406,12 +406,12 @@ discard block |
||
406 | 406 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
407 | 407 | * @since 2017.06 |
408 | 408 | */ |
409 | - public function getListItem( $id ) |
|
409 | + public function getListItem($id) |
|
410 | 410 | { |
411 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/lists' ); |
|
412 | - $item = $manager->getItem( $id ); |
|
411 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/lists'); |
|
412 | + $item = $manager->getItem($id); |
|
413 | 413 | |
414 | - $this->checkUser( $item->getParentId() ); |
|
414 | + $this->checkUser($item->getParentId()); |
|
415 | 415 | |
416 | 416 | return $item; |
417 | 417 | } |
@@ -425,11 +425,11 @@ discard block |
||
425 | 425 | * @return \Aimeos\MShop\Common\Item\Lists\Iface[] Customer list items |
426 | 426 | * @since 2017.06 |
427 | 427 | */ |
428 | - public function searchListItems( \Aimeos\MW\Criteria\Iface $filter, &$total = null ) |
|
428 | + public function searchListItems(\Aimeos\MW\Criteria\Iface $filter, &$total = null) |
|
429 | 429 | { |
430 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/lists' ); |
|
430 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/lists'); |
|
431 | 431 | |
432 | - return $manager->searchItems( $filter, [], $total ); |
|
432 | + return $manager->searchItems($filter, [], $total); |
|
433 | 433 | } |
434 | 434 | |
435 | 435 | |
@@ -439,37 +439,37 @@ discard block |
||
439 | 439 | * @param string[] $values Associative list of customer keys (e.g. "customer.label") and their values |
440 | 440 | * @return string[] Associative list of customer key/value pairs with default values set |
441 | 441 | */ |
442 | - protected function addItemDefaults( array $values ) |
|
442 | + protected function addItemDefaults(array $values) |
|
443 | 443 | { |
444 | - if( !isset( $values['customer.label'] ) || $values['customer.label'] == '' ) |
|
444 | + if (!isset($values['customer.label']) || $values['customer.label'] == '') |
|
445 | 445 | { |
446 | 446 | $label = ''; |
447 | 447 | |
448 | - if( isset( $values['customer.lastname'] ) ) { |
|
448 | + if (isset($values['customer.lastname'])) { |
|
449 | 449 | $label = $values['customer.lastname']; |
450 | 450 | } |
451 | 451 | |
452 | - if( isset( $values['customer.firstname'] ) && $values['customer.firstname'] != '' ) { |
|
452 | + if (isset($values['customer.firstname']) && $values['customer.firstname'] != '') { |
|
453 | 453 | $label = $values['customer.firstname'] . ' ' . $label; |
454 | 454 | } |
455 | 455 | |
456 | - if( isset( $values['customer.company'] ) && $values['customer.company'] != '' ) { |
|
456 | + if (isset($values['customer.company']) && $values['customer.company'] != '') { |
|
457 | 457 | $label .= ' (' . $values['customer.company'] . ')'; |
458 | 458 | } |
459 | 459 | |
460 | 460 | $values['customer.label'] = $label; |
461 | 461 | } |
462 | 462 | |
463 | - if( !isset( $values['customer.code'] ) ) { |
|
463 | + if (!isset($values['customer.code'])) { |
|
464 | 464 | $values['customer.code'] = $values['customer.email']; |
465 | 465 | } |
466 | 466 | |
467 | - if( !isset( $values['customer.status'] ) ) { |
|
467 | + if (!isset($values['customer.status'])) { |
|
468 | 468 | $values['customer.status'] = 1; |
469 | 469 | } |
470 | 470 | |
471 | - if( !isset( $values['customer.password'] ) ) { |
|
472 | - $values['customer.password'] = substr( md5( microtime( true ) . getmypid() . rand() ), -8 ); |
|
471 | + if (!isset($values['customer.password'])) { |
|
472 | + $values['customer.password'] = substr(md5(microtime(true) . getmypid() . rand()), -8); |
|
473 | 473 | } |
474 | 474 | |
475 | 475 | return $values; |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | * @param string[] $values Associative list of customer keys (e.g. "customer.label") and their values |
483 | 483 | * @throws \Aimeos\Controller\Frontend\Customer\Exception If access isn't allowed |
484 | 484 | */ |
485 | - protected function checkLimit( array $values ) |
|
485 | + protected function checkLimit(array $values) |
|
486 | 486 | { |
487 | 487 | $total = 0; |
488 | 488 | $context = $this->getContext(); |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | * @category Developer |
504 | 504 | * @see controller/frontend/customer/limit-seconds |
505 | 505 | */ |
506 | - $count = $config->get( 'controller/frontend/customer/limit-count', 5 ); |
|
506 | + $count = $config->get('controller/frontend/customer/limit-count', 5); |
|
507 | 507 | |
508 | 508 | /** controller/frontend/customer/limit-seconds |
509 | 509 | * Customer account limitation time frame in seconds |
@@ -521,22 +521,22 @@ discard block |
||
521 | 521 | * @category Developer |
522 | 522 | * @see controller/frontend/customer/limit-count |
523 | 523 | */ |
524 | - $seconds = $config->get( 'controller/frontend/customer/limit-seconds', 300 ); |
|
524 | + $seconds = $config->get('controller/frontend/customer/limit-seconds', 300); |
|
525 | 525 | |
526 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' ); |
|
526 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer'); |
|
527 | 527 | |
528 | 528 | $search = $manager->createSearch(); |
529 | 529 | $expr = [ |
530 | - $search->compare( '==', 'customer.editor', $context->getEditor() ), |
|
531 | - $search->compare( '>=', 'customer.ctime', date( 'Y-m-d H:i:s', time() - $seconds ) ), |
|
530 | + $search->compare('==', 'customer.editor', $context->getEditor()), |
|
531 | + $search->compare('>=', 'customer.ctime', date('Y-m-d H:i:s', time() - $seconds)), |
|
532 | 532 | ]; |
533 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
534 | - $search->setSlice( 0, 0 ); |
|
533 | + $search->setConditions($search->combine('&&', $expr)); |
|
534 | + $search->setSlice(0, 0); |
|
535 | 535 | |
536 | - $manager->searchItems( $search, [], $total ); |
|
536 | + $manager->searchItems($search, [], $total); |
|
537 | 537 | |
538 | - if( $total > $count ) { |
|
539 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( 'Temporary limit reached' ) ); |
|
538 | + if ($total > $count) { |
|
539 | + throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf('Temporary limit reached')); |
|
540 | 540 | } |
541 | 541 | } |
542 | 542 | |
@@ -547,12 +547,12 @@ discard block |
||
547 | 547 | * @param string $id Unique customer ID |
548 | 548 | * @throws \Aimeos\Controller\Frontend\Customer\Exception If access isn't allowed |
549 | 549 | */ |
550 | - protected function checkUser( $id ) |
|
550 | + protected function checkUser($id) |
|
551 | 551 | { |
552 | - if( $id != $this->getContext()->getUserId() ) |
|
552 | + if ($id != $this->getContext()->getUserId()) |
|
553 | 553 | { |
554 | - $msg = sprintf( 'Not allowed to access customer data for ID "%1$s"', $id ); |
|
555 | - throw new \Aimeos\Controller\Frontend\Customer\Exception( $msg ); |
|
554 | + $msg = sprintf('Not allowed to access customer data for ID "%1$s"', $id); |
|
555 | + throw new \Aimeos\Controller\Frontend\Customer\Exception($msg); |
|
556 | 556 | } |
557 | 557 | } |
558 | 558 | } |
@@ -18,121 +18,121 @@ discard block |
||
18 | 18 | protected function setUp() |
19 | 19 | { |
20 | 20 | $this->context = \TestHelperFrontend::getContext(); |
21 | - $this->object = new \Aimeos\Controller\Frontend\Customer\Standard( $this->context ); |
|
21 | + $this->object = new \Aimeos\Controller\Frontend\Customer\Standard($this->context); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | |
25 | 25 | protected function tearDown() |
26 | 26 | { |
27 | - unset( $this->context, $this->object ); |
|
27 | + unset($this->context, $this->object); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | |
31 | 31 | public function testAddEditSaveDeleteItem() |
32 | 32 | { |
33 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' ); |
|
34 | - $id = $manager->findItem( 'UTC001' )->getId(); |
|
33 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'customer'); |
|
34 | + $id = $manager->findItem('UTC001')->getId(); |
|
35 | 35 | |
36 | - $this->context->setUserId( $id ); |
|
37 | - $item = $this->object->addItem( ['customer.code' => 'unittest-ctnl', 'customer.status' => 1] ); |
|
38 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $item ); |
|
36 | + $this->context->setUserId($id); |
|
37 | + $item = $this->object->addItem(['customer.code' => 'unittest-ctnl', 'customer.status' => 1]); |
|
38 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $item); |
|
39 | 39 | |
40 | - $this->context->setUserId( $item->getId() ); |
|
41 | - $item = $this->object->editItem( $item->getId(), ['customer.code' => 'unittest-ctnl2'] ); |
|
42 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $item ); |
|
40 | + $this->context->setUserId($item->getId()); |
|
41 | + $item = $this->object->editItem($item->getId(), ['customer.code' => 'unittest-ctnl2']); |
|
42 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $item); |
|
43 | 43 | |
44 | - $item->setStatus( 0 ); |
|
45 | - $item = $this->object->saveItem( $item ); |
|
46 | - $this->assertEquals( 0, $item->getStatus() ); |
|
44 | + $item->setStatus(0); |
|
45 | + $item = $this->object->saveItem($item); |
|
46 | + $this->assertEquals(0, $item->getStatus()); |
|
47 | 47 | |
48 | - $this->object->deleteItem( $item->getId() ); |
|
48 | + $this->object->deleteItem($item->getId()); |
|
49 | 49 | |
50 | - $this->setExpectedException( '\Aimeos\MShop\Exception' ); |
|
51 | - $manager->findItem( 'unittest-ctnl' ); |
|
50 | + $this->setExpectedException('\Aimeos\MShop\Exception'); |
|
51 | + $manager->findItem('unittest-ctnl'); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | |
55 | 55 | public function testAddExistingItem() |
56 | 56 | { |
57 | - $item = $this->object->addItem( ['customer.code' => 'UTC001'] ); |
|
58 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $item ); |
|
57 | + $item = $this->object->addItem(['customer.code' => 'UTC001']); |
|
58 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $item); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | |
62 | 62 | public function testCreateItem() |
63 | 63 | { |
64 | 64 | $result = $this->object->createItem(); |
65 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $result ); |
|
65 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $result); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | |
69 | 69 | public function testGetItem() |
70 | 70 | { |
71 | - $id = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' )->findItem( 'UTC001' )->getId(); |
|
72 | - $this->context->setUserId( $id ); |
|
71 | + $id = \Aimeos\MShop\Factory::createManager($this->context, 'customer')->findItem('UTC001')->getId(); |
|
72 | + $this->context->setUserId($id); |
|
73 | 73 | |
74 | - $result = $this->object->getItem( $id, ['customer/address', 'text'] ); |
|
74 | + $result = $this->object->getItem($id, ['customer/address', 'text']); |
|
75 | 75 | |
76 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $result ); |
|
77 | - $this->assertEquals( 1, count( $result->getRefItems( 'text' ) ) ); |
|
78 | - $this->assertEquals( 1, count( $result->getAddressItems() ) ); |
|
76 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $result); |
|
77 | + $this->assertEquals(1, count($result->getRefItems('text'))); |
|
78 | + $this->assertEquals(1, count($result->getAddressItems())); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | |
82 | 82 | public function testFindItem() |
83 | 83 | { |
84 | - $result = $this->object->findItem( 'UTC001' ); |
|
85 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $result ); |
|
84 | + $result = $this->object->findItem('UTC001'); |
|
85 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $result); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | |
89 | 89 | public function testAddEditSaveDeleteAddressItem() |
90 | 90 | { |
91 | - $customer = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' )->findItem( 'UTC001' ); |
|
92 | - $this->context->setUserId( $customer->getId() ); |
|
91 | + $customer = \Aimeos\MShop\Factory::createManager($this->context, 'customer')->findItem('UTC001'); |
|
92 | + $this->context->setUserId($customer->getId()); |
|
93 | 93 | |
94 | - $item = $this->object->addAddressItem( ['customer.address.lastname' => 'unittest-ctnl'] ); |
|
95 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Address\Iface', $item ); |
|
94 | + $item = $this->object->addAddressItem(['customer.address.lastname' => 'unittest-ctnl']); |
|
95 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Address\Iface', $item); |
|
96 | 96 | |
97 | - $item = $this->object->editAddressItem( $item->getId(), ['customer.address.lastname' => 'unittest-ctnl2'] ); |
|
98 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Address\Iface', $item ); |
|
97 | + $item = $this->object->editAddressItem($item->getId(), ['customer.address.lastname' => 'unittest-ctnl2']); |
|
98 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Address\Iface', $item); |
|
99 | 99 | |
100 | - $item->setLastName( 'test' ); |
|
101 | - $this->object->saveAddressItem( $item ); |
|
102 | - $this->assertEquals( 'test', $item->getLastName() ); |
|
100 | + $item->setLastName('test'); |
|
101 | + $this->object->saveAddressItem($item); |
|
102 | + $this->assertEquals('test', $item->getLastName()); |
|
103 | 103 | |
104 | - $this->object->deleteAddressItem( $item->getId() ); |
|
104 | + $this->object->deleteAddressItem($item->getId()); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | |
108 | 108 | public function testCreateAddressItem() |
109 | 109 | { |
110 | 110 | $result = $this->object->createAddressItem(); |
111 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Address\Iface', $result ); |
|
111 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Address\Iface', $result); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | |
115 | 115 | public function testGetAddressItem() |
116 | 116 | { |
117 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'customer/address' ); |
|
117 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'customer/address'); |
|
118 | 118 | $search = $manager->createSearch(); |
119 | - $search->setSlice( 0, 1 ); |
|
120 | - $result = $manager->searchItems( $search ); |
|
119 | + $search->setSlice(0, 1); |
|
120 | + $result = $manager->searchItems($search); |
|
121 | 121 | |
122 | - if( ( $item = reset( $result ) ) === false ) { |
|
123 | - throw new \RuntimeException( 'No customer address available' ); |
|
122 | + if (($item = reset($result)) === false) { |
|
123 | + throw new \RuntimeException('No customer address available'); |
|
124 | 124 | } |
125 | 125 | |
126 | - $this->context->setUserId( $item->getParentId() ); |
|
127 | - $result = $this->object->getAddressItem( $item->getId() ); |
|
128 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Address\Iface', $result ); |
|
126 | + $this->context->setUserId($item->getParentId()); |
|
127 | + $result = $this->object->getAddressItem($item->getId()); |
|
128 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Address\Iface', $result); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | |
132 | 132 | public function testAddEditDeleteListItem() |
133 | 133 | { |
134 | - $customer = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' )->findItem( 'UTC001' ); |
|
135 | - $this->context->setUserId( $customer->getId() ); |
|
134 | + $customer = \Aimeos\MShop\Factory::createManager($this->context, 'customer')->findItem('UTC001'); |
|
135 | + $this->context->setUserId($customer->getId()); |
|
136 | 136 | |
137 | 137 | $values = [ |
138 | 138 | 'customer.lists.type' => 'favorite', |
@@ -140,8 +140,8 @@ discard block |
||
140 | 140 | 'customer.lists.refid' => '-1' |
141 | 141 | ]; |
142 | 142 | |
143 | - $item = $this->object->addListItem( $values ); |
|
144 | - $this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Lists\Iface', $item ); |
|
143 | + $item = $this->object->addListItem($values); |
|
144 | + $this->assertInstanceOf('\Aimeos\MShop\Common\Item\Lists\Iface', $item); |
|
145 | 145 | |
146 | 146 | $values = [ |
147 | 147 | 'customer.lists.type' => 'favorite', |
@@ -149,46 +149,46 @@ discard block |
||
149 | 149 | 'customer.lists.refid' => '-2' |
150 | 150 | ]; |
151 | 151 | |
152 | - $item = $this->object->editListItem( $item->getId(), $values ); |
|
153 | - $this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Lists\Iface', $item ); |
|
152 | + $item = $this->object->editListItem($item->getId(), $values); |
|
153 | + $this->assertInstanceOf('\Aimeos\MShop\Common\Item\Lists\Iface', $item); |
|
154 | 154 | |
155 | - $this->object->deleteListItem( $item->getId() ); |
|
155 | + $this->object->deleteListItem($item->getId()); |
|
156 | 156 | |
157 | - $this->setExpectedException( '\Aimeos\MShop\Exception' ); |
|
158 | - $this->object->getListItem( $item->getId() ); |
|
157 | + $this->setExpectedException('\Aimeos\MShop\Exception'); |
|
158 | + $this->object->getListItem($item->getId()); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | |
162 | 162 | public function testGetListItem() |
163 | 163 | { |
164 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'customer/lists' ); |
|
164 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'customer/lists'); |
|
165 | 165 | $search = $manager->createSearch(); |
166 | - $search->setSlice( 0, 1 ); |
|
167 | - $result = $manager->searchItems( $search ); |
|
166 | + $search->setSlice(0, 1); |
|
167 | + $result = $manager->searchItems($search); |
|
168 | 168 | |
169 | - if( ( $item = reset( $result ) ) === false ) { |
|
170 | - throw new \RuntimeException( 'No customer lists item available' ); |
|
169 | + if (($item = reset($result)) === false) { |
|
170 | + throw new \RuntimeException('No customer lists item available'); |
|
171 | 171 | } |
172 | 172 | |
173 | - $this->context->setUserId( $item->getParentId() ); |
|
174 | - $result = $this->object->getListItem( $item->getId() ); |
|
175 | - $this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Lists\Iface', $result ); |
|
173 | + $this->context->setUserId($item->getParentId()); |
|
174 | + $result = $this->object->getListItem($item->getId()); |
|
175 | + $this->assertInstanceOf('\Aimeos\MShop\Common\Item\Lists\Iface', $result); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | |
179 | 179 | public function testSearchListItem() |
180 | 180 | { |
181 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' ); |
|
182 | - $customer = $manager->findItem( 'UTC001' ); |
|
183 | - $this->context->setUserId( $customer->getId() ); |
|
181 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'customer'); |
|
182 | + $customer = $manager->findItem('UTC001'); |
|
183 | + $this->context->setUserId($customer->getId()); |
|
184 | 184 | |
185 | 185 | $filter = $this->object->createListsFilter(); |
186 | - $result = $this->object->searchListItems( $filter ); |
|
186 | + $result = $this->object->searchListItems($filter); |
|
187 | 187 | |
188 | - foreach( $result as $item ) |
|
188 | + foreach ($result as $item) |
|
189 | 189 | { |
190 | - $this->assertEquals( $customer->getId(), $item->getParentId() ); |
|
191 | - $this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Lists\Iface', $item ); |
|
190 | + $this->assertEquals($customer->getId(), $item->getParentId()); |
|
191 | + $this->assertInstanceOf('\Aimeos\MShop\Common\Item\Lists\Iface', $item); |
|
192 | 192 | } |
193 | 193 | } |
194 | 194 | } |