@@ -18,114 +18,114 @@ 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 testCreateItem() |
56 | 56 | { |
57 | 57 | $result = $this->object->createItem(); |
58 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $result ); |
|
58 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $result); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | |
62 | 62 | public function testGetItem() |
63 | 63 | { |
64 | - $id = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' )->findItem( 'UTC001' )->getId(); |
|
65 | - $this->context->setUserId( $id ); |
|
64 | + $id = \Aimeos\MShop\Factory::createManager($this->context, 'customer')->findItem('UTC001')->getId(); |
|
65 | + $this->context->setUserId($id); |
|
66 | 66 | |
67 | - $result = $this->object->getItem( $id, ['customer/address', 'text'] ); |
|
67 | + $result = $this->object->getItem($id, ['customer/address', 'text']); |
|
68 | 68 | |
69 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $result ); |
|
70 | - $this->assertEquals( 1, count( $result->getRefItems( 'text' ) ) ); |
|
71 | - $this->assertEquals( 1, count( $result->getAddressItems() ) ); |
|
69 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $result); |
|
70 | + $this->assertEquals(1, count($result->getRefItems('text'))); |
|
71 | + $this->assertEquals(1, count($result->getAddressItems())); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | |
75 | 75 | public function testFindItem() |
76 | 76 | { |
77 | - $result = $this->object->findItem( 'UTC001' ); |
|
78 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $result ); |
|
77 | + $result = $this->object->findItem('UTC001'); |
|
78 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $result); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | |
82 | 82 | public function testAddEditSaveDeleteAddressItem() |
83 | 83 | { |
84 | - $customer = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' )->findItem( 'UTC001' ); |
|
85 | - $this->context->setUserId( $customer->getId() ); |
|
84 | + $customer = \Aimeos\MShop\Factory::createManager($this->context, 'customer')->findItem('UTC001'); |
|
85 | + $this->context->setUserId($customer->getId()); |
|
86 | 86 | |
87 | - $item = $this->object->addAddressItem( ['customer.address.lastname' => 'unittest-ctnl'] ); |
|
88 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Address\Iface', $item ); |
|
87 | + $item = $this->object->addAddressItem(['customer.address.lastname' => 'unittest-ctnl']); |
|
88 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Address\Iface', $item); |
|
89 | 89 | |
90 | - $item = $this->object->editAddressItem( $item->getId(), ['customer.address.lastname' => 'unittest-ctnl2'] ); |
|
91 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Address\Iface', $item ); |
|
90 | + $item = $this->object->editAddressItem($item->getId(), ['customer.address.lastname' => 'unittest-ctnl2']); |
|
91 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Address\Iface', $item); |
|
92 | 92 | |
93 | - $item->setLastName( 'test' ); |
|
94 | - $this->object->saveAddressItem( $item ); |
|
95 | - $this->assertEquals( 'test', $item->getLastName() ); |
|
93 | + $item->setLastName('test'); |
|
94 | + $this->object->saveAddressItem($item); |
|
95 | + $this->assertEquals('test', $item->getLastName()); |
|
96 | 96 | |
97 | - $this->object->deleteAddressItem( $item->getId() ); |
|
97 | + $this->object->deleteAddressItem($item->getId()); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | |
101 | 101 | public function testCreateAddressItem() |
102 | 102 | { |
103 | 103 | $result = $this->object->createAddressItem(); |
104 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Address\Iface', $result ); |
|
104 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Address\Iface', $result); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | |
108 | 108 | public function testGetAddressItem() |
109 | 109 | { |
110 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'customer/address' ); |
|
110 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'customer/address'); |
|
111 | 111 | $search = $manager->createSearch(); |
112 | - $search->setSlice( 0, 1 ); |
|
113 | - $result = $manager->searchItems( $search ); |
|
112 | + $search->setSlice(0, 1); |
|
113 | + $result = $manager->searchItems($search); |
|
114 | 114 | |
115 | - if( ( $item = reset( $result ) ) === false ) { |
|
116 | - throw new \RuntimeException( 'No customer address available' ); |
|
115 | + if (($item = reset($result)) === false) { |
|
116 | + throw new \RuntimeException('No customer address available'); |
|
117 | 117 | } |
118 | 118 | |
119 | - $this->context->setUserId( $item->getParentId() ); |
|
120 | - $result = $this->object->getAddressItem( $item->getId() ); |
|
121 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Address\Iface', $result ); |
|
119 | + $this->context->setUserId($item->getParentId()); |
|
120 | + $result = $this->object->getAddressItem($item->getId()); |
|
121 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Address\Iface', $result); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | |
125 | 125 | public function testAddEditDeleteListItem() |
126 | 126 | { |
127 | - $customer = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' )->findItem( 'UTC001' ); |
|
128 | - $this->context->setUserId( $customer->getId() ); |
|
127 | + $customer = \Aimeos\MShop\Factory::createManager($this->context, 'customer')->findItem('UTC001'); |
|
128 | + $this->context->setUserId($customer->getId()); |
|
129 | 129 | |
130 | 130 | $values = [ |
131 | 131 | 'customer.lists.type' => 'favorite', |
@@ -133,8 +133,8 @@ discard block |
||
133 | 133 | 'customer.lists.refid' => '-1' |
134 | 134 | ]; |
135 | 135 | |
136 | - $item = $this->object->addListItem( $values ); |
|
137 | - $this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Lists\Iface', $item ); |
|
136 | + $item = $this->object->addListItem($values); |
|
137 | + $this->assertInstanceOf('\Aimeos\MShop\Common\Item\Lists\Iface', $item); |
|
138 | 138 | |
139 | 139 | $values = [ |
140 | 140 | 'customer.lists.type' => 'favorite', |
@@ -142,46 +142,46 @@ discard block |
||
142 | 142 | 'customer.lists.refid' => '-2' |
143 | 143 | ]; |
144 | 144 | |
145 | - $item = $this->object->editListItem( $item->getId(), $values ); |
|
146 | - $this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Lists\Iface', $item ); |
|
145 | + $item = $this->object->editListItem($item->getId(), $values); |
|
146 | + $this->assertInstanceOf('\Aimeos\MShop\Common\Item\Lists\Iface', $item); |
|
147 | 147 | |
148 | - $this->object->deleteListItem( $item->getId() ); |
|
148 | + $this->object->deleteListItem($item->getId()); |
|
149 | 149 | |
150 | - $this->setExpectedException( '\Aimeos\MShop\Exception' ); |
|
151 | - $this->object->getListItem( $item->getId() ); |
|
150 | + $this->setExpectedException('\Aimeos\MShop\Exception'); |
|
151 | + $this->object->getListItem($item->getId()); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | |
155 | 155 | public function testGetListItem() |
156 | 156 | { |
157 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'customer/lists' ); |
|
157 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'customer/lists'); |
|
158 | 158 | $search = $manager->createSearch(); |
159 | - $search->setSlice( 0, 1 ); |
|
160 | - $result = $manager->searchItems( $search ); |
|
159 | + $search->setSlice(0, 1); |
|
160 | + $result = $manager->searchItems($search); |
|
161 | 161 | |
162 | - if( ( $item = reset( $result ) ) === false ) { |
|
163 | - throw new \RuntimeException( 'No customer lists item available' ); |
|
162 | + if (($item = reset($result)) === false) { |
|
163 | + throw new \RuntimeException('No customer lists item available'); |
|
164 | 164 | } |
165 | 165 | |
166 | - $this->context->setUserId( $item->getParentId() ); |
|
167 | - $result = $this->object->getListItem( $item->getId() ); |
|
168 | - $this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Lists\Iface', $result ); |
|
166 | + $this->context->setUserId($item->getParentId()); |
|
167 | + $result = $this->object->getListItem($item->getId()); |
|
168 | + $this->assertInstanceOf('\Aimeos\MShop\Common\Item\Lists\Iface', $result); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | |
172 | 172 | public function testSearchListItem() |
173 | 173 | { |
174 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' ); |
|
175 | - $customer = $manager->findItem( 'UTC001' ); |
|
176 | - $this->context->setUserId( $customer->getId() ); |
|
174 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'customer'); |
|
175 | + $customer = $manager->findItem('UTC001'); |
|
176 | + $this->context->setUserId($customer->getId()); |
|
177 | 177 | |
178 | 178 | $filter = $this->object->createListsFilter(); |
179 | - $result = $this->object->searchListItems( $filter ); |
|
179 | + $result = $this->object->searchListItems($filter); |
|
180 | 180 | |
181 | - foreach( $result as $item ) |
|
181 | + foreach ($result as $item) |
|
182 | 182 | { |
183 | - $this->assertEquals( $customer->getId(), $item->getParentId() ); |
|
184 | - $this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Lists\Iface', $item ); |
|
183 | + $this->assertEquals($customer->getId(), $item->getParentId()); |
|
184 | + $this->assertInstanceOf('\Aimeos\MShop\Common\Item\Lists\Iface', $item); |
|
185 | 185 | } |
186 | 186 | } |
187 | 187 | } |
@@ -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 | } |
@@ -28,16 +28,16 @@ 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 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' ); |
|
35 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer'); |
|
36 | 36 | |
37 | - $values = $this->addItemDefaults( $values ); |
|
37 | + $values = $this->addItemDefaults($values); |
|
38 | 38 | $item = $manager->createItem(); |
39 | - $item->fromArray( $values ); |
|
40 | - $item->setId( null ); |
|
39 | + $item->fromArray($values); |
|
40 | + $item->setId(null); |
|
41 | 41 | |
42 | 42 | /** controller/frontend/customer/groupids |
43 | 43 | * List of groups new customers should be assigned to |
@@ -51,14 +51,14 @@ discard block |
||
51 | 51 | * @category User |
52 | 52 | * @category Developer |
53 | 53 | */ |
54 | - $gids = $config->get( 'client/html/checkout/standard/order/account/standard/groupids', [] ); // @deprecated |
|
55 | - $item->setGroups( (array) $config->get( 'controller/frontend/customer/groupids', $gids ) ); |
|
54 | + $gids = $config->get('client/html/checkout/standard/order/account/standard/groupids', []); // @deprecated |
|
55 | + $item->setGroups((array) $config->get('controller/frontend/customer/groupids', $gids)); |
|
56 | 56 | |
57 | - $item = $manager->saveItem( $item ); |
|
57 | + $item = $manager->saveItem($item); |
|
58 | 58 | |
59 | 59 | $msg = $item->toArray(); |
60 | 60 | $msg['customer.password'] = $values['customer.password']; |
61 | - $context->getMessageQueue( 'mq-email', 'customer/email/account' )->add( json_encode( $msg ) ); |
|
61 | + $context->getMessageQueue('mq-email', 'customer/email/account')->add(json_encode($msg)); |
|
62 | 62 | |
63 | 63 | return $item; |
64 | 64 | } |
@@ -69,14 +69,14 @@ discard block |
||
69 | 69 | * |
70 | 70 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item |
71 | 71 | */ |
72 | - public function createItem( array $values = [] ) |
|
72 | + public function createItem(array $values = []) |
|
73 | 73 | { |
74 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' ); |
|
74 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer'); |
|
75 | 75 | |
76 | 76 | $item = $manager->createItem(); |
77 | - $item->fromArray( $values ); |
|
78 | - $item->setId( null ); |
|
79 | - $item->setStatus( 1 ); |
|
77 | + $item->fromArray($values); |
|
78 | + $item->setId(null); |
|
79 | + $item->setStatus(1); |
|
80 | 80 | |
81 | 81 | return $item; |
82 | 82 | } |
@@ -88,12 +88,12 @@ discard block |
||
88 | 88 | * @param string $id Unique customer ID |
89 | 89 | * @since 2017.04 |
90 | 90 | */ |
91 | - public function deleteItem( $id ) |
|
91 | + public function deleteItem($id) |
|
92 | 92 | { |
93 | - $this->checkUser( $id ); |
|
93 | + $this->checkUser($id); |
|
94 | 94 | |
95 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' ); |
|
96 | - $manager->deleteItem( $id ); |
|
95 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer'); |
|
96 | + $manager->deleteItem($id); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | |
@@ -105,17 +105,17 @@ discard block |
||
105 | 105 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item |
106 | 106 | * @since 2017.04 |
107 | 107 | */ |
108 | - public function editItem( $id, array $values ) |
|
108 | + public function editItem($id, array $values) |
|
109 | 109 | { |
110 | - $this->checkUser( $id ); |
|
110 | + $this->checkUser($id); |
|
111 | 111 | |
112 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' ); |
|
113 | - $item = $manager->getItem( $id, [], true ); |
|
112 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer'); |
|
113 | + $item = $manager->getItem($id, [], true); |
|
114 | 114 | |
115 | - unset( $values['customer.id'] ); |
|
116 | - $item->fromArray( $values ); |
|
115 | + unset($values['customer.id']); |
|
116 | + $item->fromArray($values); |
|
117 | 117 | |
118 | - return $manager->saveItem( $item ); |
|
118 | + return $manager->saveItem($item); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | |
@@ -127,17 +127,17 @@ discard block |
||
127 | 127 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item including the referenced domains items |
128 | 128 | * @since 2017.04 |
129 | 129 | */ |
130 | - public function getItem( $id = null, array $domains = [] ) |
|
130 | + public function getItem($id = null, array $domains = []) |
|
131 | 131 | { |
132 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' ); |
|
132 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer'); |
|
133 | 133 | |
134 | - if( $id == null ) { |
|
135 | - return $manager->getItem( $this->getContext()->getUserId(), $domains, true ); |
|
134 | + if ($id == null) { |
|
135 | + return $manager->getItem($this->getContext()->getUserId(), $domains, true); |
|
136 | 136 | } |
137 | 137 | |
138 | - $this->checkUser( $id ); |
|
138 | + $this->checkUser($id); |
|
139 | 139 | |
140 | - return $manager->getItem( $id, $domains, true ); |
|
140 | + return $manager->getItem($id, $domains, true); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | |
@@ -151,9 +151,9 @@ discard block |
||
151 | 151 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item including the referenced domains items |
152 | 152 | * @since 2017.04 |
153 | 153 | */ |
154 | - public function findItem( $code, array $domains = [] ) |
|
154 | + public function findItem($code, array $domains = []) |
|
155 | 155 | { |
156 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' )->findItem( $code, $domains ); |
|
156 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer')->findItem($code, $domains); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | |
@@ -163,9 +163,9 @@ discard block |
||
163 | 163 | * @param \Aimeos\MShop\Customer\Item\Iface $item Customer item |
164 | 164 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item including the generated ID |
165 | 165 | */ |
166 | - public function saveItem( \Aimeos\MShop\Customer\Item\Iface $item ) |
|
166 | + public function saveItem(\Aimeos\MShop\Customer\Item\Iface $item) |
|
167 | 167 | { |
168 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' )->saveItem( $item ); |
|
168 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer')->saveItem($item); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | |
@@ -176,17 +176,17 @@ discard block |
||
176 | 176 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
177 | 177 | * @since 2017.04 |
178 | 178 | */ |
179 | - public function addAddressItem( array $values ) |
|
179 | + public function addAddressItem(array $values) |
|
180 | 180 | { |
181 | 181 | $context = $this->getContext(); |
182 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/address' ); |
|
182 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/address'); |
|
183 | 183 | |
184 | 184 | $item = $manager->createItem(); |
185 | - $item->fromArray( $values ); |
|
186 | - $item->setId( null ); |
|
187 | - $item->setParentId( $context->getUserId() ); |
|
185 | + $item->fromArray($values); |
|
186 | + $item->setId(null); |
|
187 | + $item->setParentId($context->getUserId()); |
|
188 | 188 | |
189 | - return $manager->saveItem( $item ); |
|
189 | + return $manager->saveItem($item); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | |
@@ -195,16 +195,16 @@ discard block |
||
195 | 195 | * |
196 | 196 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
197 | 197 | */ |
198 | - public function createAddressItem( array $values = [] ) |
|
198 | + public function createAddressItem(array $values = []) |
|
199 | 199 | { |
200 | 200 | $context = $this->getContext(); |
201 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/address' ); |
|
201 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/address'); |
|
202 | 202 | |
203 | 203 | $item = $manager->createItem(); |
204 | - $item->fromArray( $values ); |
|
205 | - $item->setId( null ); |
|
204 | + $item->fromArray($values); |
|
205 | + $item->setId(null); |
|
206 | 206 | |
207 | - $item->setParentId( $context->getUserId() ); |
|
207 | + $item->setParentId($context->getUserId()); |
|
208 | 208 | |
209 | 209 | return $item; |
210 | 210 | } |
@@ -216,13 +216,13 @@ discard block |
||
216 | 216 | * @param string $id Unique customer address ID |
217 | 217 | * @since 2017.04 |
218 | 218 | */ |
219 | - public function deleteAddressItem( $id ) |
|
219 | + public function deleteAddressItem($id) |
|
220 | 220 | { |
221 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/address' ); |
|
221 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/address'); |
|
222 | 222 | |
223 | - $this->checkUser( $manager->getItem( $id, [], true )->getParentId() ); |
|
223 | + $this->checkUser($manager->getItem($id, [], true)->getParentId()); |
|
224 | 224 | |
225 | - $manager->deleteItem( $id ); |
|
225 | + $manager->deleteItem($id); |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | |
@@ -234,17 +234,17 @@ discard block |
||
234 | 234 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
235 | 235 | * @since 2017.04 |
236 | 236 | */ |
237 | - public function editAddressItem( $id, array $values ) |
|
237 | + public function editAddressItem($id, array $values) |
|
238 | 238 | { |
239 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/address' ); |
|
239 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/address'); |
|
240 | 240 | |
241 | - $item = $manager->getItem( $id, [], true ); |
|
242 | - $this->checkUser( $item->getParentId() ); |
|
241 | + $item = $manager->getItem($id, [], true); |
|
242 | + $this->checkUser($item->getParentId()); |
|
243 | 243 | |
244 | - unset( $values['customer.address.id'] ); |
|
245 | - $item->fromArray( $values ); |
|
244 | + unset($values['customer.address.id']); |
|
245 | + $item->fromArray($values); |
|
246 | 246 | |
247 | - return $manager->saveItem( $item ); |
|
247 | + return $manager->saveItem($item); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | |
@@ -255,12 +255,12 @@ discard block |
||
255 | 255 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
256 | 256 | * @since 2017.04 |
257 | 257 | */ |
258 | - public function getAddressItem( $id ) |
|
258 | + public function getAddressItem($id) |
|
259 | 259 | { |
260 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/address' ); |
|
260 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/address'); |
|
261 | 261 | |
262 | - $item = $manager->getItem( $id ); |
|
263 | - $this->checkUser( $item->getParentId() ); |
|
262 | + $item = $manager->getItem($id); |
|
263 | + $this->checkUser($item->getParentId()); |
|
264 | 264 | |
265 | 265 | return $item; |
266 | 266 | } |
@@ -272,9 +272,9 @@ discard block |
||
272 | 272 | * @param \Aimeos\MShop\Customer\Item\Address\Iface $item Customer address item |
273 | 273 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item including the generated ID |
274 | 274 | */ |
275 | - public function saveAddressItem( \Aimeos\MShop\Customer\Item\Address\Iface $item ) |
|
275 | + public function saveAddressItem(\Aimeos\MShop\Customer\Item\Address\Iface $item) |
|
276 | 276 | { |
277 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/address' )->saveItem( $item ); |
|
277 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/address')->saveItem($item); |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | |
@@ -285,32 +285,32 @@ discard block |
||
285 | 285 | * @return \Aimeos\MShop\Common\Item\Lists\Iface Customer lists item |
286 | 286 | * @since 2017.06 |
287 | 287 | */ |
288 | - public function addListItem( array $values ) |
|
288 | + public function addListItem(array $values) |
|
289 | 289 | { |
290 | 290 | $context = $this->getContext(); |
291 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists' ); |
|
291 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists'); |
|
292 | 292 | |
293 | - if( !isset( $values['customer.lists.typeid'] ) ) |
|
293 | + if (!isset($values['customer.lists.typeid'])) |
|
294 | 294 | { |
295 | - if( !isset( $values['customer.lists.type'] ) ) { |
|
296 | - throw new \Aimeos\Controller\Frontend\Customer\Exception( sprintf( 'No customer lists type code' ) ); |
|
295 | + if (!isset($values['customer.lists.type'])) { |
|
296 | + throw new \Aimeos\Controller\Frontend\Customer\Exception(sprintf('No customer lists type code')); |
|
297 | 297 | } |
298 | 298 | |
299 | - if( !isset( $values['customer.lists.domain'] ) ) { |
|
300 | - throw new \Aimeos\Controller\Frontend\Customer\Exception( sprintf( 'No customer lists domain' ) ); |
|
299 | + if (!isset($values['customer.lists.domain'])) { |
|
300 | + throw new \Aimeos\Controller\Frontend\Customer\Exception(sprintf('No customer lists domain')); |
|
301 | 301 | } |
302 | 302 | |
303 | - $typeManager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists/type' ); |
|
304 | - $typeItem = $typeManager->findItem( $values['customer.lists.type'], [], $values['customer.lists.domain'] ); |
|
303 | + $typeManager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists/type'); |
|
304 | + $typeItem = $typeManager->findItem($values['customer.lists.type'], [], $values['customer.lists.domain']); |
|
305 | 305 | $values['customer.lists.typeid'] = $typeItem->getId(); |
306 | 306 | } |
307 | 307 | |
308 | 308 | $item = $manager->createItem(); |
309 | - $item->fromArray( $values ); |
|
310 | - $item->setId( null ); |
|
311 | - $item->setParentId( $context->getUserId() ); |
|
309 | + $item->fromArray($values); |
|
310 | + $item->setId(null); |
|
311 | + $item->setParentId($context->getUserId()); |
|
312 | 312 | |
313 | - return $manager->saveItem( $item ); |
|
313 | + return $manager->saveItem($item); |
|
314 | 314 | } |
315 | 315 | |
316 | 316 | |
@@ -323,10 +323,10 @@ discard block |
||
323 | 323 | public function createListsFilter() |
324 | 324 | { |
325 | 325 | $context = $this->getContext(); |
326 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists' ); |
|
326 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists'); |
|
327 | 327 | |
328 | 328 | $filter = $manager->createSearch(); |
329 | - $filter->setConditions( $filter->compare( '==', 'customer.lists.parentid', $context->getUserId() ) ); |
|
329 | + $filter->setConditions($filter->compare('==', 'customer.lists.parentid', $context->getUserId())); |
|
330 | 330 | |
331 | 331 | return $filter; |
332 | 332 | } |
@@ -338,13 +338,13 @@ discard block |
||
338 | 338 | * @param string $id Unique customer address ID |
339 | 339 | * @since 2017.06 |
340 | 340 | */ |
341 | - public function deleteListItem( $id ) |
|
341 | + public function deleteListItem($id) |
|
342 | 342 | { |
343 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/lists' ); |
|
343 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/lists'); |
|
344 | 344 | |
345 | - $this->checkUser( $manager->getItem( $id )->getParentId() ); |
|
345 | + $this->checkUser($manager->getItem($id)->getParentId()); |
|
346 | 346 | |
347 | - $manager->deleteItem( $id ); |
|
347 | + $manager->deleteItem($id); |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | |
@@ -356,33 +356,33 @@ discard block |
||
356 | 356 | * @return \Aimeos\MShop\Common\Item\Lists\Iface Customer lists item |
357 | 357 | * @since 2017.06 |
358 | 358 | */ |
359 | - public function editListItem( $id, array $values ) |
|
359 | + public function editListItem($id, array $values) |
|
360 | 360 | { |
361 | 361 | $context = $this->getContext(); |
362 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists' ); |
|
362 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists'); |
|
363 | 363 | |
364 | - $item = $manager->getItem( $id, [], true ); |
|
365 | - $this->checkUser( $item->getParentId() ); |
|
364 | + $item = $manager->getItem($id, [], true); |
|
365 | + $this->checkUser($item->getParentId()); |
|
366 | 366 | |
367 | - if( !isset( $values['customer.lists.typeid'] ) ) |
|
367 | + if (!isset($values['customer.lists.typeid'])) |
|
368 | 368 | { |
369 | - if( !isset( $values['customer.lists.type'] ) ) { |
|
370 | - throw new \Aimeos\Controller\Frontend\Customer\Exception( sprintf( 'No customer lists type code' ) ); |
|
369 | + if (!isset($values['customer.lists.type'])) { |
|
370 | + throw new \Aimeos\Controller\Frontend\Customer\Exception(sprintf('No customer lists type code')); |
|
371 | 371 | } |
372 | 372 | |
373 | - if( !isset( $values['customer.lists.domain'] ) ) { |
|
374 | - throw new \Aimeos\Controller\Frontend\Customer\Exception( sprintf( 'No customer lists domain' ) ); |
|
373 | + if (!isset($values['customer.lists.domain'])) { |
|
374 | + throw new \Aimeos\Controller\Frontend\Customer\Exception(sprintf('No customer lists domain')); |
|
375 | 375 | } |
376 | 376 | |
377 | - $typeManager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists/type' ); |
|
378 | - $typeItem = $typeManager->findItem( $values['customer.lists.type'], [], $values['customer.lists.domain'] ); |
|
377 | + $typeManager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists/type'); |
|
378 | + $typeItem = $typeManager->findItem($values['customer.lists.type'], [], $values['customer.lists.domain']); |
|
379 | 379 | $values['customer.lists.typeid'] = $typeItem->getId(); |
380 | 380 | } |
381 | 381 | |
382 | - unset( $values['customer.lists.id'] ); |
|
383 | - $item->fromArray( $values ); |
|
382 | + unset($values['customer.lists.id']); |
|
383 | + $item->fromArray($values); |
|
384 | 384 | |
385 | - return $manager->saveItem( $item ); |
|
385 | + return $manager->saveItem($item); |
|
386 | 386 | } |
387 | 387 | |
388 | 388 | |
@@ -393,12 +393,12 @@ discard block |
||
393 | 393 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
394 | 394 | * @since 2017.06 |
395 | 395 | */ |
396 | - public function getListItem( $id ) |
|
396 | + public function getListItem($id) |
|
397 | 397 | { |
398 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/lists' ); |
|
399 | - $item = $manager->getItem( $id ); |
|
398 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/lists'); |
|
399 | + $item = $manager->getItem($id); |
|
400 | 400 | |
401 | - $this->checkUser( $item->getParentId() ); |
|
401 | + $this->checkUser($item->getParentId()); |
|
402 | 402 | |
403 | 403 | return $item; |
404 | 404 | } |
@@ -412,11 +412,11 @@ discard block |
||
412 | 412 | * @return \Aimeos\MShop\Common\Item\Lists\Iface[] Customer list items |
413 | 413 | * @since 2017.06 |
414 | 414 | */ |
415 | - public function searchListItems( \Aimeos\MW\Criteria\Iface $filter, &$total = null ) |
|
415 | + public function searchListItems(\Aimeos\MW\Criteria\Iface $filter, &$total = null) |
|
416 | 416 | { |
417 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/lists' ); |
|
417 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/lists'); |
|
418 | 418 | |
419 | - return $manager->searchItems( $filter, [], $total ); |
|
419 | + return $manager->searchItems($filter, [], $total); |
|
420 | 420 | } |
421 | 421 | |
422 | 422 | |
@@ -426,37 +426,37 @@ discard block |
||
426 | 426 | * @param string[] $values Associative list of customer keys (e.g. "customer.label") and their values |
427 | 427 | * @return string[] Associative list of customer key/value pairs with default values set |
428 | 428 | */ |
429 | - protected function addItemDefaults( array $values ) |
|
429 | + protected function addItemDefaults(array $values) |
|
430 | 430 | { |
431 | - if( !isset( $values['customer.label'] ) || $values['customer.label'] == '' ) |
|
431 | + if (!isset($values['customer.label']) || $values['customer.label'] == '') |
|
432 | 432 | { |
433 | 433 | $label = ''; |
434 | 434 | |
435 | - if( isset( $values['customer.lastname'] ) ) { |
|
435 | + if (isset($values['customer.lastname'])) { |
|
436 | 436 | $label = $values['customer.lastname']; |
437 | 437 | } |
438 | 438 | |
439 | - if( isset( $values['customer.firstname'] ) && $values['customer.firstname'] != '' ) { |
|
439 | + if (isset($values['customer.firstname']) && $values['customer.firstname'] != '') { |
|
440 | 440 | $label = $values['customer.firstname'] . ' ' . $label; |
441 | 441 | } |
442 | 442 | |
443 | - if( isset( $values['customer.company'] ) && $values['customer.company'] != '' ) { |
|
443 | + if (isset($values['customer.company']) && $values['customer.company'] != '') { |
|
444 | 444 | $label .= ' (' . $values['customer.company'] . ')'; |
445 | 445 | } |
446 | 446 | |
447 | 447 | $values['customer.label'] = $label; |
448 | 448 | } |
449 | 449 | |
450 | - if( !isset( $values['customer.code'] ) ) { |
|
450 | + if (!isset($values['customer.code'])) { |
|
451 | 451 | $values['customer.code'] = $values['customer.email']; |
452 | 452 | } |
453 | 453 | |
454 | - if( !isset( $values['customer.status'] ) ) { |
|
454 | + if (!isset($values['customer.status'])) { |
|
455 | 455 | $values['customer.status'] = 1; |
456 | 456 | } |
457 | 457 | |
458 | - if( !isset( $values['customer.password'] ) ) { |
|
459 | - $values['customer.password'] = substr( md5( microtime( true ) . getmypid() . rand() ), -8 ); |
|
458 | + if (!isset($values['customer.password'])) { |
|
459 | + $values['customer.password'] = substr(md5(microtime(true) . getmypid() . rand()), -8); |
|
460 | 460 | } |
461 | 461 | |
462 | 462 | return $values; |
@@ -469,12 +469,12 @@ discard block |
||
469 | 469 | * @param string $id Unique customer ID |
470 | 470 | * @throws \Aimeos\Controller\Frontend\Customer\Exception If access isn't allowed |
471 | 471 | */ |
472 | - protected function checkUser( $id ) |
|
472 | + protected function checkUser($id) |
|
473 | 473 | { |
474 | - if( $id != $this->getContext()->getUserId() ) |
|
474 | + if ($id != $this->getContext()->getUserId()) |
|
475 | 475 | { |
476 | - $msg = sprintf( 'Not allowed to access customer data for ID "%1$s"', $id ); |
|
477 | - throw new \Aimeos\Controller\Frontend\Customer\Exception( $msg ); |
|
476 | + $msg = sprintf('Not allowed to access customer data for ID "%1$s"', $id); |
|
477 | + throw new \Aimeos\Controller\Frontend\Customer\Exception($msg); |
|
478 | 478 | } |
479 | 479 | } |
480 | 480 | } |