@@ -18,123 +18,123 @@ 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 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' ); |
|
57 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'customer'); |
|
58 | 58 | |
59 | - $item = $this->object->addItem( ['customer.code' => 'UTC001'] ); |
|
60 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $item ); |
|
59 | + $item = $this->object->addItem(['customer.code' => 'UTC001']); |
|
60 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $item); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | |
64 | 64 | public function testCreateItem() |
65 | 65 | { |
66 | 66 | $result = $this->object->createItem(); |
67 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $result ); |
|
67 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $result); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | |
71 | 71 | public function testGetItem() |
72 | 72 | { |
73 | - $id = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' )->findItem( 'UTC001' )->getId(); |
|
74 | - $this->context->setUserId( $id ); |
|
73 | + $id = \Aimeos\MShop\Factory::createManager($this->context, 'customer')->findItem('UTC001')->getId(); |
|
74 | + $this->context->setUserId($id); |
|
75 | 75 | |
76 | - $result = $this->object->getItem( $id, ['customer/address', 'text'] ); |
|
76 | + $result = $this->object->getItem($id, ['customer/address', 'text']); |
|
77 | 77 | |
78 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $result ); |
|
79 | - $this->assertEquals( 1, count( $result->getRefItems( 'text' ) ) ); |
|
80 | - $this->assertEquals( 1, count( $result->getAddressItems() ) ); |
|
78 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $result); |
|
79 | + $this->assertEquals(1, count($result->getRefItems('text'))); |
|
80 | + $this->assertEquals(1, count($result->getAddressItems())); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | |
84 | 84 | public function testFindItem() |
85 | 85 | { |
86 | - $result = $this->object->findItem( 'UTC001' ); |
|
87 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $result ); |
|
86 | + $result = $this->object->findItem('UTC001'); |
|
87 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $result); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | |
91 | 91 | public function testAddEditSaveDeleteAddressItem() |
92 | 92 | { |
93 | - $customer = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' )->findItem( 'UTC001' ); |
|
94 | - $this->context->setUserId( $customer->getId() ); |
|
93 | + $customer = \Aimeos\MShop\Factory::createManager($this->context, 'customer')->findItem('UTC001'); |
|
94 | + $this->context->setUserId($customer->getId()); |
|
95 | 95 | |
96 | - $item = $this->object->addAddressItem( ['customer.address.lastname' => 'unittest-ctnl'] ); |
|
97 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Address\Iface', $item ); |
|
96 | + $item = $this->object->addAddressItem(['customer.address.lastname' => 'unittest-ctnl']); |
|
97 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Address\Iface', $item); |
|
98 | 98 | |
99 | - $item = $this->object->editAddressItem( $item->getId(), ['customer.address.lastname' => 'unittest-ctnl2'] ); |
|
100 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Address\Iface', $item ); |
|
99 | + $item = $this->object->editAddressItem($item->getId(), ['customer.address.lastname' => 'unittest-ctnl2']); |
|
100 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Address\Iface', $item); |
|
101 | 101 | |
102 | - $item->setLastName( 'test' ); |
|
103 | - $this->object->saveAddressItem( $item ); |
|
104 | - $this->assertEquals( 'test', $item->getLastName() ); |
|
102 | + $item->setLastName('test'); |
|
103 | + $this->object->saveAddressItem($item); |
|
104 | + $this->assertEquals('test', $item->getLastName()); |
|
105 | 105 | |
106 | - $this->object->deleteAddressItem( $item->getId() ); |
|
106 | + $this->object->deleteAddressItem($item->getId()); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | |
110 | 110 | public function testCreateAddressItem() |
111 | 111 | { |
112 | 112 | $result = $this->object->createAddressItem(); |
113 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Address\Iface', $result ); |
|
113 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Address\Iface', $result); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | |
117 | 117 | public function testGetAddressItem() |
118 | 118 | { |
119 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'customer/address' ); |
|
119 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'customer/address'); |
|
120 | 120 | $search = $manager->createSearch(); |
121 | - $search->setSlice( 0, 1 ); |
|
122 | - $result = $manager->searchItems( $search ); |
|
121 | + $search->setSlice(0, 1); |
|
122 | + $result = $manager->searchItems($search); |
|
123 | 123 | |
124 | - if( ( $item = reset( $result ) ) === false ) { |
|
125 | - throw new \RuntimeException( 'No customer address available' ); |
|
124 | + if (($item = reset($result)) === false) { |
|
125 | + throw new \RuntimeException('No customer address available'); |
|
126 | 126 | } |
127 | 127 | |
128 | - $this->context->setUserId( $item->getParentId() ); |
|
129 | - $result = $this->object->getAddressItem( $item->getId() ); |
|
130 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Address\Iface', $result ); |
|
128 | + $this->context->setUserId($item->getParentId()); |
|
129 | + $result = $this->object->getAddressItem($item->getId()); |
|
130 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Address\Iface', $result); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | |
134 | 134 | public function testAddEditDeleteListItem() |
135 | 135 | { |
136 | - $customer = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' )->findItem( 'UTC001' ); |
|
137 | - $this->context->setUserId( $customer->getId() ); |
|
136 | + $customer = \Aimeos\MShop\Factory::createManager($this->context, 'customer')->findItem('UTC001'); |
|
137 | + $this->context->setUserId($customer->getId()); |
|
138 | 138 | |
139 | 139 | $values = [ |
140 | 140 | 'customer.lists.type' => 'favorite', |
@@ -142,8 +142,8 @@ discard block |
||
142 | 142 | 'customer.lists.refid' => '-1' |
143 | 143 | ]; |
144 | 144 | |
145 | - $item = $this->object->addListItem( $values ); |
|
146 | - $this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Lists\Iface', $item ); |
|
145 | + $item = $this->object->addListItem($values); |
|
146 | + $this->assertInstanceOf('\Aimeos\MShop\Common\Item\Lists\Iface', $item); |
|
147 | 147 | |
148 | 148 | $values = [ |
149 | 149 | 'customer.lists.type' => 'favorite', |
@@ -151,46 +151,46 @@ discard block |
||
151 | 151 | 'customer.lists.refid' => '-2' |
152 | 152 | ]; |
153 | 153 | |
154 | - $item = $this->object->editListItem( $item->getId(), $values ); |
|
155 | - $this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Lists\Iface', $item ); |
|
154 | + $item = $this->object->editListItem($item->getId(), $values); |
|
155 | + $this->assertInstanceOf('\Aimeos\MShop\Common\Item\Lists\Iface', $item); |
|
156 | 156 | |
157 | - $this->object->deleteListItem( $item->getId() ); |
|
157 | + $this->object->deleteListItem($item->getId()); |
|
158 | 158 | |
159 | - $this->setExpectedException( '\Aimeos\MShop\Exception' ); |
|
160 | - $this->object->getListItem( $item->getId() ); |
|
159 | + $this->setExpectedException('\Aimeos\MShop\Exception'); |
|
160 | + $this->object->getListItem($item->getId()); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | |
164 | 164 | public function testGetListItem() |
165 | 165 | { |
166 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'customer/lists' ); |
|
166 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'customer/lists'); |
|
167 | 167 | $search = $manager->createSearch(); |
168 | - $search->setSlice( 0, 1 ); |
|
169 | - $result = $manager->searchItems( $search ); |
|
168 | + $search->setSlice(0, 1); |
|
169 | + $result = $manager->searchItems($search); |
|
170 | 170 | |
171 | - if( ( $item = reset( $result ) ) === false ) { |
|
172 | - throw new \RuntimeException( 'No customer lists item available' ); |
|
171 | + if (($item = reset($result)) === false) { |
|
172 | + throw new \RuntimeException('No customer lists item available'); |
|
173 | 173 | } |
174 | 174 | |
175 | - $this->context->setUserId( $item->getParentId() ); |
|
176 | - $result = $this->object->getListItem( $item->getId() ); |
|
177 | - $this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Lists\Iface', $result ); |
|
175 | + $this->context->setUserId($item->getParentId()); |
|
176 | + $result = $this->object->getListItem($item->getId()); |
|
177 | + $this->assertInstanceOf('\Aimeos\MShop\Common\Item\Lists\Iface', $result); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | |
181 | 181 | public function testSearchListItem() |
182 | 182 | { |
183 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' ); |
|
184 | - $customer = $manager->findItem( 'UTC001' ); |
|
185 | - $this->context->setUserId( $customer->getId() ); |
|
183 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'customer'); |
|
184 | + $customer = $manager->findItem('UTC001'); |
|
185 | + $this->context->setUserId($customer->getId()); |
|
186 | 186 | |
187 | 187 | $filter = $this->object->createListsFilter(); |
188 | - $result = $this->object->searchListItems( $filter ); |
|
188 | + $result = $this->object->searchListItems($filter); |
|
189 | 189 | |
190 | - foreach( $result as $item ) |
|
190 | + foreach ($result as $item) |
|
191 | 191 | { |
192 | - $this->assertEquals( $customer->getId(), $item->getParentId() ); |
|
193 | - $this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Lists\Iface', $item ); |
|
192 | + $this->assertEquals($customer->getId(), $item->getParentId()); |
|
193 | + $this->assertInstanceOf('\Aimeos\MShop\Common\Item\Lists\Iface', $item); |
|
194 | 194 | } |
195 | 195 | } |
196 | 196 | } |